diff mbox series

[01/14] btrfs: remove lockdep classes for the fs tree

Message ID e19ba3fe887ce6ace42c8d57cf0db54e38ab5eb3.1604591048.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Set the lockdep class on eb's at allocation time | expand

Commit Message

Josef Bacik Nov. 5, 2020, 3:45 p.m. UTC
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 tree's, because all other
tree's 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.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/disk-io.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Filipe Manana Nov. 6, 2020, 11:50 a.m. UTC | #1
On Thu, Nov 5, 2020 at 3:47 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> 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 tree's, because all other
> tree's 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.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

I couldn't get anymore the lockdep splat I reported before, it used to
happen very often with btrfs/033.

Looks good, thanks.

> ---
>  fs/btrfs/disk-io.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 212806d59012..35b16fe3b05f 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -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")      },
> --
> 2.26.2
>
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 212806d59012..35b16fe3b05f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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")	},