On Fri, 2018-03-16 at 15:31 -0700, James Bottomley wrote:
> On Fri, 2018-03-16 at 22:21 +0000, Bart Van Assche wrote:
> > On Fri, 2018-03-16 at 15:00 -0700, James Bottomley wrote:
> > > 
> > > On Fri, 2018-03-16 at 10:40 -0700, Bart Van Assche wrote:
> > > > 
> > > > @@ -1050,7 +1050,22 @@ static int scsi_send_eh_cmnd(struct
> > > > scsi_cmnd
> > > > *scmd, unsigned char *cmnd,
> > > >  
> > > >         scsi_log_send(scmd);
> > > >         scmd->scsi_done = scsi_eh_done;
> > > > -       rtn = shost->hostt->queuecommand(shost, scmd);
> > > > +       mutex_lock(&sdev->state_mutex);
> > > > +       while (sdev->sdev_state == SDEV_QUIESCE && timeleft > 0)
> > > > {
> > > > +               mutex_unlock(&sdev->state_mutex);
> > > > +               SCSI_LOG_ERROR_RECOVERY(5,
> > > > sdev_printk(KERN_DEBUG,
> > > > sdev,
> > > > +                       "%s: state %d <> %d\n", __func__, sdev-
> > > > > 
> > > > > sdev_state,
> > > > 
> > > > +                       SDEV_QUIESCE));
> > > > +               delay = min(timeleft, stall_for);
> > > > +               timeleft -= delay;
> > > > +               msleep(jiffies_to_msecs(delay));
> > > > +               mutex_lock(&sdev->state_mutex);
> > > > +       }
> > > 
> > > What's the point of this loop?  if you eliminate it, you still get
> > > exactly the same msleep from the stall_for retry processing.
> > 
> > Hello James,
> > 
> > The purpose of that loop is to check the SCSI device state every
> > "stall_for" jiffies and to avoid that more than "timeleft" jiffies is
> > spent on waiting.
> 
> I know what the loop does; the the question I was asking is doesn't
> setting rtn instead of calling ->queuecommand() achieve the same thing?

Sorry but I don't understand that last question. How could setting rtn be
an alternative for calling ->queuecommand() since we really want to call
->queuecommand if the SCSI device leaves the quiesced state before the
timeout has expired? Can you rephrase that last question?

Thanks,

Bart.


Reply via email to