[Stgt-devel] SCSI Return status path flow..

Pete Wyckoff pw
Sat Feb 23 16:58:55 CET 2008


mark_harvey at symantec.com wrote on Fri, 22 Feb 2008 23:58 -0700:
> Re: Variable block reads READ(6)
> 
> When I return a "CHECK CONDITION" in response to a 'short block' read, I
> have not been able to figure out how to return the block of data read +
> the sense code with the 'Incorrect length' condition.
> 
> All I seem to get back is the 'CHECK CONDITION' sense information
> without the block of data.
> 
>  
> 
> No matter how long I look at the code, I haven't figured out the return
> path.

(Please don't send html mail.)

This recently changed.  Here's the trick:

        scsi_set_in_resid_by_actual(cmd, actual);

I.e. if the initiator asked to read "desired" bytes, but the target
could only provide "actual" bytes, this call will set the residual
to (desired - actual).  You still need to generate sense data and
return SAM_STAT_CHECK_CONDITION too, if this is required by ssc.
It's not always an error to underflow.

		-- Pete



More information about the stgt mailing list