summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-02-28 19:15:29 +0100
committerJens Axboe <axboe@kernel.dk>2018-02-28 20:23:35 +0100
commitd8115c35bf3ee575cfc9c51ac9853f58a21a43dc (patch)
tree82e68125f8a15746dd3f296fb076c8e01300d2ed /drivers/md/md.c
parentblock/loop: Delete gendisk before cleaning up the request queue (diff)
downloadlinux-d8115c35bf3ee575cfc9c51ac9853f58a21a43dc.tar.xz
linux-d8115c35bf3ee575cfc9c51ac9853f58a21a43dc.zip
md: Delete gendisk before cleaning up the request queue
Remove the disk, partition and bdi sysfs attributes before cleaning up the request queue associated with the disk. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Cc: Shaohua Li <shli@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--drivers/md/md.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index bc67ab6844f0..eba7fa2f0abb 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5203,12 +5203,12 @@ static void md_free(struct kobject *ko)
if (mddev->sysfs_state)
sysfs_put(mddev->sysfs_state);
+ if (mddev->gendisk)
+ del_gendisk(mddev->gendisk);
if (mddev->queue)
blk_cleanup_queue(mddev->queue);
- if (mddev->gendisk) {
- del_gendisk(mddev->gendisk);
+ if (mddev->gendisk)
put_disk(mddev->gendisk);
- }
percpu_ref_exit(&mddev->writes_pending);
kfree(mddev);