Re: [patch] SCSI: early detection of medium not present, updated

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

 



On Sun, 2007-12-02 at 15:02 -0500, Alan Stern wrote:
> On Sun, 2 Dec 2007, James Bottomley wrote:
> 
> > Actually, the night train is a good place to do coding.  I know this
> > compiles, but could someone check it out?  It's the form I think we
> > should do, since the ASC/ASCQ codes for esoteric conditions which we
> > might eventually check for are different for CDs and removable discs.
> 
> This part is puzzling:
> 
> > +	/* try to eat the UNIT_ATTENTION if there are enough retries */
> > +	do {
> > +		result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
> > +					  timeout, retries);
> > +	} while ((driver_byte(result) & DRIVER_SENSE) &&
> > +		 sshdr && sshdr->sense_key == UNIT_ATTENTION &&
> > +		 --retries);
> 
> For one thing, you've using retries to control both an outer loop and 
> an inner loop -- meaning the total number of attempts could be on the 
> order of retries**2.

Sort of; however, there should only really be one cc/ua before the TUR
goes through.  Also, TUR produces almost no conditions that would be
retryable in scsi_decide_disposition() and the scsi_execute sends it
down with REQ_FAILFAST anyway, so it's really not used much.

> For another, why do you want to swallow a UNIT_ATTENTION?  Shouldn't 
> that be up to the code calling scsi_test_unit_ready()?

No, that's a bug in the old code.  UA doesn't necessarily mean there's a
media change.  It could be asserted for a whole host of reasons.  Until
we get proper UA signalling, we need to resend the TUR so we get the
correct media status and discard the UA (Even if the device is asserting
UA for media change reasons, it will still give the correct sense code
response to the following TUR).

James

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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