]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: introduce BTRFS_NESTING_NEW_ROOT for adding new roots
authorJosef Bacik <josef@toxicpanda.com>
Thu, 20 Aug 2020 15:46:07 +0000 (11:46 -0400)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Oct 2020 10:12:17 +0000 (12:12 +0200)
commit0233396e947ccbbd84803157e3eb6accf3511a2c
treeeda9486b7532bda46f13e685536609de03b22592
parent8448bf6db0eb7a199f55645f84fcee4ecc895d01
btrfs: introduce BTRFS_NESTING_NEW_ROOT for adding new roots

The way we add new roots is confusing from a locking perspective for
lockdep.  We generally have the rule that we lock things in order from
highest level to lowest, but in the case of adding a new level to the
tree we actually allocate a new block for the root, which makes the
locking go in reverse.  A similar issue exists for snapshotting, we cow
the original root for the root of a new tree, however they're at the
same level.  Address this by using BTRFS_NESTING_NEW_ROOT for these
operations.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c
fs/btrfs/locking.h