scsi: handle special return codes for ABORTED COMMAND
PATCH v2 1/1 scsi: handle special return codes for ABORTED COMMAND
Introduce a new blist flag that indicates the device may return certain sense code/ASC/ASCQ combinations that indicate different treatment than normal. In particular, some devices need unconditional retry (aka ADD_TO_MLQUEUE) under certain conditions; otherwise path failures may be falsely detected in the "maybe_retry" case.
Because different devices use different sense codes to indicate this condition, a single bit is not enough. But we also can't use a bit for every possible status code. Therefore the new flag BLIST_ABORTED_CMD_QUIRK just indicates that this is a device for which the return code should be checked. An extra "blacklist" in scsi_aborted_cmd_quirk() then checks for known ASC/ASCQ combinations, and handles them.
When such a combination is encountered for the first time, a message is printed. In systems that have several different peripherals using this flag, that might lead to a wrong match without a warning. This small risk is a compromise between exactness and the excessive resources that would be required to check for matching device vendor and model name every time. Also, if there were different devices (identified by vendor/model) using the same ASC/ASCQ, the code might print stray warnings. But the additional effort to required to handle this 100% correctly is hardly justified with the current minimal "blacklist".
I chose to recycle devinfo flag (1<<11) (former BLIST_INQUIRY_58, free since 496c91bbc910) for this purpose rather than extending blist_flags_t to 64 bit. This could be easily changed of course.
This patch replaces the previously submitted patches
"scsi: handle ABORTED_COMMAND on Fujitsu ETERNUS" and "scsi: Always retry internal target error" (Hannes Reinecke)
Changes in v2:
- use ARRAY_SIZE (Bart van Assche)
- make blist array static const and use separate bitmask for warned flag (Bart van Assche)
- Fix string comparison for SCSI vendor and model
- Print warning at scsi_logging_level 0, and improve message formatting
--- drivers/scsi/scsi_devinfo.c | 4 +- drivers/scsi/scsi_error.c | 111 ++++++++++++++++++++++++++++++++++++++++++++ include/scsi/scsi_devinfo.h | 6 +++ 3 files changed, 120 insertions(+), 1 deletion(-)
drivers/scsi/scsi_devinfo.c +3 -1
@@ -161,12 +161,14 @@ static struct { {"DGC", "RAID", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, storage on LUN 0 */ {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, no storage on LUN 0 */ {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, - {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2}, + {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN + | BLIST_REPORTLUN2 | BLIST_ABORTED_CMD_QUIRK}, {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN}, {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN}, {"easyRAID", "F8", NULL, BLIST_NOREPORTLUN}, {"FSC", "CentricStor", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"FUJITSU", "ETERNUS_DXM", "*", BLIST_ABORTED_CMD_QUIRK}, {"Generic", "USB SD Reader", "1.00", BLIST_FORCELUN | BLIST_INQUIRY_36}, {"Generic", "USB Storage-SMC", "0180", BLIST_FORCELUN | BLIST_INQUIRY_36}, {"Generic", "USB Storage-SMC", "0207", BLIST_FORCELUN | BLIST_INQUIRY_36},
drivers/scsi/scsi_error.c +111 -0
135 lines not on this page · raw message
include/scsi/scsi_devinfo.h +6 -0
@@ -28,6 +28,12 @@#define BLIST_LARGELUN ((__force blist_flags_t)(1 << 9))/* override additional length field */ #define BLIST_INQUIRY_36 ((__force blist_flags_t)(1 << 10)) +/* +* Device uses special return codes for ABORTED COMMAND +* This flag must go together with matching status handling code in +* scsi_aborted_cmd_quirk() +*/ +#define BLIST_ABORTED_CMD_QUIRK ((__force blist_flags_t)(1 << 11))/* do not do automatic start on add */ #define BLIST_NOSTARTONADD ((__force blist_flags_t)(1 << 12))/* try REPORT_LUNS even for SCSI-2 devs (if HBA supports more than 8 LUNs) */
Signature · 1 line
2.16.1