On 4/21/21 9:46 PM, Douglas Gilbert wrote:
On 2021-04-21 1:47 p.m., Hannes Reinecke wrote:
Replace the check for DRIVER_SENSE with a check for
SAM_STAT_CHECK_CONDITION and audit all callsites to
ensure the SAM status is set correctly.
For backwards compability move the DRIVER_SENSE definition
to sg.h, and update the sg driver to set the DRIVER_SENSE
driver_status whenever SAM_STAT_CHECK_CONDITION is present.
I may have missed it but you probably want to do the same
backwards compatibility DRIVER_SENSE trick for the
ioctl(SG_IO) implemented in block/scsi_ioctl.c . That way
DRIVER_SENSE will appear in the sg_io_hdr::driver_status byte
when check_condition_sense are set for both these cases:
ioctl(sd_fd, SG_IO, &a_sg_v3_obj)
ioctl(sg_fd, SG_IO, &a_sg_v3_obj)
And for bsg which uses sg_io_v4 for SCSI commands you set
sg_io_v4::driver_status = 0
in all cases. If check_condition and sense are active, why
not set DRIVER_SENSE for consistency. block/scsi_ioctl.c
includes scsi/sg.h so the DRIVER_SENSE define is visible.
Oh, indeed; I've forgotten it. Will be including it with the
next round.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer