I am working on the assumption that users of the SG_IO ioctl in the block layer (or via st or osst) want SCSI status and sense data returned via the ioctl immediately without: - the error/warning silently disappearing and/or being hidden by a retry (e.g. UNIT ATTENTION, lu becoming ready) - noise in the log (or console) - any other side effects (save clearing expecting_cc_ua if a UNIT ATTENTION was expected) To this end here are two patches, the first to scsi_lib.c attached to this post and the second to sd.c in a following post. Some work may also be needed in the st and osst drivers. These patches are against lk 2.6.11-rc1-bk1 which includes James's "SCSI updates to 2.6.11-rc1" patch. The descriptor sense patches are now functional in the mid level (including error reporting functions in constants.c). The next drivers to visit will be sd and sg. Medium errors (or hardware errors which seem synonomous) are an interesting case for sd with big lus. SBC-2 says that if the sense data information field is too large to fit in the fixed format sense data then the valid bit shall be set to 0. This implies big lus really should be using descriptor sense format. Changelog: - cleanup scsi_end_request() documentation - shorten path for block SG_IO through scsi_io_completion() - for non-SG_IO sense processing in scsi_io_completion(): - ignore deferred errors (report + retry should suffice) - consolidate into a cleaner switch statement Signed-off-by: Douglas Gilbert