linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 05/10] mtip32xx: Avoid issuing standby immediate cmd during 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


Prevent standby immediate command from being issued in remove,
suspend and shutdown paths, while drive is performing FTL rebuild
process.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Vignesh Gunasekaran <vgunasekaran@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
---
 drivers/block/mtip32xx/mtip32xx.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index ca9d35a..ba832a8 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3329,20 +3329,25 @@ out1:
     return rv;
 }
 
-static void mtip_standby_drive(struct driver_data *dd)
+static int mtip_standby_drive(struct driver_data *dd)
 {
-    if (dd->sr)
-        return;
+    int rv = 0;
 
+    if (dd->sr || !dd->port)
+        return -ENODEV;
     /*
      * Send standby immediate (E0h) to the drive so that it
      * saves its state.
      */
     if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags) &&
-        !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))
-        if (mtip_standby_immediate(dd->port))
+        !test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag) &&
+        !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag)) {
+        rv = mtip_standby_immediate(dd->port);
+        if (rv)
             dev_warn(&dd->pdev->dev,
                 "STANDBY IMMEDIATE failed\n");
+    }
+    return rv;
 }
 
 /*
@@ -3400,8 +3405,7 @@ static int mtip_hw_shutdown(struct driver_data *dd)
      * Send standby immediate (E0h) to the drive so that it
      * saves its state.
      */
-    if (!dd->sr && dd->port)
-        mtip_standby_immediate(dd->port);
+    mtip_standby_drive(dd);
 
     return 0;
 }
@@ -3424,7 +3428,7 @@ static int mtip_hw_suspend(struct driver_data *dd)
      * Send standby immediate (E0h) to the drive
      * so that it saves its state.
      */
-    if (mtip_standby_immediate(dd->port) != 0) {
+    if (mtip_standby_drive(dd) != 0) {
         dev_err(&dd->pdev->dev,
             "Failed standby-immediate command\n");
         return -EFAULT;
-- 
1.7.1

^ permalink raw reply related	[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 05/10] mtip32xx: Avoid issuing standby immediate cmd during 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;
as well as URLs for NNTP newsgroup(s).