aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2be574c0a27a..ed5727c089a9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -269,12 +269,7 @@ static inline mddev_t *mddev_get(mddev_t *mddev)
269 return mddev; 269 return mddev;
270} 270}
271 271
272static void mddev_delayed_delete(struct work_struct *ws) 272static void mddev_delayed_delete(struct work_struct *ws);
273{
274 mddev_t *mddev = container_of(ws, mddev_t, del_work);
275 kobject_del(&mddev->kobj);
276 kobject_put(&mddev->kobj);
277}
278 273
279static void mddev_put(mddev_t *mddev) 274static void mddev_put(mddev_t *mddev)
280{ 275{
@@ -3811,6 +3806,21 @@ static struct kobj_type md_ktype = {
3811 3806
3812int mdp_major = 0; 3807int mdp_major = 0;
3813 3808
3809static void mddev_delayed_delete(struct work_struct *ws)
3810{
3811 mddev_t *mddev = container_of(ws, mddev_t, del_work);
3812
3813 if (mddev->private == &md_redundancy_group) {
3814 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3815 if (mddev->sysfs_action)
3816 sysfs_put(mddev->sysfs_action);
3817 mddev->sysfs_action = NULL;
3818 mddev->private = NULL;
3819 }
3820 kobject_del(&mddev->kobj);
3821 kobject_put(&mddev->kobj);
3822}
3823
3814static int md_alloc(dev_t dev, char *name) 3824static int md_alloc(dev_t dev, char *name)
3815{ 3825{
3816 static DEFINE_MUTEX(disks_mutex); 3826 static DEFINE_MUTEX(disks_mutex);
@@ -4313,13 +4323,9 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4313 mddev->queue->merge_bvec_fn = NULL; 4323 mddev->queue->merge_bvec_fn = NULL;
4314 mddev->queue->unplug_fn = NULL; 4324 mddev->queue->unplug_fn = NULL;
4315 mddev->queue->backing_dev_info.congested_fn = NULL; 4325 mddev->queue->backing_dev_info.congested_fn = NULL;
4316 if (mddev->pers->sync_request) {
4317 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
4318 if (mddev->sysfs_action)
4319 sysfs_put(mddev->sysfs_action);
4320 mddev->sysfs_action = NULL;
4321 }
4322 module_put(mddev->pers->owner); 4326 module_put(mddev->pers->owner);
4327 if (mddev->pers->sync_request)
4328 mddev->private = &md_redundancy_group;
4323 mddev->pers = NULL; 4329 mddev->pers = NULL;
4324 /* tell userspace to handle 'inactive' */ 4330 /* tell userspace to handle 'inactive' */
4325 sysfs_notify_dirent(mddev->sysfs_state); 4331 sysfs_notify_dirent(mddev->sysfs_state);