Hi Andy, > Aside from whether they handle BIDI ops or not, parsing of the CDB by > kernel and user SCSI passthrough modules should be identical. Move this > into a new passthrough_parse_cdb() and call it from tcm-pscsi and tcm-user. > > Reported-by: Christoph Hellwig <hch@xxxxxx> > Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> <SNIP> > + /* > + * Clear a lun set in the cdb if the initiator talking to use spoke > + * and old standards version, as we can't assume the underlying device > + * won't choke up on it. > + */ > + switch (cdb[0]) { > + case READ_10: /* SBC - RDProtect */ > + case READ_12: /* SBC - RDProtect */ > + case READ_16: /* SBC - RDProtect */ > + case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ > + case VERIFY: /* SBC - VRProtect */ > + case VERIFY_16: /* SBC - VRProtect */ > + case WRITE_VERIFY: /* SBC - VRProtect */ > + case WRITE_VERIFY_12: /* SBC - VRProtect */ > + case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ > + break; > + default: > + cdb[1] &= 0x1f; /* clear logical unit number */ > + break; > + } Hi Andy, I don't understand why this is needed. First of all, I would suggest rephrasing the comment since it seems to have a few problems (it took me a while to understand it). Also, since this is a pass-through SCSI implementation, you shouldn't have to examine the CDB or modify it in any way. What do you think? Thanks, Ilias
Attachment:
signature.asc
Description: Digital signature