From: Bart Van Assche Date: Wed, 28 Feb 2018 18:15:29 +0000 (-0800) Subject: md: Delete gendisk before cleaning up the request queue X-Git-Tag: v5.15~9111^2~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8115c35bf3ee575cfc9c51ac9853f58a21a43dc;p=platform%2Fkernel%2Flinux-starfive.git 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 Reviewed-by: Johannes Thumshirn Reviewed-by: Joseph Qi Reviewed-by: Ming Lei Cc: Shaohua Li Signed-off-by: Jens Axboe --- diff --git a/drivers/md/md.c b/drivers/md/md.c index bc67ab6..eba7fa2 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);