libata: scsi error handling
PATCH 1/1 libata: scsi error handling
Jeff,
Here is a follow on patch based on lk 2.6.13-rc7 plus the start_stop_unit patch and the rw_zero_length patch.
It adds more general error processing, typically for problems (or an early finish) detected while a SCSI command is being processed prior to an ATA command being executed.
Changelog:
- add extern ata_scsi_set_sense() to build SCSI sense data and corresponding status
- this allows removal of extern ata_scsi_badcmd() and static inline ata_bad_scsiop() and ata_bad_cdb()
- change "xlat" functions in libata-scsi so they are responsible for SCSI status and sense data when they return 1. This allows GOOD status or a specialized error to be set.
- set DRIVER_SENSE when SAM_STAT_CHECK_CONDITION is flagged in scsi_cmnd::result
- yield an error for mode sense requests for saved
values [sat-r05]
- change recent rw_zero_length patch to do nothing (yield GOOD status) when transfer_length==0 for 10 and 16 byte READ and WRITE commands (SBC-2).
Doug Gilbert
drivers/scsi/libata.h2613rc6xa renamed from drivers/scsi/libata.h +1 -13
@@ -69,21 +69,9 @@ unsigned int buflen); extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, unsigned int buflen); -extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *), - u8 asc, u8 ascq); +extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq); extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, unsigned int (*actor) (struct ata_scsi_args *args, u8 *rbuf, unsigned int buflen)); -static inline void ata_bad_scsiop(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) -{ - ata_scsi_badcmd(cmd, done, 0x20, 0x00); -} - -static inline void ata_bad_cdb(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) -{ - ata_scsi_badcmd(cmd, done, 0x24, 0x00); -} - #endif /* __LIBATA_H__ */
drivers/scsi/libata-scsi.c2613rc7ssrw0_err renamed from drivers/scsi/libata-scsi.c +145 -67
429 lines not on this page · raw message
Quoted 22 lines · Douglas Gilbert
Jeff,
Here is a follow on patch based on lk 2.6.13-rc7 plus thestart_stop_unitpatch and therw_zero_lengthpatch.It adds more general error processing, typically for problems (or an early finish) detected while a SCSI command is being processed prior to an ATA command being executed.
Changelog:
- add externata_scsi_set_sense()to build SCSI sense data and corresponding status
- this allows removal of externata_scsi_badcmd()and static inlineata_bad_scsiop()andata_bad_cdb()
- change "xlat" functions in libata-scsi so they are responsible for SCSI status and sense data when they return 1. This allows GOOD status or a specialized error to be set.
- setDRIVER_SENSEwhenSAM_STAT_CHECK_CONDITIONis flagged inscsi_cmnd::result
- yield an error for mode sense requests for saved
Quoted 4 lines
values [sat-r05]- change recent
rw_zero_lengthpatch to do nothing (yield GOOD status) when transfer_length==0 for 10 and 16 byte READ and WRITE commands (SBC-2).
All this is OK, though in the future, please split changes such as the creation and explicit use of ata_scsi_set_sense() to a separate patch. We need to separate logical changes. Patches get applied more quickly when they are split up, too.
However, I really wanted to go ahead and merge the C/H/S support patch, which updates the R/W xlat function, causing conflicts with your patch in several places. (as a side effect, C/H/S updates clean up the R/W xlat function rather nicely)
If you would be kind enough to rediff against the 'upstream' branch of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
I would really appreciate it. I'll merge it as soon as I receive the rediff.
Jeff