Skip to content

Commit

Permalink
Btrfs: move d_instantiate outside the transaction during mksubvol
Browse files Browse the repository at this point in the history
Dave Sterba triggered a lockdep complaint about lock ordering
between the sb_internal lock and the cleaner semaphore.

btrfs_lookup_dentry() checks for orphans if we're looking up
the inode for a subvolume, and subvolume creation is triggering
the lookup with a transaction running.

This commit moves the d_instantiate after the transaction closes.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
  • Loading branch information
Chris Mason committed Feb 6, 2013
1 parent eb6b88d commit 1a65e24
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ static noinline int create_subvol(struct btrfs_root *root,

BUG_ON(ret);

d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
fail:
if (async_transid) {
*async_transid = trans->transid;
Expand All @@ -525,6 +524,10 @@ static noinline int create_subvol(struct btrfs_root *root,
}
if (err && !ret)
ret = err;

if (!ret)
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));

return ret;
}

Expand Down

0 comments on commit 1a65e24

Please sign in to comment.