On Fri, 2018-03-16 at 23:10 +0000, Bart Van Assche wrote:
> On Fri, 2018-03-16 at 15:49 -0700, James Bottomley wrote:
> > 
> > In your new code you have
> > 
> > +       if (sdev->sdev_state != SDEV_QUIESCE)
> > +               rtn = shost->hostt->queuecommand(shost, scmd);
> > +       else
> > +               rtn = SCSI_MLQUEUE_DEVICE_BUSY;
> > 
> > That sets rtn instead of calling queuecommand
> > 
> > Then you drop through to this code below:
> > 
> >     if (rtn) {
> >             if (timeleft > stall_for) {
> >                     scsi_eh_restore_cmnd(scmd, &ses);
> >                     timeleft -= stall_for;
> >                     msleep(jiffies_to_msecs(stall_for));
> >                     goto retry;
> >             }
> > 
> > Which causes a msleep which is equivalent to the while loop.
> 
> Hello James,
> 
> Thanks for the clarification - apparently we were each looking at
> another part of the code.
> 
> If the "rtn = SCSI_MLQUEUE_DEVICE_BUSY" statement is executed that
> means that the if-statement that controls that statement noticed that
> sdev->sdev_state == SDEV_QUIESCE. Since the while loop above that
> statement only finishes if either sdev->sdev_state != SDEV_QUIESCE or
> timeleft <= 0, if the "rtn = SCSI_MLQUEUE_DEVICE_BUSY" statement is
> executed that implies that timeleft <= 0. Since stall_for > 0, the
> expression timeleft > stall_for will evaluate to false. In other
> words, the msleep() shown in your e-mail will be skipped.

Not if you remove the while loop from the patch which was the original
request.

James

Reply via email to