btrfs: only unlock block in verify_parent_transid if we locked it
authorJosef Bacik <jbacik@fb.com>
Wed, 25 Jun 2014 20:45:41 +0000 (13:45 -0700)
committerChris Mason <clm@fb.com>
Sat, 28 Jun 2014 20:48:47 +0000 (13:48 -0700)
This is a regression from my patch a26e8c9f75b0bfd8cccc9e8f110737b136eb5994, we
need to only unlock the block if we were the one who locked it.  Otherwise this
will trip BUG_ON()'s in locking.c  Thanks,

cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/disk-io.c

index 8bb4aa19898fb2b73a039b7f3ffd61fb70dd15f0..f00165de6fbf58b90408540a485fa0b1a5c656b4 100644 (file)
@@ -369,7 +369,8 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
 out:
        unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1,
                             &cached_state, GFP_NOFS);
-       btrfs_tree_read_unlock_blocking(eb);
+       if (need_lock)
+               btrfs_tree_read_unlock_blocking(eb);
        return ret;
 }