Message ID | 20250120194925.44432-3-Kai.Makisara@kolumbus.fi (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | scsi: st: scsi_error: More reset patches | expand |
Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> On 1/20/25 2:49 PM, Kai Mäkisara wrote: > The purpose of the counters is to enable all ULDs attached to a > device to find out that a New Media or/and Power On/Reset Unit > Attentions has/have been set, even if another ULD catches the > Unit Attention as response to a SCSI command. > > The ULDs can read the counters and see if the values have changed from > the previous check. > > Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> > --- > drivers/scsi/scsi_error.c | 12 ++++++++++++ > include/scsi/scsi_device.h | 3 +++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c > index 10154d78e336..6ef0711c4ec3 100644 > --- a/drivers/scsi/scsi_error.c > +++ b/drivers/scsi/scsi_error.c > @@ -547,6 +547,18 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) > > scsi_report_sense(sdev, &sshdr); > > + if (sshdr.sense_key == UNIT_ATTENTION) { > + /* > + * increment the counters for Power on/Reset or New Media so > + * that all ULDs interested in these can see that those have > + * happened, even if someone else gets the sense data. > + */ > + if (sshdr.asc == 0x28) > + scmd->device->ua_new_media_ctr++; > + else if (sshdr.asc == 0x29) > + scmd->device->ua_por_ctr++; > + } > + > if (scsi_sense_is_deferred(&sshdr)) > return NEEDS_RETRY; > > diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h > index 9c540f5468eb..f5c0f07a053a 100644 > --- a/include/scsi/scsi_device.h > +++ b/include/scsi/scsi_device.h > @@ -247,6 +247,9 @@ struct scsi_device { > unsigned int queue_stopped; /* request queue is quiesced */ > bool offline_already; /* Device offline message logged */ > > + u16 ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */ > + u16 ua_por_ctr; /* Counter for Power On / Reset UAs */ > + > atomic_t disk_events_disable_depth; /* disable depth for disk events */ > > DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 10154d78e336..6ef0711c4ec3 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -547,6 +547,18 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) scsi_report_sense(sdev, &sshdr); + if (sshdr.sense_key == UNIT_ATTENTION) { + /* + * increment the counters for Power on/Reset or New Media so + * that all ULDs interested in these can see that those have + * happened, even if someone else gets the sense data. + */ + if (sshdr.asc == 0x28) + scmd->device->ua_new_media_ctr++; + else if (sshdr.asc == 0x29) + scmd->device->ua_por_ctr++; + } + if (scsi_sense_is_deferred(&sshdr)) return NEEDS_RETRY; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 9c540f5468eb..f5c0f07a053a 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -247,6 +247,9 @@ struct scsi_device { unsigned int queue_stopped; /* request queue is quiesced */ bool offline_already; /* Device offline message logged */ + u16 ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */ + u16 ua_por_ctr; /* Counter for Power On / Reset UAs */ + atomic_t disk_events_disable_depth; /* disable depth for disk events */ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
The purpose of the counters is to enable all ULDs attached to a device to find out that a New Media or/and Power On/Reset Unit Attentions has/have been set, even if another ULD catches the Unit Attention as response to a SCSI command. The ULDs can read the counters and see if the values have changed from the previous check. Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> --- drivers/scsi/scsi_error.c | 12 ++++++++++++ include/scsi/scsi_device.h | 3 +++ 2 files changed, 15 insertions(+)