device-mapper-multipath/0092-RHBZ-689504-rdac-retry.patch

65 lines
2.1 KiB
Diff
Raw Normal View History

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))) {