linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Ewan D. Milne" <emilne@redhat.com>, linux-scsi@vger.kernel.org
Cc: michael.christie@oracle.com, dgilbert@interlog.com
Subject: Re: [PATCH 1/5] scsi: sd: Have scsi-ml retry read_capacity_16 errors
Date: Wed, 13 Aug 2025 10:50:06 -0700	[thread overview]
Message-ID: <31fd2c7b-9b1a-4ff3-9b9c-6eaef269a5ea@acm.org> (raw)
In-Reply-To: <20250716184833.67055-2-emilne@redhat.com>

On 7/16/25 11:48 AM, Ewan D. Milne wrote:
> +		/*
> +		 * Do not retry Invalid Command Operation Code or Invalid
> +		 * Field in CDB.
> +		 */
> +		{
> +			.sense = ILLEGAL_REQUEST,
> +			.asc = 0x20,
> +			.result = SAM_STAT_CHECK_CONDITION,
> +		},
> +		{
> +			.sense = ILLEGAL_REQUEST,
> +			.asc = 0x24,
> +			.result = SAM_STAT_CHECK_CONDITION,
> +		},
> +		/* Do not retry Medium Not Present */
> +		{
> +			.sense = UNIT_ATTENTION,
> +			.asc = 0x3A,
> +			.result = SAM_STAT_CHECK_CONDITION,
> +		},
> +		{
> +			.sense = NOT_READY,
> +			.asc = 0x3A,
> +			.result = SAM_STAT_CHECK_CONDITION,
> +		},
> +		/* Device reset might occur several times so retry a lot */
> +		{
> +			.sense = UNIT_ATTENTION,
> +			.asc = 0x29,
> +			.allowed = READ_CAPACITY_RETRIES_ON_RESET,
> +			.result = SAM_STAT_CHECK_CONDITION,
> +		},

For the first, second and fifth array elements above: leaving out .ascq
is the same as requiring that the ASCQ value is zero. I prefer to make
this explicit by adding ".ascq = 0," in these array elements.

Additionally, media_not_present() doesn't check the ASCQ value while
the above array only accepts ASCQ == 0 if ASC == 0x3a. Please either
mention this behavior change in the patch description or add the
following in the third and fourth array elements:
".ascq = SCMD_FAILURE_ASCQ_ANY,".

> +	memset(buffer, 0, RC16_LEN);

Isn't the preferred style "memset(buffer, 0, ARRAY_SIZE(buffer))"? This
makes it easier for readers to verify that the third argument is
correct.

Otherwise this patch looks good to me.

Thanks,

Bart.

  parent reply	other threads:[~2025-08-13 17:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 18:48 [PATCH 0/5] Retry READ CAPACITY(10)/(16) with good status but no data Ewan D. Milne
2025-07-16 18:48 ` [PATCH 1/5] scsi: sd: Have scsi-ml retry read_capacity_16 errors Ewan D. Milne
2025-08-13  0:22   ` Bart Van Assche
2025-08-13 17:50   ` Bart Van Assche [this message]
2025-07-16 18:48 ` [PATCH 2/5] scsi: sd: Avoid passing potentially uninitialized "sense_valid" to read_capacity_error() Ewan D. Milne
2025-08-13  0:02   ` Bart Van Assche
2025-07-16 18:48 ` [PATCH 3/5] scsi: sd: Remove checks for -EOVERFLOW in sd_read_capacity() Ewan D. Milne
2025-08-13  0:04   ` Bart Van Assche
2025-07-16 18:48 ` [PATCH 4/5] scsi: sd: Check for and retry in case of READ_CAPCITY(10)/(16) returning no data Ewan D. Milne
2025-08-13  0:13   ` Bart Van Assche
2025-07-16 18:48 ` [PATCH 5/5] scsi: scsi_debug: Add option to suppress returned data but return good status Ewan D. Milne
2025-08-13  0:16   ` Bart Van Assche
2025-08-01 20:51 ` [PATCH 0/5] Retry READ CAPACITY(10)/(16) with good status but no data Ewan Milne
2025-08-06  2:22   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31fd2c7b-9b1a-4ff3-9b9c-6eaef269a5ea@acm.org \
    --to=bvanassche@acm.org \
    --cc=dgilbert@interlog.com \
    --cc=emilne@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michael.christie@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).