]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild
authorAsai Thambi SP <asamymuthupa@micron.com>
Thu, 25 Feb 2016 05:17:32 +0000 (21:17 -0800)
committerJens Axboe <axboe@fb.com>
Thu, 3 Mar 2016 16:08:43 +0000 (09:08 -0700)
Prevent standby immediate command from being issued in remove,
suspend and shutdown paths, while drive is in 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>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/mtip32xx/mtip32xx.c

index 9ae4cc5c61ee7de5a32adf69f90430e5e9bf69ea..573900c073b890c95c892f179d801aeaff951023 100644 (file)
@@ -3260,20 +3260,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;
 }
 
 /*
@@ -3331,8 +3336,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;
 }
@@ -3355,7 +3359,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;