summaryrefslogtreecommitdiffstats
path: root/0092-RHBZ-689504-rdac-retry.patch
blob: f10eeae1296ac073f9f8a63ad91b055fb86123b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From patchwork Tue Mar  1 19:08:24 2011
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: multipath: Retry host transient errors for rdac checker
Date: Tue, 01 Mar 2011 19:08:24 -0000
From: Moger, Babu <Babu.Moger@lsi.com>
X-Patchwork-Id: 600411
Message-Id: <E463DF2B2E584B4A82673F53D62C2EF4FF7DC637@cosmail01.lsi.com>
To: "dm-devel@redhat.com" <dm-devel@redhat.com>

Sometimes if the host is in transient state, we need to wait till the devloss timeout to
expire before switching path group. We have seen in some cases path group switch happens
even before the devloss timeout expire. This patch fixes the problem for rdac checker..

Signed-off-by: Babu Moger <babu.moger@lsi.com>

---
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

---
 libmultipath/checkers/rdac.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Index: multipath-tools/libmultipath/checkers/rdac.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/rdac.c
+++ multipath-tools/libmultipath/checkers/rdac.c
@@ -48,7 +48,9 @@ do_inq(int sg_fd, unsigned int pg_op, vo
 	unsigned char inqCmdBlk[INQUIRY_CMDLEN] = { INQUIRY_CMD, 1, 0, 0, 0, 0 };
 	unsigned char sense_b[SENSE_BUFF_LEN];
 	struct sg_io_hdr io_hdr;
+	int retry_rdac = 5;
 
+retry:
 	inqCmdBlk[2] = (unsigned char) pg_op;
 	inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
 	memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
@@ -72,6 +74,22 @@ do_inq(int sg_fd, unsigned int pg_op, vo
 	if ((0 == io_hdr.status) && (0 == io_hdr.host_status) &&
 	    (0 == io_hdr.driver_status))
 		return 0;
+
+	/* check if we need to retry this error */
+	if (io_hdr.info & SG_INFO_OK_MASK) {
+		switch (io_hdr.host_status) {
+		case DID_BUS_BUSY:
+		case DID_ERROR:
+		case DID_TRANSPORT_DISRUPTED:
+			/* Transport error, retry */
+			if (--retry_rdac)
+				goto retry;
+			break;
+		default:
+			break;
+		}
+	}
+
 	if ((SCSI_CHECK_CONDITION == io_hdr.status) ||
 	    (SCSI_COMMAND_TERMINATED == io_hdr.status) ||
 	    (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) {