Skip to content

Commit ad24466

Browse files
josefbacikkdave
authored andcommitted
btrfs: set the correct lockdep class for new nodes
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. The affected path is through btrfs_copy_root as all other callers of btrfs_alloc_tree_block (which calls init_new_buffer) have root_objectid == root->root_key.objectid . CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Nikolay Borisov <nborisov@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>
1 parent e89c4a9 commit ad24466

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4527,7 +4527,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
45274527
return ERR_PTR(-EUCLEAN);
45284528
}
45294529

4530-
btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
4530+
btrfs_set_buffer_lockdep_class(owner, buf, level);
45314531
btrfs_tree_lock(buf);
45324532
btrfs_clean_tree_block(buf);
45334533
clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);

0 commit comments

Comments
 (0)