diff mbox series

[3/4] scsi_dh_alua: set 'transitioning' state on unit attention

Message ID 20200930080256.90964-4-hare@suse.de (mailing list archive)
State New, archived
Headers show
Series scsi: remove devices in ALUA transitioning status | expand

Commit Message

Hannes Reinecke Sept. 30, 2020, 8:02 a.m. UTC
We should be setting the 'transitioning' ALUA state once we get
a unit attention indicating the array is in transitioning.
There are arrays which cannot respond to an rtpg while in transitioning,
and others have issues correctly reporting the state.
So better to set the state during unit attention handling and wait
for TUR / RTPG to run its course.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index a68222e324e9..ea436a14087f 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -408,12 +408,20 @@  static char print_alua_state(unsigned char state)
 static int alua_check_sense(struct scsi_device *sdev,
 			    struct scsi_sense_hdr *sense_hdr)
 {
+	struct alua_dh_data *h = sdev->handler_data;
+	struct alua_port_group *pg;
+
 	switch (sense_hdr->sense_key) {
 	case NOT_READY:
 		if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
 			/*
 			 * LUN Not Accessible - ALUA state transition
 			 */
+			rcu_read_lock();
+			pg = rcu_dereference(h->pg);
+			if (pg)
+				pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
+			rcu_read_unlock();
 			alua_check(sdev, false);
 			return NEEDS_RETRY;
 		}