From: Ewan Milne <emilne@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: James Bottomley <jbottomley@parallels.com>,
Robert Elliot <elliot@hp.com>,
Christoph Hellwig <hch@infradead.org>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/2] scsi: Handle power-on reset unit attention
Date: Wed, 11 Jun 2014 10:19:02 -0400 [thread overview]
Message-ID: <1402496342.3820.91.camel@localhost.localdomain> (raw)
In-Reply-To: <1401953203-103015-3-git-send-email-hare@suse.de>
On Thu, 2014-06-05 at 09:26 +0200, Hannes Reinecke wrote:
> As per SAM there is a status precedence, with any sense code 29/XX
> taking second place just after an ACA ACTIVE status.
> Additionally, each target might prefer to not queue any unit
> attention conditions but just report one.
> Due to the above this will be that one with the highest precedence.
> This results in the sense code 29/XX effectively overwriting any
> other unit attention.
> Hence we should report the power-on reset to userland so that
> it can take appropriate action.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/scsi_error.c | 6 ++++++
> drivers/scsi/scsi_lib.c | 4 ++++
> include/scsi/scsi_device.h | 3 ++-
> 3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 47a1ffc..65ed333 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -420,6 +420,12 @@ static void scsi_report_sense(struct scsi_device *sdev,
> "threshold.\n");
> }
>
> + if (sshdr->asc == 0x29) {
> + evt_type = SDEV_EVT_POWER_ON_RESET_OCCURRED;
> + sdev_printk(KERN_WARNING, sdev,
> + "Power-on or device reset occurred\n");
> + }
> +
> if (sshdr->asc == 0x2a && sshdr->ascq == 0x01) {
> evt_type = SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED;
> sdev_printk(KERN_WARNING, sdev,
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 9f841df..ee158c1 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2183,6 +2183,9 @@ static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
> case SDEV_EVT_LUN_CHANGE_REPORTED:
> envp[idx++] = "SDEV_UA=REPORTED_LUNS_DATA_HAS_CHANGED";
> break;
> + case SDEV_EVT_POWER_ON_RESET_OCCURRED:
> + envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
> + break;
> default:
> /* do nothing */
> break;
> @@ -2286,6 +2289,7 @@ struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
> case SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED:
> case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
> case SDEV_EVT_LUN_CHANGE_REPORTED:
> + case SDEV_EVT_POWER_ON_RESET_OCCURRED:
> default:
> /* do nothing */
> break;
> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> index 5853c91..7b9a886 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -57,9 +57,10 @@ enum scsi_device_event {
> SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED, /* 38 07 UA reported */
> SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED, /* 2A 01 UA reported */
> SDEV_EVT_LUN_CHANGE_REPORTED, /* 3F 0E UA reported */
> + SDEV_EVT_POWER_ON_RESET_OCCURRED, /* 29 00 UA reported */
>
> SDEV_EVT_FIRST = SDEV_EVT_MEDIA_CHANGE,
> - SDEV_EVT_LAST = SDEV_EVT_LUN_CHANGE_REPORTED,
> + SDEV_EVT_LAST = SDEV_EVT_POWER_ON_RESET_OCCURRED,
>
> SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1
> };
This looks fine to me. We might want to figure out a way
to report the ASCQ in an environment variable on this uevent,
since there are multiple sub-cases:
29 00 D POWER ON, RESET, OR BUS DEVICE RESET OCCURRED
29 01 D POWER ON OCCURRED
29 02 D SCSI BUS RESET OCCURRED
29 03 D BUS DEVICE RESET FUNCTION OCCURRED
29 04 D DEVICE INTERNAL RESET
29 05 D TRANSCEIVER MODE CHANGED TO SINGLE-ENDED
29 06 D TRANSCEIVER MODE CHANGED TO LVD
29 07 D I_T NEXUS LOSS OCCURRED
...but we could add that in a subsequent patch.
A related problem is that when this UA is received, the
device may have changed some of its attributes, so some
of the information that the mid-layer caches may be stale.
The udev rule handling this event should probably rescan
the device.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
prev parent reply other threads:[~2014-06-11 14:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 7:26 [PATCH 0/2] scanning fixes Hannes Reinecke
2014-06-05 7:26 ` [PATCH 1/2] scsi_scan: Send TEST UNIT READY to the LUN before scanning Hannes Reinecke
2014-06-11 13:40 ` Christoph Hellwig
2014-06-11 14:24 ` James Bottomley
2014-06-11 14:33 ` Hannes Reinecke
2014-06-11 14:46 ` James Bottomley
2014-06-11 15:13 ` Hannes Reinecke
2014-06-11 15:25 ` James Bottomley
2014-06-11 15:04 ` Jeremy Linton
2014-09-07 16:24 ` Christoph Hellwig
2014-09-14 8:17 ` Hannes Reinecke
2014-06-05 7:26 ` [PATCH 2/2] scsi: Handle power-on reset unit attention Hannes Reinecke
2014-06-11 12:49 ` Christoph Hellwig
2014-06-11 14:19 ` Ewan Milne [this message]
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=1402496342.3820.91.camel@localhost.localdomain \
--to=emilne@redhat.com \
--cc=elliot@hp.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.