Skip to content

Retry READ CAPACITY(10)/(16) with good status but no data

Ewan D. Milne linux-scsi 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest9 patches 24 repliesIn review
  2. v38 patches 22 repliesSuperseded
  3. v29 patches 14 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches8 repliesSuperseded

Changes in v4 from the cover letter

- Add "only_once" module option to scsi_debug to allow testing of retry logic
- Reset sdeb_inject_pending after OPT_NO_DATA fault is injected
- Changed one patch subject message to be less verbose
- Clarlified one commit message
- Simplified a conditional in 2 places in one patch, and 1 in another

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9scsi: Explicitly specify .ascq = 0x00 for ASC 0x28/0x29 scsi_failuresdrivers/scsi/scsi_scan.c drivers/scsi/sd.c+3 -02 replies
2/9scsi: sd: Do not retry ASC 0x3a in read_capacity_10() with any ASCQdrivers/scsi/sd.c+2 -05 replies
3/9scsi: sd: Have scsi-ml retry read_capacity_16 errorsdrivers/scsi/sd.c+73 -342 replies
4/9scsi: sd: Avoid passing potentially uninitialized "sense_valid" to read_capacity_error()drivers/scsi/sd.c+5 -72 replies
5/9scsi: sd: Remove checks for -EOVERFLOW in sd_read_capacity()drivers/scsi/sd.c+0 -42 replies
6/9scsi: sd: Check for and retry in case of READ_CAPCITY(10)/(16) returning no datadrivers/scsi/sd.c+51 -85 replies
7/9scsi: Simplify nested if conditional in scsi_probe_lun()drivers/scsi/scsi_scan.c+8 -102 replies
8/9scsi: scsi_debug: Add option to suppress returned data but return good statusdrivers/scsi/scsi_debug.c+36 -132 replies
9/9scsi: scsi_debug: Add "only_once" module option to inject an error one timedrivers/scsi/scsi_debug.c+43 -72 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchDamien Le MoalHannes Reinecke
1/9R-b R-b
2/9R-b
3/9R-b
4/9R-b R-b
5/9R-b R-b
6/9R-b
7/9R-b R-b
8/9R-b R-b
9/9R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/9] Retry READ CAPACITY(10)/(16) with good status but no data

We encountered a SCSI device that responded to the initial READ CAPACITY command with a good status, but no data was transferred. This caused a sudden change of the device capacity to zero when the device was rescanned, for no obvious reason.

This patch series changes read_capacity_10() and read_capacity_16() in sd.c to retry the command up to 3 times in an attempt to get valid capacity information. A message is logged if this is ultimately unsuccessful.

There are some predecessor patches, one from a patch in a series by Mike Christie which changes read_capacity_16() to use the scsi_failures mechanism (which did not eventually get merged), this makes the changes here much more similar for both the read_capacity_10 and read_capacity_16() case. Another patch corrects a potential use of an uninitialized variable, and a third one removes a check for -EOVERFLOW that hasn't been needed since commit 72deb455b5ec ("block: remove CONFIG_LBDAF"). Other patches fill in missing .ascq entries in the scsi_failures array and address other review comments.

The final patches to scsi_debug allow insertion of the fault to test this change.

Changes in v4:
- Add "only_once" module option to scsi_debug to allow testing of retry logic
- Reset sdeb_inject_pending after OPT_NO_DATA fault is injected
- Changed one patch subject message to be less verbose
- Clarlified one commit message
- Simplified a conditional in 2 places in one patch, and 1 in another

Changes in v3:
- Removed patch to pass the length of the buffer through the sd_read_capacity() call chain and adjusted other patches accordingly. Use RC10/16_LEN for memset()
- Removed supurfluous parenthesis in conditionals

Changes in v2:
- Added patches to explicitly specify .ascq in scsi_features usage
- Pass the length of the buffer used through the sd_read_capacity() call chain
- Simplify a conditional in scsi_probe_lun() that was requested in similar

    code in read_capacity_16()/read_capacity_10()

- Changed code in scsi_debug() to make only one call to scsi_set_resid()
- Moved some declarations around in read_capacity_16()/read_capacity_10() and memset() the whole buffer instead of the expected data size
- Add the newly added flag SDEBUG_NO_DATA to SDEBUG_OPT_ALL_INJECTING

Ewan D. Milne (9):
scsi: Explicitly specify .ascq = 0x00 for ASC 0x28/0x29 scsi_failures
scsi: sd: Do not retry ASC 0x3a in read_capacity_10() with any ASCQ
scsi: sd: Have scsi-ml retry read_capacity_16 errors
scsi: sd: Avoid passing potentially uninitialized "sense_valid" to
read_capacity_error()
scsi: sd: Remove checks for -EOVERFLOW in sd_read_capacity()
scsi: sd: Check for and retry in case of READ_CAPCITY(10)/(16)
returning no data
scsi: Simplify nested if conditional in scsi_probe_lun()
scsi: scsi_debug: Add option to suppress returned data but return good
status
scsi: scsi_debug: Add "only_once" module option to inject an error one
time

 drivers/scsi/scsi_debug.c |  99 +++++++++++++++++-----
 drivers/scsi/scsi_scan.c  |  20 ++---
 drivers/scsi/sd.c         | 167 ++++++++++++++++++++++++++++----------
 3 files changed, 212 insertions(+), 74 deletions(-)
Signature · 1 line
2.47.1