aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-08-22 17:03:29 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-01 08:16:23 -0400
commitb8d0c69b9469ffd33df30fee3e990f2d4aa68a09 (patch)
treeba6694c593b6f6cde9a2505c18c66b3b192b8d11 /fs/btrfs/extent-tree.c
parente8e7cff667e674a886f4fbf1773c217bb9a0f664 (diff)
Btrfs: remove ourselves from the cluster list under lock
A user was reporting weird warnings from btrfs_put_delayed_ref() and I noticed that we were doing this list_del_init() on our head ref outside of delayed_refs->lock. This is a problem if we have people still on the list, we could end up modifying old pointers and such. Fix this by removing us from the list before we do our run_delayed_ref on our head ref. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 69083330ee16..cfb3cf711b34 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2440,6 +2440,8 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
2440 default: 2440 default:
2441 WARN_ON(1); 2441 WARN_ON(1);
2442 } 2442 }
2443 } else {
2444 list_del_init(&locked_ref->cluster);
2443 } 2445 }
2444 spin_unlock(&delayed_refs->lock); 2446 spin_unlock(&delayed_refs->lock);
2445 2447
@@ -2462,7 +2464,6 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
2462 * list before we release it. 2464 * list before we release it.
2463 */ 2465 */
2464 if (btrfs_delayed_ref_is_head(ref)) { 2466 if (btrfs_delayed_ref_is_head(ref)) {
2465 list_del_init(&locked_ref->cluster);
2466 btrfs_delayed_ref_unlock(locked_ref); 2467 btrfs_delayed_ref_unlock(locked_ref);
2467 locked_ref = NULL; 2468 locked_ref = NULL;
2468 } 2469 }