]> git.baikalelectronics.ru Git - kernel.git/commit
Fix problem with waiting while holding rcu read lock in md/bitmap.c
authorNeilBrown <neilb@suse.de>
Mon, 1 Sep 2008 02:48:13 +0000 (12:48 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 1 Sep 2008 02:48:13 +0000 (12:48 +1000)
commit5571f393b6aadc07514ee445ada890fd063a1ce9
tree5fb4150c33066f9fa70cc39853e5400ad6d54dca
parenta3c03219e8a3d6058daa22c069aad4d9043f23dc
Fix problem with waiting while holding rcu read lock in md/bitmap.c

A recent patch to protect the rdev list with rcu locking leaves us
with a problem because we can sleep on memalloc while holding the
rcu lock.

The rcu lock is only needed while walking the linked list as
uninteresting devices (failed or spares) can be removed at any time.

So only take the rcu lock while actually walking the linked list.
Take a refcount on the rdev during the time when we drop the lock
and do the memalloc to start IO.
When we return to the locked code, all the interesting devices
on the list will not have moved, so we can simply use
list_for_each_continue_rcu to pick up where we left off.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/bitmap.c