Re: [PATCH v2] scsi: Avoid that .queuecommand() gets called for a quiesced SCSI device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

James




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux