linux/drivers/md
NeilBrown c8c00a6915 Remove deadlock potential in md_open
A recent commit:
  commit 449aad3e25

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 d63a5a74de
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>
2009-08-10 12:50:52 +10:00
..
raid6test md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
.gitignore
bitmap.c Merge branch 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block 2009-06-11 11:10:35 -07:00
bitmap.h md: move headers out of include/linux/raid/ 2009-03-31 14:27:03 +11:00
dm-bio-record.h dm: preserve bi_io_vec when resubmitting bios 2009-04-02 19:55:23 +01:00
dm-crypt.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-delay.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-exception-store.c dm exception store: really fix type lookup 2009-06-30 15:18:14 +01:00
dm-exception-store.h dm: use i_size_read 2009-06-22 10:12:14 +01:00
dm-io.c dm io: retry after barrier error 2009-06-22 10:12:26 +01:00
dm-ioctl.c dm: enable request based option 2009-06-22 10:12:36 +01:00
dm-kcopyd.c dm kcopyd: fix callback race 2009-04-09 00:27:17 +01:00
dm-linear.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-log-userspace-base.c dm raid1: add userspace log 2009-06-22 10:12:35 +01:00
dm-log-userspace-transfer.c dm raid1: add userspace log 2009-06-22 10:12:35 +01:00
dm-log-userspace-transfer.h dm raid1: add userspace log 2009-06-22 10:12:35 +01:00
dm-log.c dm log: fix create_log_context to use logical_block_size of log device 2009-06-22 10:12:33 +01:00
dm-mpath.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-mpath.h dm mpath: remove is_active from struct dm_path 2008-10-10 13:36:58 +01:00
dm-path-selector.c dm: path selector use module refcount directly 2009-04-02 19:55:27 +01:00
dm-path-selector.h dm mpath: add start_io and nr_bytes to path selectors 2009-06-22 10:12:27 +01:00
dm-queue-length.c dm mpath: add queue length load balancer 2009-06-22 10:12:27 +01:00
dm-raid1.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-region-hash.c dm raid1: keep retrying alloc if mempool_alloc failed 2009-06-22 10:12:13 +01:00
dm-round-robin.c dm mpath: add start_io and nr_bytes to path selectors 2009-06-22 10:12:27 +01:00
dm-service-time.c dm mpath: add service time load balancer 2009-06-22 10:12:28 +01:00
dm-snap-persistent.c dm snapshot: use barrier when writing exception store 2009-06-22 10:12:26 +01:00
dm-snap-transient.c dm snapshot: move status to exception store 2009-04-02 19:55:35 +01:00
dm-snap.c dm snapshot: support barriers 2009-06-22 10:12:25 +01:00
dm-stripe.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-sysfs.c dm: sysfs add suspended attribute 2009-06-22 10:12:29 +01:00
dm-table.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-target.c dm target: remove struct tt_internal 2009-04-02 19:55:28 +01:00
dm-uevent.c md: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:42 -07:00
dm-uevent.h dm: uevent generate events 2007-10-20 02:01:26 +01:00
dm-zero.c dm: consolidate target deregistration error handling 2009-01-06 03:04:58 +00:00
dm.c dm: remove queue next_ordered workaround for barriers 2009-07-23 20:30:40 +01:00
dm.h dm: remove queue next_ordered workaround for barriers 2009-07-23 20:30:40 +01:00
faulty.c md: Move check for bitmap presence to personality code. 2009-06-18 08:49:23 +10:00
Kconfig dm raid1: add userspace log 2009-06-22 10:12:35 +01:00
linear.c md: Use revalidate_disk to effect changes in size of device. 2009-08-03 10:59:58 +10:00
linear.h md/linear: use call_rcu to free obsolete 'conf' structures. 2009-06-18 08:49:42 +10:00
Makefile dm raid1: add userspace log 2009-06-22 10:12:35 +01:00
md.c Remove deadlock potential in md_open 2009-08-10 12:50:52 +10:00
md.h Remove deadlock potential in md_open 2009-08-10 12:50:52 +10:00
mktables.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
multipath.c md: Push down data integrity code to personalities. 2009-08-03 10:59:47 +10:00
multipath.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid0.c md: Push down data integrity code to personalities. 2009-08-03 10:59:47 +10:00
raid0.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid1.c md: Use revalidate_disk to effect changes in size of device. 2009-08-03 10:59:58 +10:00
raid1.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid5.c md: Use revalidate_disk to effect changes in size of device. 2009-08-03 10:59:58 +10:00
raid5.h md: convert conf->chunk_size and conf->prev_chunk to sectors. 2009-06-18 08:45:55 +10:00
raid6algos.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6altivec.uc md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6int.uc md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6mmx.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6recov.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6sse1.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6sse2.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6x86.h md: fix typo in FSF address 2009-03-31 14:57:37 +11:00
raid10.c md: Push down data integrity code to personalities. 2009-08-03 10:59:47 +10:00
raid10.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
unroll.pl