aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWang Shilong <wangshilong1991@gmail.com>2014-12-24 01:45:30 -0500
committerChris Mason <clm@fb.com>2015-01-02 14:47:55 -0500
commitc7cfb8a5405a34777d670f7a5441bb2c7ca9730f (patch)
tree4e960a9e39362a5cd5f6e704b4980e3f4da4004e /fs
parentdf95e7f0d93e2fa776b168eac798a16a1e361022 (diff)
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: Wang Shilong <wangshilong1991@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8de23355f6cf..8a036ed234ad 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6255,8 +6255,10 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
6255 6255
6256out_fail: 6256out_fail:
6257 btrfs_end_transaction(trans, root); 6257 btrfs_end_transaction(trans, root);
6258 if (drop_on_err) 6258 if (drop_on_err) {
6259 inode_dec_link_count(inode);
6259 iput(inode); 6260 iput(inode);
6261 }
6260 btrfs_balance_delayed_items(root); 6262 btrfs_balance_delayed_items(root);
6261 btrfs_btree_balance_dirty(root); 6263 btrfs_btree_balance_dirty(root);
6262 return err; 6264 return err;