Re: [PATCH 05/17] btrfs: set the correct lockdep class for new nodes

Filipe Manana
2020-08-11T11:25:14Z

On Mon, Aug 10, 2020 at 4:44 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> When flipping over to the rw_semaphore I noticed I'd get a lockdep splat
> in replace_path(), which is weird because we're swapping the reloc root
> with the actual target root. Turns out this is because we're using the
> root->root_key.objectid as the root id for the newly allocated tree
> block when setting the lockdep class, however we need to be using the
> actual owner of this new block, which is saved in owner.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

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

Looks good, thanks.

> ---
> fs/btrfs/extent-tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index fa7d83051587..84029851f094 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4522,7 +4522,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> return ERR_PTR(-EUCLEAN);
> }
>
> - btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
> + btrfs_set_buffer_lockdep_class(owner, buf, level);
> btrfs_tree_lock(buf);
> btrfs_clean_tree_block(buf);
> clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
> --
> 2.24.1
>

--
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”