Commit 15d38f73 authored by Asai Thambi SP's avatar Asai Thambi SP Committed by Sasha Levin

mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild

[ Upstream commit d8a18d2d ]

Prevent standby immediate command from being issued in remove,
suspend and shutdown paths, while drive is in FTL rebuild process.
Signed-off-by: default avatarSelvan Mani <smani@micron.com>
Signed-off-by: default avatarVignesh Gunasekaran <vgunasekaran@micron.com>
Signed-off-by: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent c9d3e69a
...@@ -3356,20 +3356,25 @@ static int mtip_hw_init(struct driver_data *dd) ...@@ -3356,20 +3356,25 @@ static int mtip_hw_init(struct driver_data *dd)
return rv; return rv;
} }
static void mtip_standby_drive(struct driver_data *dd) static int mtip_standby_drive(struct driver_data *dd)
{ {
if (dd->sr) int rv = 0;
return;
if (dd->sr || !dd->port)
return -ENODEV;
/* /*
* Send standby immediate (E0h) to the drive so that it * Send standby immediate (E0h) to the drive so that it
* saves its state. * saves its state.
*/ */
if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags) && if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags) &&
!test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag)) !test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag) &&
if (mtip_standby_immediate(dd->port)) !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag)) {
rv = mtip_standby_immediate(dd->port);
if (rv)
dev_warn(&dd->pdev->dev, dev_warn(&dd->pdev->dev,
"STANDBY IMMEDIATE failed\n"); "STANDBY IMMEDIATE failed\n");
}
return rv;
} }
/* /*
...@@ -3426,8 +3431,7 @@ static int mtip_hw_shutdown(struct driver_data *dd) ...@@ -3426,8 +3431,7 @@ static int mtip_hw_shutdown(struct driver_data *dd)
* Send standby immediate (E0h) to the drive so that it * Send standby immediate (E0h) to the drive so that it
* saves its state. * saves its state.
*/ */
if (!dd->sr && dd->port) mtip_standby_drive(dd);
mtip_standby_immediate(dd->port);
return 0; return 0;
} }
...@@ -3450,7 +3454,7 @@ static int mtip_hw_suspend(struct driver_data *dd) ...@@ -3450,7 +3454,7 @@ static int mtip_hw_suspend(struct driver_data *dd)
* Send standby immediate (E0h) to the drive * Send standby immediate (E0h) to the drive
* so that it saves its state. * so that it saves its state.
*/ */
if (mtip_standby_immediate(dd->port) != 0) { if (mtip_standby_drive(dd) != 0) {
dev_err(&dd->pdev->dev, dev_err(&dd->pdev->dev,
"Failed standby-immediate command\n"); "Failed standby-immediate command\n");
return -EFAULT; return -EFAULT;
......
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