Commit 2f28fb91 authored by Asai Thambi SP's avatar Asai Thambi SP Committed by Kamal Mostafa

mtip32xx: Fix for rmmod crash when drive is in FTL rebuild

commit 59cf70e2 upstream.

When FTL rebuild is in progress, alloc_disk() initializes the disk
but device node will be created by add_disk() only after successful
completion of FTL rebuild. So, skip deletion of device node in
removal path when FTL rebuild is in progress.
Signed-off-by: default avatarSelvan Mani <smani@micron.com>
Signed-off-by: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 653902bb
...@@ -2975,10 +2975,8 @@ static int mtip_service_thread(void *data) ...@@ -2975,10 +2975,8 @@ static int mtip_service_thread(void *data)
} }
if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) { if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) {
if (mtip_ftl_rebuild_poll(dd) < 0) if (mtip_ftl_rebuild_poll(dd) == 0)
set_bit(MTIP_DDF_REBUILD_FAILED_BIT, clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
&dd->dd_flag);
clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
} }
} }
...@@ -3859,7 +3857,6 @@ static int mtip_block_initialize(struct driver_data *dd) ...@@ -3859,7 +3857,6 @@ static int mtip_block_initialize(struct driver_data *dd)
mtip_hw_debugfs_init(dd); mtip_hw_debugfs_init(dd);
skip_create_disk:
memset(&dd->tags, 0, sizeof(dd->tags)); memset(&dd->tags, 0, sizeof(dd->tags));
dd->tags.ops = &mtip_mq_ops; dd->tags.ops = &mtip_mq_ops;
dd->tags.nr_hw_queues = 1; dd->tags.nr_hw_queues = 1;
...@@ -3889,6 +3886,7 @@ static int mtip_block_initialize(struct driver_data *dd) ...@@ -3889,6 +3886,7 @@ static int mtip_block_initialize(struct driver_data *dd)
dd->disk->queue = dd->queue; dd->disk->queue = dd->queue;
dd->queue->queuedata = dd; dd->queue->queuedata = dd;
skip_create_disk:
/* Initialize the protocol layer. */ /* Initialize the protocol layer. */
wait_for_rebuild = mtip_hw_get_identify(dd); wait_for_rebuild = mtip_hw_get_identify(dd);
if (wait_for_rebuild < 0) { if (wait_for_rebuild < 0) {
...@@ -4050,7 +4048,8 @@ static int mtip_block_remove(struct driver_data *dd) ...@@ -4050,7 +4048,8 @@ static int mtip_block_remove(struct driver_data *dd)
dd->bdev = NULL; dd->bdev = NULL;
} }
if (dd->disk) { if (dd->disk) {
del_gendisk(dd->disk); if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag))
del_gendisk(dd->disk);
if (dd->disk->queue) { if (dd->disk->queue) {
blk_cleanup_queue(dd->queue); blk_cleanup_queue(dd->queue);
blk_mq_free_tag_set(&dd->tags); blk_mq_free_tag_set(&dd->tags);
...@@ -4091,7 +4090,8 @@ static int mtip_block_shutdown(struct driver_data *dd) ...@@ -4091,7 +4090,8 @@ static int mtip_block_shutdown(struct driver_data *dd)
dev_info(&dd->pdev->dev, dev_info(&dd->pdev->dev,
"Shutting down %s ...\n", dd->disk->disk_name); "Shutting down %s ...\n", dd->disk->disk_name);
del_gendisk(dd->disk); if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag))
del_gendisk(dd->disk);
if (dd->disk->queue) { if (dd->disk->queue) {
blk_cleanup_queue(dd->queue); blk_cleanup_queue(dd->queue);
blk_mq_free_tag_set(&dd->tags); blk_mq_free_tag_set(&dd->tags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment