btrfs: remove lockdep classes for the fs tree
authorJosef Bacik <josef@toxicpanda.com>
Thu, 5 Nov 2020 15:45:08 +0000 (10:45 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:54:05 +0000 (15:54 +0100)
We have this weird problem where our lockdep class is set after we
read a tree block, which can race with concurrent readers and result in
erroneous lockdep errors.  We want to set the lockdep class at
allocation time if possible, but in certain cases we may not have the
actual root owner, such as with relocation or any backref lookups.  This
is only really a problem for reference counted trees, because all other
trees have their root reference set in their extent reference.  Remove
the fs tree specific lock class.  We need to still keep the reloc tree
one, it's still reference counted, because replace_path will lock the
reloc tree and the destination tree, and if they're both set to
tree-<level> we'll have issues.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
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/disk-io.c

index 3edbbbcbe75a2f9833d5827b6e59f8e7cccb4263..9f0d30ea535d562e3251898d154561295e379684 100644 (file)
@@ -173,7 +173,6 @@ static struct btrfs_lockdep_keyset {
        { .id = BTRFS_EXTENT_TREE_OBJECTID,     DEFINE_NAME("extent")   },
        { .id = BTRFS_CHUNK_TREE_OBJECTID,      DEFINE_NAME("chunk")    },
        { .id = BTRFS_DEV_TREE_OBJECTID,        DEFINE_NAME("dev")      },
-       { .id = BTRFS_FS_TREE_OBJECTID,         DEFINE_NAME("fs")       },
        { .id = BTRFS_CSUM_TREE_OBJECTID,       DEFINE_NAME("csum")     },
        { .id = BTRFS_QUOTA_TREE_OBJECTID,      DEFINE_NAME("quota")    },
        { .id = BTRFS_TREE_LOG_OBJECTID,        DEFINE_NAME("log")      },