linux/drivers/md
NeilBrown af8a24347f md: take a reference to mddev during sysfs access.
When we are accessing an mddev via sysfs we know that the
mddev cannot disappear because it has an embedded kobj which
is refcounted by sysfs.
And we also take the mddev_lock.
However this is not enough.

The final mddev_put could have been called and the
mddev_delayed_delete is waiting for sysfs to let go so it can destroy
the kobj and mddev.
In this state there are a lot of changes that should not be attempted.

To to guard against this we:
 - initialise mddev->all_mddevs in on last put so the state can be
   easily detected.
 - in md_attr_show and md_attr_store, check ->all_mddevs under
   all_mddevs_lock and mddev_get the mddev if it still appears to
   be active.

This means that if we get to sysfs as the mddev is being deleted we
will get -EBUSY.

rdev_attr_store and rdev_attr_show are similar but already have
sufficient protection.  They check that rdev->mddev still points to
mddev after taking mddev_lock.  As this is cleared  before delayed
removal which can only be requested under the mddev_lock, this
ensure the rdev and mddev are still alive.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-12-08 15:49:46 +11:00
..
persistent-data device-mapper: using EXPORT_SYBOL in dm-space-map-checker.c needs export.h 2011-11-07 10:29:10 -08:00
bitmap.c md/lock: ensure updates to page_attrs are properly locked. 2011-11-23 10:18:52 +11:00
bitmap.h md: remove typedefs: mddev_t -> struct mddev 2011-10-11 16:47:53 +11:00
dm-bio-record.h
dm-bufio.c device-mapper: dm-bufio.c needs to include module.h 2011-11-07 10:29:10 -08:00
dm-bufio.h dm: add bufio 2011-10-31 20:19:09 +00:00
dm-crypt.c dm crypt: always disable discard_zeroes_data 2011-09-25 23:26:21 +01:00
dm-delay.c
dm-exception-store.c md: Add module.h to all files using it implicitly 2011-10-31 19:31:18 -04:00
dm-exception-store.h
dm-flakey.c dm: flakey fix corrupt_bio_byte error path 2011-09-25 23:26:15 +01:00
dm-io.c dm io: flush cpu cache with vmapped io 2011-08-02 12:32:01 +01:00
dm-ioctl.c dm table: add immutable feature 2011-10-31 20:19:04 +00:00
dm-kcopyd.c dm kcopyd: add dm_kcopyd_zero to zero an area 2011-10-31 20:18:58 +00:00
dm-linear.c
dm-log-userspace-base.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
dm-log-userspace-transfer.c netlink: kill eff_cap from struct netlink_skb_parms 2011-03-03 13:32:07 -08:00
dm-log-userspace-transfer.h
dm-log.c dm: use vzalloc 2011-08-02 12:32:02 +01:00
dm-mpath.c dm table: share target argument parsing functions 2011-08-02 12:32:04 +01:00
dm-mpath.h
dm-path-selector.c md: Add module.h to all files using it implicitly 2011-10-31 19:31:18 -04:00
dm-path-selector.h
dm-queue-length.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
dm-raid.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
dm-raid1.c dm kcopyd: return client directly and not through a pointer 2011-05-29 13:03:13 +01:00
dm-region-hash.c Fix common misspellings 2011-03-31 11:26:23 -03:00
dm-round-robin.c md: Add module.h to all files using it implicitly 2011-10-31 19:31:18 -04:00
dm-service-time.c md: Add module.h to all files using it implicitly 2011-10-31 19:31:18 -04:00
dm-snap-persistent.c md: Add in export.h for files using EXPORT_SYMBOL 2011-10-31 19:31:19 -04:00
dm-snap-transient.c md: Add in export.h for files using EXPORT_SYMBOL 2011-10-31 19:31:19 -04:00
dm-snap.c dm snapshot: skip reading origin when overwriting complete chunk 2011-08-02 12:32:04 +01:00
dm-stripe.c dm stripe: implement merge method 2011-03-24 13:54:35 +00:00
dm-sysfs.c
dm-table.c dm table: add immutable feature 2011-10-31 20:19:04 +00:00
dm-target.c
dm-thin-metadata.c dm: add thin provisioning target 2011-10-31 20:21:18 +00:00
dm-thin-metadata.h dm: add thin provisioning target 2011-10-31 20:21:18 +00:00
dm-thin.c dm: add thin provisioning target 2011-10-31 20:21:18 +00:00
dm-uevent.c md: Add in export.h for files using EXPORT_SYMBOL 2011-10-31 19:31:19 -04:00
dm-uevent.h
dm-zero.c
dm.c Merge branch 'for-3.2/core' of git://git.kernel.dk/linux-block 2011-11-04 17:06:58 -07:00
dm.h dm table: add immutable feature 2011-10-31 20:19:04 +00:00
faulty.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
Kconfig dm: add thin provisioning target 2011-10-31 20:21:18 +00:00
linear.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
linear.h md/linear: typedef removal: linear_conf_t -> struct linear_conf 2011-10-11 16:48:54 +11:00
Makefile dm: add thin provisioning target 2011-10-31 20:21:18 +00:00
md.c md: take a reference to mddev during sysfs access. 2011-12-08 15:49:46 +11:00
md.h Merge branch 'for-3.2/core' of git://git.kernel.dk/linux-block 2011-11-04 17:06:58 -07:00
multipath.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
multipath.h md/multipath: typedef removal: multipath_conf_t -> struct mpconf 2011-10-11 16:48:57 +11:00
raid1.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
raid1.h md: add proper write-congestion reporting to RAID1 and RAID10. 2011-10-11 16:50:01 +11:00
raid5.c md/raid5: STRIPE_ACTIVE has lock semantics, add barriers 2011-11-08 16:22:06 +11:00
raid5.h md/raid5: typedef removal: raid5_conf_t -> struct r5conf 2011-10-11 16:49:52 +11:00
raid10.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
raid10.h md: add proper write-congestion reporting to RAID1 and RAID10. 2011-10-11 16:50:01 +11:00
raid0.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
raid0.h md/raid0: typedef removal: raid0_conf_t -> struct r0conf 2011-10-11 16:48:59 +11:00