Btrfs: set lockdep class before locking new extent buffer
authorJosef Bacik <jbacik@fusionio.com>
Fri, 5 Jul 2013 21:05:38 +0000 (17:05 -0400)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 11:57:20 +0000 (07:57 -0400)
We've been seeing spurious complaints out of lockdep because the lock class name
changes.  This is happening because when we drop a snapshot we will lock a block
before we've read it in, which sets the lockdep class to whatever the default
is.  Then once we read the thing in we reset the lockdep class to what it is
supposed to be, which blows lockdeps' mind.  This patch should fix the problem,
it appears to be the only place where we do this sort of thing.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/extent-tree.c

index 1204c8ef6f32751bd859d2ef1a2ab3444061f708..7e172c6dba68f52a726fbfeba7df3c3887051adf 100644 (file)
@@ -7173,6 +7173,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
                next = btrfs_find_create_tree_block(root, bytenr, blocksize);
                if (!next)
                        return -ENOMEM;
+               btrfs_set_buffer_lockdep_class(root->root_key.objectid, next,
+                                              level - 1);
                reada = 1;
        }
        btrfs_tree_lock(next);