scsi: Add ALUA state change UA handling
authorHannes Reinecke <hare@suse.de>
Mon, 6 Jul 2015 11:41:53 +0000 (13:41 +0200)
committerJames Bottomley <JBottomley@Odin.com>
Wed, 26 Aug 2015 14:19:57 +0000 (07:19 -0700)
Log the ALUA state change unit attention correctly with
the message log and emit an event to allow user-space
tools to react to it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
include/scsi/scsi_device.h

index cfadccef045c5f91d9efb5f575c98d1d9c68b090..d7d28061b31d8aa86a631e1a06d0a8ca6874137b 100644 (file)
@@ -421,6 +421,10 @@ static void scsi_report_sense(struct scsi_device *sdev,
                        evt_type = SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED;
                        sdev_printk(KERN_WARNING, sdev,
                                    "Mode parameters changed");
+               } else if (sshdr->asc == 0x2a && sshdr->ascq == 0x06) {
+                       evt_type = SDEV_EVT_ALUA_STATE_CHANGE_REPORTED;
+                       sdev_printk(KERN_WARNING, sdev,
+                                   "Asymmetric access state changed");
                } else if (sshdr->asc == 0x2a && sshdr->ascq == 0x09) {
                        evt_type = SDEV_EVT_CAPACITY_CHANGE_REPORTED;
                        sdev_printk(KERN_WARNING, sdev,
index dffa91c67f5b9f5ca8a8e848481cf78174958745..882864f5cbae8b8d775eecfdd851aee44fa2e0fe 100644 (file)
@@ -2712,6 +2712,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_ALUA_STATE_CHANGE_REPORTED:
+               envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
+               break;
        default:
                /* do nothing */
                break;
@@ -2815,6 +2818,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_ALUA_STATE_CHANGE_REPORTED:
        default:
                /* do nothing */
                break;
index ae84b2214d407f16d2a7f9ac6b73c350973c4f37..50c2a363bc8fec46d60240c5af8fe4fd2754f9f7 100644 (file)
@@ -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_ALUA_STATE_CHANGE_REPORTED,            /* 2A 06  UA reported */
 
        SDEV_EVT_FIRST          = SDEV_EVT_MEDIA_CHANGE,
-       SDEV_EVT_LAST           = SDEV_EVT_LUN_CHANGE_REPORTED,
+       SDEV_EVT_LAST           = SDEV_EVT_ALUA_STATE_CHANGE_REPORTED,
 
        SDEV_EVT_MAXBITS        = SDEV_EVT_LAST + 1
 };