diff mbox series

scsi_lib: allow the ALUA transitioning state time to complete

Message ID CAHZQxyKMcCaquQ9n8pJ9tNb3HRZ2e14iXXojYS3C4=dB6NpUKQ@mail.gmail.com
State New
Headers show
Series scsi_lib: allow the ALUA transitioning state time to complete | expand

Commit Message

Brian Bunker June 2, 2022, 3:10 p.m. UTC
Don't fail the path in ALUA transition state

The error path for the SCSI check condition of not ready, target in
ALUA state transition, will result in the failure of that path after
the retries are exhausted. In most cases that is well ahead of the
transition timeout established in the SCSI ALUA device handler.

Instead, reprep the command and re-add it to the queue after a 1 second
delay. This will allow the handler to take care of the timeout and
only fail the path in the transition state if the target has exceeded
the transition timeout (default 60 seconds).

Acked-by: Krishna Kant <krishna.kant@purestorage.com>
Acked-by: Seamus Connor <sconnor@purestorage.com>
Signed-off-by: Brian Bunker <brian@purestorage.com>

Comments

Christoph Hellwig June 2, 2022, 3:12 p.m. UTC | #1
On Thu, Jun 02, 2022 at 08:10:28AM -0700, Brian Bunker wrote:
>  static void scsi_io_completion_reprep(struct scsi_cmnd *cmd,
> -                                     struct request_queue *q)
> +                                     struct request_queue *q,
> unsigned long msecs)
>  {
>         /* A new command will be prepared and issued. */
> -       scsi_mq_requeue_cmd(cmd);
> +       scsi_mq_requeue_cmd(cmd, msecs);

q is unused.  But I think it is better if we just kill this pointless
wrapper anyway.

> +       case ACTION_DELAYED_REPREP:
> +               scsi_io_completion_reprep(cmd, q, ALUA_TRANSITION_REPREP_DELAY);

This is using spaces where it should use tabs.
Christoph Hellwig June 3, 2022, 5:54 a.m. UTC | #2
On Thu, Jun 02, 2022 at 12:00:30PM -0700, Brian Bunker wrote:
> > > +       case ACTION_DELAYED_REPREP:
> > > +               scsi_io_completion_reprep(cmd, q, ALUA_TRANSITION_REPREP_DELAY);
> >
> > This is using spaces where it should use tabs.
> >
> 
> Like this then:

Looks your mailer actually converted all tabs to spaces..
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e9db7da0c79c..2a75f740914c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -118,7 +118,7 @@  scsi_set_blocked(struct scsi_cmnd *cmd, int reason)
        }
 }

-static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
+static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd, unsigned long msecs)
 {
        struct request *rq = scsi_cmd_to_rq(cmd);

@@ -128,7 +128,12 @@  static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
        } else {
                WARN_ON_ONCE(true);
        }
-       blk_mq_requeue_request(rq, true);
+
+       if (msecs) {
+               blk_mq_requeue_request(rq, false);
+               blk_mq_delay_kick_requeue_list(rq->q, msecs);
+       } else
+               blk_mq_requeue_request(rq, true);
 }

 /**
@@ -660,10 +665,10 @@  static unsigned int scsi_rq_err_bytes(const
struct request *rq)

 /* Helper for scsi_io_completion() when "reprep" action required. */
 static void scsi_io_completion_reprep(struct scsi_cmnd *cmd,
-                                     struct request_queue *q)
+                                     struct request_queue *q,
unsigned long msecs)
 {
        /* A new command will be prepared and issued. */
-       scsi_mq_requeue_cmd(cmd);
+       scsi_mq_requeue_cmd(cmd, msecs);
 }