aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index da838cc32cc9..970a8c42ba92 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -221,12 +221,6 @@ static void mddev_put(mddev_t *mddev)
221 if (!mddev->raid_disks && list_empty(&mddev->disks)) { 221 if (!mddev->raid_disks && list_empty(&mddev->disks)) {
222 list_del(&mddev->all_mddevs); 222 list_del(&mddev->all_mddevs);
223 spin_unlock(&all_mddevs_lock); 223 spin_unlock(&all_mddevs_lock);
224 if (mddev->queue)
225 blk_cleanup_queue(mddev->queue);
226 mddev->queue = NULL;
227 if (mddev->sysfs_state)
228 sysfs_put(mddev->sysfs_state);
229 mddev->sysfs_state = NULL;
230 kobject_put(&mddev->kobj); 224 kobject_put(&mddev->kobj);
231 } else 225 } else
232 spin_unlock(&all_mddevs_lock); 226 spin_unlock(&all_mddevs_lock);
@@ -3451,6 +3445,17 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
3451static void md_free(struct kobject *ko) 3445static void md_free(struct kobject *ko)
3452{ 3446{
3453 mddev_t *mddev = container_of(ko, mddev_t, kobj); 3447 mddev_t *mddev = container_of(ko, mddev_t, kobj);
3448
3449 if (mddev->sysfs_state)
3450 sysfs_put(mddev->sysfs_state);
3451
3452 if (mddev->gendisk) {
3453 del_gendisk(mddev->gendisk);
3454 put_disk(mddev->gendisk);
3455 }
3456 if (mddev->queue)
3457 blk_cleanup_queue(mddev->queue);
3458
3454 kfree(mddev); 3459 kfree(mddev);
3455} 3460}
3456 3461
@@ -6435,9 +6440,6 @@ static __exit void md_exit(void)
6435 if (!disk) 6440 if (!disk)
6436 continue; 6441 continue;
6437 export_array(mddev); 6442 export_array(mddev);
6438 del_gendisk(disk);
6439 put_disk(disk);
6440 mddev->gendisk = NULL;
6441 mddev_put(mddev); 6443 mddev_put(mddev);
6442 } 6444 }
6443} 6445}