mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 06/10] mtip32xx: Fix for rmmod crash when drive is in FTL rebuild
@ 2016-02-23  5:01 Asai Thambi SP
  0 siblings, 0 replies; only message in thread
From: Asai Thambi SP @ 2016-02-23  5:01 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-kernel, Sam Bradshaw, Selvan Mani, Rajesh Kumar Sambandam,
	Vignesh Gunasekaran

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: Selvan Mani <smani@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
---
 drivers/block/mtip32xx/mtip32xx.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index ba832a8..7ad3b90 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3037,10 +3037,8 @@ restart_eh:
         }
 
         if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) {
-            if (mtip_ftl_rebuild_poll(dd) < 0)
-                set_bit(MTIP_DDF_REBUILD_FAILED_BIT,
-                            &dd->dd_flag);
-            clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
+            if (mtip_ftl_rebuild_poll(dd) == 0)
+                clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
         }
     }
 
@@ -3920,7 +3918,6 @@ static int mtip_block_initialize(struct driver_data *dd)
 
     mtip_hw_debugfs_init(dd);
 
-skip_create_disk:
     memset(&dd->tags, 0, sizeof(dd->tags));
     dd->tags.ops = &mtip_mq_ops;
     dd->tags.nr_hw_queues = 1;
@@ -3950,6 +3947,7 @@ skip_create_disk:
     dd->disk->queue        = dd->queue;
     dd->queue->queuedata    = dd;
 
+skip_create_disk:
     /* Initialize the protocol layer. */
     wait_for_rebuild = mtip_hw_get_identify(dd);
     if (wait_for_rebuild < 0) {
@@ -4112,7 +4110,8 @@ static int mtip_block_remove(struct driver_data *dd)
         dd->bdev = NULL;
     }
     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) {
             blk_cleanup_queue(dd->queue);
             blk_mq_free_tag_set(&dd->tags);
@@ -4153,7 +4152,8 @@ static int mtip_block_shutdown(struct driver_data *dd)
         dev_info(&dd->pdev->dev,
             "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) {
             blk_cleanup_queue(dd->queue);
             blk_mq_free_tag_set(&dd->tags);
-- 
1.7.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-23  5:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23  5:01 [PATCH 06/10] mtip32xx: Fix for rmmod crash when drive is in FTL rebuild Asai Thambi SP

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome