mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
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>
This commit is contained in:
parent
e8e7cff667
commit
b8d0c69b94
1 changed files with 2 additions and 1 deletions
|
@ -2440,6 +2440,8 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
list_del_init(&locked_ref->cluster);
|
||||||
}
|
}
|
||||||
spin_unlock(&delayed_refs->lock);
|
spin_unlock(&delayed_refs->lock);
|
||||||
|
|
||||||
|
@ -2462,7 +2464,6 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
|
||||||
* list before we release it.
|
* list before we release it.
|
||||||
*/
|
*/
|
||||||
if (btrfs_delayed_ref_is_head(ref)) {
|
if (btrfs_delayed_ref_is_head(ref)) {
|
||||||
list_del_init(&locked_ref->cluster);
|
|
||||||
btrfs_delayed_ref_unlock(locked_ref);
|
btrfs_delayed_ref_unlock(locked_ref);
|
||||||
locked_ref = NULL;
|
locked_ref = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue