mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
md/raid5: protect big_stripe_tree lookup with RCU
big_stripe_tree is updated under tree_lock, and deleted radix-tree
nodes are freed after an RCU grace period. r5c_big_stripe_cached()
used to run under an RCU read-side critical section, but that protection
was removed together with unrelated rdev lookup protection.
The lookup can now be preempted while walking the tree, allowing a
concurrent deletion and grace period to complete before the walk
resumes. Protect the lookup locally with rcu_read_lock(). Only the
presence of the entry is used after unlocking.
Fixes: ad8606702f ("md/raid5: remove rcu protection to access rdev from conf")
Assisted-by: LLM
Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
Link: https://patch.msgid.link/179070265341.12871.12495446593114993799.idr-bug-88@gmail.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
This commit is contained in:
parent
af560e357a
commit
73b0df9294
|
|
@ -2968,7 +2968,9 @@ bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect)
|
|||
return false;
|
||||
|
||||
tree_index = r5c_tree_index(conf, sect);
|
||||
rcu_read_lock();
|
||||
slot = radix_tree_lookup(&log->big_stripe_tree, tree_index);
|
||||
rcu_read_unlock();
|
||||
return slot != NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user