Commit c7cfb8a5 authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason
Browse files

Btrfs: call inode_dec_link_count() on mkdir error path



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: default avatarWang Shilong <wangshilong1991@gmail.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent df95e7f0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;