Re: [PATCH] target: Set additional sense length field in sense data

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

 



On Wed, 2011-12-21 at 14:37 -0800, Roland Dreier wrote:
> On Wed, Dec 21, 2011 at 2:19 PM, Nicholas A. Bellinger
> <nab@xxxxxxxxxxxxxxx> wrote:
> > So we know that SBC says zero-length READs is allowed, but AFAICT there
> > is no requirement for allowing any zero-length control CDBs, aside from
> > the CDBs already designated as SCF_SCSI_NON_DATA_CDB..
> 
> Actually I think that's wrong -- my draft of SPC4 says:
> 
>     4.3.5.6 Allocation length
> 
>     ...
> 
>     An allocation length of zero specifies that no data shall be
> transferred. This
>     condition shall not be considered as an error.
> 
> and eg on a real SCSI disk I have:
> 
>     # sg_raw -v /dev/sdas 3 0 0 0 0 0
>         cdb to send: 03 00 00 00 00 00
>     SCSI Status: Good
> 
>     Sense Information:
>     sense buffer empty
> 

Sorry yes, you are indeed correct here.

> But I don't think we can just silently succeed control CDBs with allocation
> length 0, eg REQUEST SENSE will allocation length 0 still needs to clear
> unit attention conditions.  So we probably need to push the handling down
> into the emulation for each command.
> 

I'd really like to avoid pushing down the handling of this into the
emulation for each command..

So that said, I'm thinking to silently succeed on allocate length zero,
and add a special case call to core_scsi3_ua_clear_for_request_sense()
for the unit attention case..  I need to think about this a bit more and
do some testing, and will look at posting a patch soon.

> And also I think the code that  fails INQUIRY with allocation length < 6
> is wrong too -- eg if the initiator sense us an allocation length of
> 1, we should
> return good status and just send back the first byte of the inquiry data.
> But that's a secondary issue -- at least we don't crash in that case.

I'm not sure if supporting this type of scenario makes sense, as I've
never actually seen it in practice.

--nab

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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux