Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3318

kernel-2.6.18-194.11.1.el5.src.rpm

From: mchristi@redhat.com <mchristi@redhat.com>
Date: Wed, 29 Jul 2009 21:29:27 -0500
Subject: [scsi] ALUA: send STPG if explicit and implicit
Message-id: 1248920967-3374-1-git-send-email-mchristi@redhat.com
O-Subject: [PATCH] RHEL 5.4: ALUA: send STPG if explicit and implicit is supported
Bugzilla: 482737
RH-Acked-by: Tomas Henzl <thenzl@redhat.com>

From: Mike Christie <mchristi@redhat.com>

This is for BZ 482737.

alua_activate sends a STPG if only explicit is suppored.
As a result, for EMC targets that support both we end up doing
a implicit failover when X commands are finally sent to
the other SP.

This patch does a AND on the h->tpgs, like other code in the driver,
so we do a explicit failover right away, so resources are shifted on
the target right away. This is preferable because at this time we
know the paths are bad and that tranistioning is the right thing to do .

This patch is in the scsi maintainer's tree
for the next feature window here:
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=e397163a20418b65742b380616913c76dccd8d1c

This patch also fixes a bug in the sense retry handling.
The original patch this was made with was using the older
NEEDS_RETRY values. Upstream those are not used and
ADD_TO_MLQUEUE is used. In our kernel though, we use a different
value, SCSI_MLQUEUE_IMM_RETRY, because we merged some code thinking it
was going upstream but it has not made it there yet.

I have tested this patch against a EMC Clarrion. And EMC
has also tested, by pulling cables and offlining devices.
The sense retry code has been stressed by just loading this
module then loading the fc one. This will return Unit Attentions
on the initial IOs. Previously it would return failures.

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 8a150f5..8ceec2a 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -502,7 +502,7 @@ static int alua_stpg(struct scsi_device *sdev, int state,
 		if (!err)
 			return SCSI_DH_IO;
 		err = alua_check_sense(sdev, &sense_hdr);
-		if (retry > 0 && err == NEEDS_RETRY) {
+		if (retry > 0 && err == SCSI_MLQUEUE_IMM_RETRY) {
 			retry--;
 			goto retry;
 		}
@@ -547,7 +547,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
 			return SCSI_DH_IO;
 
 		err = alua_check_sense(sdev, &sense_hdr);
-		if (err == NEEDS_RETRY)
+		if (err == SCSI_MLQUEUE_IMM_RETRY)
 			goto retry;
 		sdev_printk(KERN_INFO, sdev,
 			    "%s: rtpg sense code %02x/%02x/%02x\n",
@@ -665,7 +665,7 @@ static int alua_activate(struct scsi_device *sdev)
 			goto out;
 	}
 
-	if (h->tpgs == TPGS_MODE_EXPLICIT && h->state != TPGS_STATE_OPTIMIZED)
+	if (h->tpgs & TPGS_MODE_EXPLICIT && h->state != TPGS_STATE_OPTIMIZED)
 		err = alua_stpg(sdev, TPGS_STATE_OPTIMIZED, h);
 
 out: