Skip to content

Commit 1a65e24

Browse files
author
Chris Mason
committed
Btrfs: move d_instantiate outside the transaction during mksubvol
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 <[email protected]>
1 parent eb6b88d commit 1a65e24

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/ioctl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ static noinline int create_subvol(struct btrfs_root *root,
515515

516516
BUG_ON(ret);
517517

518-
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
519518
fail:
520519
if (async_transid) {
521520
*async_transid = trans->transid;
@@ -525,6 +524,10 @@ static noinline int create_subvol(struct btrfs_root *root,
525524
}
526525
if (err && !ret)
527526
ret = err;
527+
528+
if (!ret)
529+
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
530+
528531
return ret;
529532
}
530533

0 commit comments

Comments
 (0)