提交 3153495d 编写于 作者: M Miao Xie 提交者: Li Zefan

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: NMiao Xie <miaox@cn.fujitsu.com>
Singed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
上级 b9e03af0
...@@ -4846,9 +4846,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -4846,9 +4846,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
if (inode->i_nlink == ~0U) if (inode->i_nlink == ~0U)
return -EMLINK; return -EMLINK;
btrfs_inc_nlink(inode);
inode->i_ctime = CURRENT_TIME;
err = btrfs_set_inode_index(dir, &index); err = btrfs_set_inode_index(dir, &index);
if (err) if (err)
goto fail; goto fail;
...@@ -4864,6 +4861,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -4864,6 +4861,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
goto fail; goto fail;
} }
btrfs_inc_nlink(inode);
inode->i_ctime = CURRENT_TIME;
btrfs_set_trans_block_group(trans, dir); btrfs_set_trans_block_group(trans, dir);
ihold(inode); ihold(inode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册