On 6/19/22 1:22 AM, Christoph Hellwig wrote: > On Thu, Jun 16, 2022 at 10:04:36PM -0500, Mike Christie wrote: >> If the WRITE_SAME NDOB bit is set then there is not going to be a >> buffer. LIO core will then complain: >> >> TARGET_CORE[iSCSI]: Expected Transfer Length: 0 does not match SCSI CDB >> Length: 512 for SAM Opcode: 0x93 >> >> This fixes the issue by detecting when the bit is set and adjusting the >> size. > > > The patch looks good and useful, but right the taret code doesn't even > support MI_REPORT_SUPPORTED_OPERATION_CODES to report support for NDOB, > so who ends up using it? sg_write_same allows it. We found the bug because some user just decided to do: sg_write_same ... -nbod .. /dev/sdb and it crashed the box. I didn't know about the MI_REPORT_SUPPORTED_OPERATION_CODES part of it. I don't need support for the feature. I just want to fix the crash. I prefer just returning failure since nothing ever has ever used it if other people prefer that as well.