Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795026910; b=V9MQI//uOAoihVTWAG2Z3EDa7blPejXG3tozfF+sl8H0g/AdBDui/ZyuJyzYH4NH7pbG D79quW6i7nSsVAYFKUutEj4fe0T+SOdEh2Nc9bKlGvxHDuz4UbytZK1BCgH6J/gpPyVEv 76QtkW+yTauACI0nLXuNPrXmb00ikQRgJ6PAzkPMINzI9/rReyIwFnybIheqoIalwfY2a N5wJO458jLZJRL7emEZO0VDhR99wSX+m4ad0lhxN9dWd050aP/xLX8zWAchLUBtkJS/d5 iAAGBXY0SWPuQbzbTBgseBSQedAc7naIh/KmHBeMpx027Jjv+K1Fh8w5anFskUNLR2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795026910; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=aWazeckFyWdX29sF4bPX+/LWpmsvZyw3NP8TbxFzZcE=; b=nTzmaG/wQRTfObQqt3WsS3ctqsiwV9ZId8RF+Wl+EA1WZmei6cnxgN4SP0Kkjorern+4 OmZgY7BCG7TElbjRUApE5wAbhDZrA2nWiCYFt5Ba52Jhi0+eskkaf6/VwFLk2X2kTVuw4 f+O0Y0txkk0+dtisTHS0yqiElGAfCwiCVNBs/aegyr8S8lmxxpq4u0PrGwXN10rLr9XUc hcAGQg9TMVnT/R6RZjwMVXMAvihVZ1nwaT3iVaBwto7272Ri0ATJBJi1fxJ10I7rGsN0H otj3zaGNoPiS9VYl6TG9ChTLayt3l1hw9G8zvocj6ZaScLpIFWa3AjBfzladD/5NR1Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=knV38zYL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3FF9606A31C; Wed, 18 Nov 2026 18:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=knV38zYL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C5D1F000C9; Wed, 18 Nov 2026 18:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795026910; bh=aWazeckFyWdX29sF4bPX+/LWpmsvZyw3NP8TbxFzZcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=knV38zYLwKN2D8+sqOcazN44tTfgYQP8RtCTLyTB2X49uljbpZB3XRt61t3S3sya1 j4o58AMNedMXXlPVQC0jff5teVtCyqWNJUtOtTYM523jTDeYvuLseH7g4ZGEjBkMqy Gs/q0LwxIqyUvhfxPOzNMUS6xnuRsg4uS3JOirb8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Damien Le Moal , Johannes Thumshirn , Hannes Reinecke , "Martin K. Petersen (Oracle)" , Sasha Levin Subject: [PATCH 6.18 1562/2151] scsi: core: Rename sense field of struct scsi_failure Date: Wed, 18 Nov 2026 15:54:57 +0100 Message-ID: <20261118150218.795933211@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Damien Le Moal [ Upstream commit 45cdf8164237277e52af5d8aa4218c3cb6199bf2 ] Rename the sense field of struct scsi_failure to sense_key. This makes it clear that this field stores the sense key, and also unifies this structure field names with the names used in struct scsi_sense_hdr. To be consistent with this change, the macro SCMD_FAILURE_SENSE_ANY is renamed SCMD_FAILURE_SENSE_KEY_ANY. Of note is that the definition of the array any_sense_failure_defs in scsi_lib_test_any_sense() is modified to change the initialization of the result field to use SCMD_FAILURE_RESULT_ANY and add the .sense_key field initialization to SCMD_FAILURE_SENSE_KEY_ANY to match the test target case. Signed-off-by: Damien Le Moal Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20260908090308.1085097-5-dlemoal@kernel.org Signed-off-by: Martin K. Petersen (Oracle) Stable-dep-of: 92821c2358c7 ("scsi: hisi_sas: Fix spinup failure for SAS SSP devices in Active_Wait state") Signed-off-by: Sasha Levin --- drivers/scsi/ch.c | 2 +- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 4 ++-- drivers/scsi/device_handler/scsi_dh_rdac.c | 10 ++++----- drivers/scsi/scsi_lib.c | 6 ++--- drivers/scsi/scsi_lib_test.c | 25 +++++++++++---------- drivers/scsi/scsi_scan.c | 8 +++---- drivers/scsi/scsi_transport_spi.c | 2 +- drivers/scsi/sd.c | 20 ++++++++--------- drivers/scsi/ses.c | 8 +++---- include/scsi/scsi_device.h | 12 +++++----- 10 files changed, 49 insertions(+), 48 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index c2c018236517b..95bbcc497de9c 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -190,7 +190,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, struct scsi_sense_hdr sshdr; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = 3, diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index b6eaf49dfb004..4d71e0f3a2ea3 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -84,7 +84,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SCMD_FAILURE_NO_LIMIT, @@ -138,7 +138,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) * * Switch-over in progress, retry. */ - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = 0x04, .ascq = 0x03, .allowed = HP_SW_RETRIES, diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 6e1b252cea0e2..3865c12e7e60f 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -514,33 +514,33 @@ static void send_mode_select(struct work_struct *work) REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; struct scsi_failure failure_defs[] = { { - .sense = NO_SENSE, + .sense_key = NO_SENSE, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = ABORTED_COMMAND, + .sense_key = ABORTED_COMMAND, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, /* LUN Not Ready and is in the Process of Becoming Ready */ { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = 0x04, .ascq = 0x01, .result = SAM_STAT_CHECK_CONDITION, }, /* Command Lock contention */ { - .sense = ILLEGAL_REQUEST, + .sense_key = ILLEGAL_REQUEST, .asc = 0x91, .ascq = 0x36, .allowed = SCMD_FAILURE_NO_LIMIT, diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 8ed392efe5fc0..705e93f35993e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -241,13 +241,13 @@ static int scsi_check_passthrough(struct scsi_cmnd *scmd, continue; if (status_byte(failure->result) != SAM_STAT_CHECK_CONDITION || - failure->sense == SCMD_FAILURE_SENSE_ANY) + failure->sense_key == SCMD_FAILURE_SENSE_KEY_ANY) goto maybe_retry; if (!scsi_command_normalize_sense(scmd, &sshdr)) return 0; - if (failure->sense != sshdr.sense_key) + if (failure->sense_key != sshdr.sense_key) continue; if (failure->asc == SCMD_FAILURE_ASC_ANY) @@ -2374,7 +2374,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, struct scsi_sense_hdr my_sshdr; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = retries, diff --git a/drivers/scsi/scsi_lib_test.c b/drivers/scsi/scsi_lib_test.c index ae8af0e0047a8..4558dc853e26e 100644 --- a/drivers/scsi/scsi_lib_test.c +++ b/drivers/scsi/scsi_lib_test.c @@ -17,40 +17,40 @@ static void scsi_lib_test_multiple_sense(struct kunit *test) { struct scsi_failure multiple_sense_failure_defs[] = { { - .sense = DATA_PROTECT, + .sense_key = DATA_PROTECT, .asc = 0x1, .ascq = 0x1, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x11, .ascq = 0x0, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = 0x11, .ascq = 0x22, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = ABORTED_COMMAND, + .sense_key = ABORTED_COMMAND, .asc = 0x11, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = HARDWARE_ERROR, + .sense_key = HARDWARE_ERROR, .asc = SCMD_FAILURE_ASC_ANY, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = ILLEGAL_REQUEST, + .sense_key = ILLEGAL_REQUEST, .asc = 0x91, .ascq = 0x36, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, @@ -116,8 +116,9 @@ static void scsi_lib_test_any_sense(struct kunit *test) { struct scsi_failure any_sense_failure_defs[] = { { - .result = SCMD_FAILURE_SENSE_ANY, + .sense_key = SCMD_FAILURE_SENSE_KEY_ANY, .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SCMD_FAILURE_RESULT_ANY, }, {} }; @@ -129,7 +130,7 @@ static void scsi_lib_test_any_sense(struct kunit *test) .sense_buffer = sense, }; - /* Match using SCMD_FAILURE_SENSE_ANY */ + /* Match using SCMD_FAILURE_SENSE_KEY_ANY */ failures.failure_definitions = any_sense_failure_defs; scsi_build_sense(&sc, 0, MEDIUM_ERROR, 0x11, 0x22); KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); @@ -215,14 +216,14 @@ static void scsi_lib_test_total_allowed(struct kunit *test) { struct scsi_failure total_allowed_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, /* Fail all CCs except the UA above */ { - .sense = SCMD_FAILURE_SENSE_ANY, + .sense_key = SCMD_FAILURE_SENSE_KEY_ANY, .result = SAM_STAT_CHECK_CONDITION, }, /* Retry any other errors not listed above */ @@ -259,12 +260,12 @@ static void scsi_lib_test_mixed_total(struct kunit *test) { struct scsi_failure mixed_total_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x28, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .result = SAM_STAT_CHECK_CONDITION, }, diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 404bdff475fd2..f238183b9646f 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -658,12 +658,12 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, * so anyway. */ { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x28, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .result = SAM_STAT_CHECK_CONDITION, }, @@ -1440,14 +1440,14 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag struct Scsi_Host *shost = dev_to_shost(&starget->dev); struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, /* Fail all CCs except the UA above */ { - .sense = SCMD_FAILURE_SENSE_ANY, + .sense_key = SCMD_FAILURE_SENSE_KEY_ANY, .result = SAM_STAT_CHECK_CONDITION, }, /* Retry any other errors not listed above */ diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index fe47850a82587..e4ed8e46a6511 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -112,7 +112,7 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, REQ_FAILFAST_DRIVER; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = DV_RETRIES, diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 145670b4a1ccd..cd98b5df1a3fa 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1950,7 +1950,7 @@ static int sd_pr_in_command(struct block_device *bdev, u8 sa, u8 cmd[10] = { PERSISTENT_RESERVE_IN, sa }; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = 5, @@ -2052,7 +2052,7 @@ static int sd_pr_out_command(struct block_device *bdev, u8 sa, u64 key, struct scsi_sense_hdr sshdr; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = 5, @@ -2416,13 +2416,13 @@ sd_spinup_disk(struct scsi_disk *sdkp) struct scsi_failure failure_defs[] = { /* Do not retry Medium Not Present */ { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x3A, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = 0x3A, .ascq = SCMD_FAILURE_ASCQ_ANY, .result = SAM_STAT_CHECK_CONDITION, @@ -2739,18 +2739,18 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, struct scsi_failure failure_defs[] = { /* Do not retry Medium Not Present */ { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x3A, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = 0x3A, .result = SAM_STAT_CHECK_CONDITION, }, /* Device reset might occur several times so retry a lot */ { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .allowed = READ_CAPACITY_RETRIES_ON_RESET, .result = SAM_STAT_CHECK_CONDITION, @@ -4104,21 +4104,21 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) struct scsi_failure failure_defs[] = { { /* Power on, reset, or bus device reset occurred */ - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0, .result = SAM_STAT_CHECK_CONDITION, }, { /* Power on occurred */ - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .ascq = 1, .result = SAM_STAT_CHECK_CONDITION, }, { /* SCSI bus reset */ - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .ascq = 2, .result = SAM_STAT_CHECK_CONDITION, diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 7e1f085ad350a..123aab6ccdce2 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -89,14 +89,14 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, unsigned char recv_page_code; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SES_RETRIES, @@ -146,14 +146,14 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, }; struct scsi_failure failure_defs[] = { { - .sense = UNIT_ATTENTION, + .sense_key = UNIT_ATTENTION, .asc = 0x29, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, }, { - .sense = NOT_READY, + .sense_key = NOT_READY, .asc = SCMD_FAILURE_ASC_ANY, .ascq = SCMD_FAILURE_ASCQ_ANY, .allowed = SES_RETRIES, diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index c2915bf170660..053f9d860b126 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -508,18 +508,18 @@ extern void scsi_sanitize_inquiry_string(unsigned char *s, int len); */ #define SCMD_FAILURE_STAT_ANY 0xff /* - * The following can be set to the scsi_failure sense, asc and ascq fields to - * match on any sense, ASC, or ASCQ value. + * The following can be set to the scsi_failure sense key, asc and ascq fields + * to match any sense key, ASC, and ASCQ value. */ -#define SCMD_FAILURE_SENSE_ANY 0xff -#define SCMD_FAILURE_ASC_ANY 0xff -#define SCMD_FAILURE_ASCQ_ANY 0xff +#define SCMD_FAILURE_SENSE_KEY_ANY 0xff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff /* Always retry a matching failure. */ #define SCMD_FAILURE_NO_LIMIT -1 struct scsi_failure { int result; - u8 sense; + u8 sense_key; u8 asc; u8 ascq; /* -- 2.53.0