On Fri, 16 Oct 2026 19:54:34 +0800, Stanley Jhu wrote:
> On Fri, 16 Oct 2026 18:31:09 +0900, Daejun Park wrote:
>> + if (req->sg && req->sg->size > scsi_req->cmd.xfer) {
>> + ufs_limit_sg_list(req, scsi_req->cmd.xfer);
>> + }
>
> This handles a PRDT that is larger than the CDB. Does a PRDT that is
> smaller than the CDB need to be handled as well? If so, could that be
> done on the host controller side instead of in the LU?
Thanks, yes. Today scsi-hd moves only what the SG list holds and
completes with GOOD, and on a zoned LU the write pointer moves past
blocks that were not written.
UFSHCI reports a data buffer that is too small with OCS MISMATCH DATA
BUFFER SIZE, so the status belongs to ufs.c. ufs.c does not parse the
CDB, though; the LU does, in scsi_req_new(). In v3 the LU would pass
the transfer length to ufs.c, and ufs.c would fail the request with
that OCS when the PRDT is smaller, before scsi-hd sees it and with the
write pointer unchanged. Would that split work for you?
Daejun