scsi: Add ALUA state change UA handling
PATCH 1/1 scsi: Add ALUA state change UA handling
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 <[email protected]>
Reviewed-by Ewan D. Milne <[email protected]>
--- drivers/scsi/scsi_error.c | 4 ++++ drivers/scsi/scsi_lib.c | 4 ++++ include/scsi/scsi_device.h | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/scsi_error.c +4 -0
@@ -422,6 +422,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,
drivers/scsi/scsi_lib.c +4 -0
@@ -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 ;
include/scsi/scsi_device.h +2 -1
@@ -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 };
Signature · 1 line
1.8.5.2
Quoted 6 lines · Hannes Reinecke
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 <[email protected]>Reviewed-by Ewan D. Milne <[email protected]>
Reviewed-by Bart Van Assche <[email protected]>