scsi: core: Handle depopulation and restoration in progress
authorDouglas Gilbert <dgilbert@interlog.com>
Sun, 15 Oct 2023 05:06:50 +0000 (01:06 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 17 Oct 2023 01:02:23 +0000 (21:02 -0400)
The default handling of the NOT READY sense key is to wait for the device
to become ready. The "wait" is assumed to be relatively short. However
there is a sub-class of NOT READY that have the "... in progress" phrase in
their additional sense code and these can take much longer.  Following on
from commit 505aa4b6a883 ("scsi: sd: Defer spinning up drive while SANITIZE
is in progress") we now have element depopulation and restoration that can
take a long time.  For example, over 24 hours for a 20 TB, 7200 rpm hard
disk to depopulate 1 of its 20 elements.

Add handling of ASC/ASCQ: 0x4,0x24 (depopulation in progress)
and ASC/ASCQ: 0x4,0x25 (depopulation restoration in progress)
to sd.c . The scsi_lib.c has incomplete handling of these
two messages, so complete it.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20231015050650.131145-1-dgilbert@interlog.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c

index 195ca80667d06131b2d8f0dd2cec060217549bba..aca57c3ab626e441d0ca622a6b3baff01fbda2bd 100644 (file)
@@ -774,6 +774,7 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
                                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 */
index ce091ffcf3de2b37960441b3d89a50dcdb70794b..864db30b9c8e1465dddc9ca0464121dac0833a6f 100644 (file)
@@ -2227,6 +2227,10 @@ sd_spinup_disk(struct scsi_disk *sdkp)
                                break;  /* unavailable */
                        if (sshdr.asc == 4 && sshdr.ascq == 0x1b)
                                break;  /* sanitize in progress */
+                       if (sshdr.asc == 4 && sshdr.ascq == 0x24)
+                               break;  /* depopulation in progress */
+                       if (sshdr.asc == 4 && sshdr.ascq == 0x25)
+                               break;  /* depopulation restoration in progress */
                        /*
                         * Issue command to spin up drive when not ready
                         */