diff mbox series

scsi: core: Do not retry I/Os during depopulation

Message ID 20250130222632.1462218-1-ipylypiv@google.com (mailing list archive)
State New
Headers show
Series scsi: core: Do not retry I/Os during depopulation | expand

Commit Message

Igor Pylypiv Jan. 30, 2025, 10:26 p.m. UTC
Fail I/Os instead of retry to prevent user space processes from being
blocked on the I/O completion for several minutes.

Retrying I/Os during "depopulation in progress" or "depopulation restore
in progress" results in a continuous retry loop until the depopulation
completes or until the I/O retry loop is aborted due to a timeout by
the scsi_cmd_runtime_exceeced().

Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs.
Most I/Os in the depopulation retry loop end up taking several minutes
before returning the failure to user space.

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/scsi_lib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Jan. 30, 2025, 10:36 p.m. UTC | #1
On 1/30/25 2:26 PM, Igor Pylypiv wrote:
> Fail I/Os instead of retry to prevent user space processes from being
> blocked on the I/O completion for several minutes.
> 
> Retrying I/Os during "depopulation in progress" or "depopulation restore
> in progress" results in a continuous retry loop until the depopulation
> completes or until the I/O retry loop is aborted due to a timeout by
> the scsi_cmd_runtime_exceeced().
> 
> Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs.
> Most I/Os in the depopulation retry loop end up taking several minutes
> before returning the failure to user space.

Since this patch is a bug fix, please add Fixes: and Cc: stable tags.

Thanks,

Bart.
Igor Pylypiv Jan. 30, 2025, 11:49 p.m. UTC | #2
On Thu, Jan 30, 2025 at 02:36:35PM -0800, Bart Van Assche wrote:
> On 1/30/25 2:26 PM, Igor Pylypiv wrote:
> > Fail I/Os instead of retry to prevent user space processes from being
> > blocked on the I/O completion for several minutes.
> > 
> > Retrying I/Os during "depopulation in progress" or "depopulation restore
> > in progress" results in a continuous retry loop until the depopulation
> > completes or until the I/O retry loop is aborted due to a timeout by
> > the scsi_cmd_runtime_exceeced().
> > 
> > Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs.
> > Most I/Os in the depopulation retry loop end up taking several minutes
> > before returning the failure to user space.
> 
> Since this patch is a bug fix, please add Fixes: and Cc: stable tags.

Thank you, Bart. I'll add the following tags to v2:

    Cc: <stable@vger.kernel.org> # 4.18.x: 2bbeb8d scsi: core: Handle depopulation and restoration in progress"
    Cc: <stable@vger.kernel.org> # 4.18.x
    Fixes: e37c7d9a0341 ("scsi: core: sanitize++ in progress")

Thanks,
Igor

> 
> Thanks,
> 
> Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e7ea1f04164a..3ab4c958da45 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -872,13 +872,18 @@  static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
 				case 0x1a: /* start stop unit in progress */
 				case 0x1b: /* sanitize in progress */
 				case 0x1d: /* configuration in progress */
-				case 0x24: /* depopulation in progress */
-				case 0x25: /* depopulation restore in progress */
 					action = ACTION_DELAYED_RETRY;
 					break;
 				case 0x0a: /* ALUA state transition */
 					action = ACTION_DELAYED_REPREP;
 					break;
+				/*
+				 * Depopulation might take many hours,
+				 * thus it is not worthwhile to retry.
+				 */
+				case 0x24: /* depopulation in progress */
+				case 0x25: /* depopulation restore in progress */
+					fallthrough;
 				default:
 					action = ACTION_FAIL;
 					break;