diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2011-04-13 01:19:21 -0400 |
---|---|---|
committer | Li Zefan <lizf@cn.fujitsu.com> | 2011-04-13 02:25:32 -0400 |
commit | 3153495d8ed6a9bb9f00aea42c18dc488a885dd6 (patch) | |
tree | ee1b57cff9be737fee9d4e35290e3c6586785de8 /fs | |
parent | b9e03af0bcc11310f6be4a3951c9ee2c26465011 (diff) |
Btrfs: Fix incorrect inode nlink in btrfs_link()
Link count of the inode is not decreased if btrfs_set_inode_index()
fails.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Singed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b9f7f5258343..a4157cfdd533 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4846,9 +4846,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4846 | if (inode->i_nlink == ~0U) | 4846 | if (inode->i_nlink == ~0U) |
4847 | return -EMLINK; | 4847 | return -EMLINK; |
4848 | 4848 | ||
4849 | btrfs_inc_nlink(inode); | ||
4850 | inode->i_ctime = CURRENT_TIME; | ||
4851 | |||
4852 | err = btrfs_set_inode_index(dir, &index); | 4849 | err = btrfs_set_inode_index(dir, &index); |
4853 | if (err) | 4850 | if (err) |
4854 | goto fail; | 4851 | goto fail; |
@@ -4864,6 +4861,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4864 | goto fail; | 4861 | goto fail; |
4865 | } | 4862 | } |
4866 | 4863 | ||
4864 | btrfs_inc_nlink(inode); | ||
4865 | inode->i_ctime = CURRENT_TIME; | ||
4866 | |||
4867 | btrfs_set_trans_block_group(trans, dir); | 4867 | btrfs_set_trans_block_group(trans, dir); |
4868 | ihold(inode); | 4868 | ihold(inode); |
4869 | 4869 | ||