]> git.hungrycats.org Git - linux/commitdiff
Btrfs: call inode_dec_link_count() on mkdir error path
authorWang Shilong <wangshilong1991@gmail.com>
Wed, 24 Dec 2014 06:45:30 +0000 (14:45 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 8 Mar 2015 04:03:39 +0000 (23:03 -0500)
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>
(cherry picked from commit c7cfb8a5405a34777d670f7a5441bb2c7ca9730f)

fs/btrfs/inode.c

index d23362f4464e9b7091654ed570e726dd9b7507b3..b6aa91bccaea7043fdbfd1a4c7cab825c406f12d 100644 (file)
@@ -6203,8 +6203,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;