Re: [PATCH] scsi: Fix scsi_get/set_resid() interface

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

 



On 10/30/19 1:30 AM, Hannes Reinecke wrote:
On 10/28/19 9:38 PM, Bart Van Assche wrote:
If the residual is changed from signed into unsigned, how is a SCSI LLD expected to report the difference between residual overflow and residual underflow to the SCSI core?

You don't have to. To quote RFC 3720 page 122:

      bit 5 - (O) set for Residual Overflow.  In this case, the Residual
        Count indicates the number of bytes that were not transferred
        because the initiator's Expected Data Transfer Length was not
        sufficient.  For a bidirectional operation, the Residual Count
        contains the residual for the write operation.

IE the 'overflow' setting in the iSCSI command response is an indicator that there _would_ be more data if the command request _would_ have specified a larger buffer. But as it didn't, the entire buffer was filled, and the overflow counter is set. Which, of course, is then ignored by the linux SCSI stack as the request got all data, and the residual is set to zero. Then it's left to the caller to re-send with a larger buffer if required. But it's nothing the SCSI stack can nor should be attempting on its own.

Hi Hannes,

I do not agree that reporting a residual overflow by calling scsi_set_resid(..., 0) is acceptable. For reads a residual overflow means that the length specified in the CDB (scsi_bufflen()) exceeds the data buffer size (length of scsi_sglist()). I think it's dangerous to report to the block layer that such requests completed successfully and with residual zero.

Bart.



[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