mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Singed-off-by: Li Zefan <[email protected]>
This commit is contained in:
parent
b9e03af0bc
commit
3153495d8e
1 changed files with 3 additions and 3 deletions
|
|
@ -4846,9 +4846,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
|
|||
if (inode->i_nlink == ~0U)
|
||||
return -EMLINK;
|
||||
|
||||
btrfs_inc_nlink(inode);
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
|
||||
err = btrfs_set_inode_index(dir, &index);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
|
@ -4864,6 +4861,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
btrfs_inc_nlink(inode);
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
|
||||
btrfs_set_trans_block_group(trans, dir);
|
||||
ihold(inode);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue