Skip to content

Commit d3beaa2

Browse files
josefbacikkdave
authored andcommitted
btrfs: set the lockdep class for log tree extent buffers
These are special extent buffers that get rewound in order to lookup the state of the tree at a specific point in time. As such they do not go through the normal initialization paths that set their lockdep class, so handle them appropriately when they are created and before they are locked. CC: [email protected] # 4.4+ Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent ad24466 commit d3beaa2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/btrfs/ctree.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
12971297
btrfs_tree_read_unlock_blocking(eb);
12981298
free_extent_buffer(eb);
12991299

1300+
btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb_rewin),
1301+
eb_rewin, btrfs_header_level(eb_rewin));
13001302
btrfs_tree_read_lock(eb_rewin);
13011303
__tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
13021304
WARN_ON(btrfs_header_nritems(eb_rewin) >
@@ -1370,14 +1372,16 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
13701372

13711373
if (!eb)
13721374
return NULL;
1373-
btrfs_tree_read_lock(eb);
13741375
if (old_root) {
13751376
btrfs_set_header_bytenr(eb, eb->start);
13761377
btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
13771378
btrfs_set_header_owner(eb, eb_root_owner);
13781379
btrfs_set_header_level(eb, old_root->level);
13791380
btrfs_set_header_generation(eb, old_generation);
13801381
}
1382+
btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb,
1383+
btrfs_header_level(eb));
1384+
btrfs_tree_read_lock(eb);
13811385
if (tm)
13821386
__tree_mod_log_rewind(fs_info, eb, time_seq, tm);
13831387
else

0 commit comments

Comments
 (0)