Skip to content

Commit

Permalink
Btrfs: call inode_dec_link_count() on mkdir error path
Browse files Browse the repository at this point in the history
In btrfs_mkdir(), if it fails to create dir, we should
clean up existed items, setting inode's link properly
to make sure it could be cleaned up properly.

Signed-off-by: Wang Shilong <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
wangshilong authored and masoncl committed Jan 2, 2015
1 parent df95e7f commit c7cfb8a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6255,8 +6255,10 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)

out_fail:
btrfs_end_transaction(trans, root);
if (drop_on_err)
if (drop_on_err) {
inode_dec_link_count(inode);
iput(inode);
}
btrfs_balance_delayed_items(root);
btrfs_btree_balance_dirty(root);
return err;
Expand Down

0 comments on commit c7cfb8a

Please sign in to comment.