Skip to content

scanning fixes

Hannes Reinecke linux-scsi 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2scsi_scan: Send TEST UNIT READY to the LUN before scanningdrivers/scsi/scsi_scan.c+73 -139 replies
2/2scsi: Handle power-on reset unit attentiondrivers/scsi/scsi_error.c drivers/scsi/scsi_lib.c include/scsi/scsi_device.h+12 -12 replies

Reviews trailers per patch

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

PatchChristoph HellwigEwan D. Milne
1/2R-b
2/2R-b R-b

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

Read the v1 thread

Cover letter [PATCH 0/2] scanning fixes

Hi all,

here are two fixes for the scanning logic which resolve two long-standing issues:

1) We need to send a 'TEST UNIT READY' to the LUN before scanning. The INQUIRY command does _not_ clear any unit attentions, so if there are any outstanding unit attention conditions they'll be attached to the first command after INQUIRY.
Which typically wouldn't be too bad, as most of the commands are now equipped with at least rudimentary error checking. However, the problem arises when we're sending a REPORT LUN command to that LUN. As per spec the REPORT LUN command will _always_ return something, but the list might not be fully populated if the firmware is still starting up (see SPC for details here). This will cause us to miss some devices during startup. Added to that we're not handling the unit attention 'REPORT LUN DATA HAS CHANGED', so the kernel will never be able to rescan all disks.
To fix this we should be issuing a TEST UNIT READY after INQUIRY, and wait until any pending unit attention goes away.

2) Power-on/Reset handling
While we're not sending out uevents for various unit attention conditions, we fail to observe the status precedence as per SAM. This might cause any 29/XX sense code to effectively overwrite any preceding unit attentions, causing us to miss those events. Hence as a minimal fix we need to report the power-on reset event via uevents, too.

Hannes Reinecke (2):
scsi_scan: Send TEST UNIT READY to the LUN before scanning
scsi: Handle power-on reset unit attention

 drivers/scsi/scsi_error.c  |  6 ++++
 drivers/scsi/scsi_lib.c    |  4 +++
 drivers/scsi/scsi_scan.c   | 86 +++++++++++++++++++++++++++++++++++++++-------
 include/scsi/scsi_device.h |  3 +-
 4 files changed, 85 insertions(+), 14 deletions(-)
Signature · 1 line
1.7.12.4