diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4495104f6c9f..a307f87eb90e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -214,12 +214,7 @@ static inline mddev_t *mddev_get(mddev_t *mddev) | |||
214 | return mddev; | 214 | return mddev; |
215 | } | 215 | } |
216 | 216 | ||
217 | static void mddev_delayed_delete(struct work_struct *ws) | 217 | static void mddev_delayed_delete(struct work_struct *ws); |
218 | { | ||
219 | mddev_t *mddev = container_of(ws, mddev_t, del_work); | ||
220 | kobject_del(&mddev->kobj); | ||
221 | kobject_put(&mddev->kobj); | ||
222 | } | ||
223 | 218 | ||
224 | static void mddev_put(mddev_t *mddev) | 219 | static void mddev_put(mddev_t *mddev) |
225 | { | 220 | { |
@@ -474,7 +469,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | |||
474 | * causes ENOTSUPP, we allocate a spare bio... | 469 | * causes ENOTSUPP, we allocate a spare bio... |
475 | */ | 470 | */ |
476 | struct bio *bio = bio_alloc(GFP_NOIO, 1); | 471 | struct bio *bio = bio_alloc(GFP_NOIO, 1); |
477 | int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); | 472 | int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG); |
478 | 473 | ||
479 | bio->bi_bdev = rdev->bdev; | 474 | bio->bi_bdev = rdev->bdev; |
480 | bio->bi_sector = sector; | 475 | bio->bi_sector = sector; |
@@ -531,7 +526,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size, | |||
531 | struct completion event; | 526 | struct completion event; |
532 | int ret; | 527 | int ret; |
533 | 528 | ||
534 | rw |= (1 << BIO_RW_SYNC); | 529 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
535 | 530 | ||
536 | bio->bi_bdev = bdev; | 531 | bio->bi_bdev = bdev; |
537 | bio->bi_sector = sector; | 532 | bio->bi_sector = sector; |
@@ -3542,6 +3537,21 @@ static struct kobj_type md_ktype = { | |||
3542 | 3537 | ||
3543 | int mdp_major = 0; | 3538 | int mdp_major = 0; |
3544 | 3539 | ||
3540 | static void mddev_delayed_delete(struct work_struct *ws) | ||
3541 | { | ||
3542 | mddev_t *mddev = container_of(ws, mddev_t, del_work); | ||
3543 | |||
3544 | if (mddev->private == &md_redundancy_group) { | ||
3545 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); | ||
3546 | if (mddev->sysfs_action) | ||
3547 | sysfs_put(mddev->sysfs_action); | ||
3548 | mddev->sysfs_action = NULL; | ||
3549 | mddev->private = NULL; | ||
3550 | } | ||
3551 | kobject_del(&mddev->kobj); | ||
3552 | kobject_put(&mddev->kobj); | ||
3553 | } | ||
3554 | |||
3545 | static int md_alloc(dev_t dev, char *name) | 3555 | static int md_alloc(dev_t dev, char *name) |
3546 | { | 3556 | { |
3547 | static DEFINE_MUTEX(disks_mutex); | 3557 | static DEFINE_MUTEX(disks_mutex); |
@@ -4033,13 +4043,9 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4033 | mddev->queue->merge_bvec_fn = NULL; | 4043 | mddev->queue->merge_bvec_fn = NULL; |
4034 | mddev->queue->unplug_fn = NULL; | 4044 | mddev->queue->unplug_fn = NULL; |
4035 | mddev->queue->backing_dev_info.congested_fn = NULL; | 4045 | mddev->queue->backing_dev_info.congested_fn = NULL; |
4036 | if (mddev->pers->sync_request) { | ||
4037 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); | ||
4038 | if (mddev->sysfs_action) | ||
4039 | sysfs_put(mddev->sysfs_action); | ||
4040 | mddev->sysfs_action = NULL; | ||
4041 | } | ||
4042 | module_put(mddev->pers->owner); | 4046 | module_put(mddev->pers->owner); |
4047 | if (mddev->pers->sync_request) | ||
4048 | mddev->private = &md_redundancy_group; | ||
4043 | mddev->pers = NULL; | 4049 | mddev->pers = NULL; |
4044 | /* tell userspace to handle 'inactive' */ | 4050 | /* tell userspace to handle 'inactive' */ |
4045 | sysfs_notify_dirent(mddev->sysfs_state); | 4051 | sysfs_notify_dirent(mddev->sysfs_state); |