diff options
author | NeilBrown <neilb@suse.de> | 2009-08-10 12:50:52 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-08-10 12:50:52 +1000 |
commit | c8c00a6915a2e3d10416e8bdd3138429beb96210 (patch) | |
tree | ecf06a9e2b08edefe707da450b52a69f818ec7d6 /drivers/md/raid6recov.c | |
parent | 7b2aa037e878c939676675969983284a02958ae3 (diff) | |
download | talos-op-linux-c8c00a6915a2e3d10416e8bdd3138429beb96210.tar.gz talos-op-linux-c8c00a6915a2e3d10416e8bdd3138429beb96210.zip |
Remove deadlock potential in md_open
A recent commit:
commit 449aad3e25358812c43afc60918c5ad3819488e7
introduced the possibility of an A-B/B-A deadlock between
bd_mutex and reconfig_mutex.
__blkdev_get holds bd_mutex while calling md_open which takes
reconfig_mutex,
do_md_run is always called with reconfig_mutex held, and it now
takes bd_mutex in the call the revalidate_disk.
This potential deadlock was not caught by lockdep due to the
use of mutex_lock_interruptible_nexted which was introduced
by
commit d63a5a74dee87883fda6b7d170244acaac5b05e8
do avoid a warning of an impossible deadlock.
It is quite possible to split reconfig_mutex in to two locks.
One protects the array data structures while it is being
reconfigured, the other ensures that an array is never even partially
open while it is being deactivated.
In particular, the second lock prevents an open from completing
between the time when do_md_stop checks if there are any active opens,
and the time when the array is either set read-only, or when ->pers is
set to NULL. So we can be certain that no IO is in flight as the
array is being destroyed.
So create a new lock, open_mutex, just to ensure exclusion between
'open' and 'stop'.
This avoids the deadlock and also avoids the lockdep warning mentioned
in commit d63a5a74d
Reported-by: "Mike Snitzer" <snitzer@gmail.com>
Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid6recov.c')
0 files changed, 0 insertions, 0 deletions