From patchwork Tue Mar 1 19:08:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 600411 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p21JAJ53021716 for ; Tue, 1 Mar 2011 19:10:40 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p21J7dVx020972; Tue, 1 Mar 2011 14:08:01 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p21J7bE9006492 for ; Tue, 1 Mar 2011 14:07:37 -0500 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p21J7Wkj023128 for ; Tue, 1 Mar 2011 14:07:32 -0500 Received: from na3sys009aog106.obsmtp.com (na3sys009aog106.obsmtp.com [74.125.149.77]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p21J7Nfo010463 for ; Tue, 1 Mar 2011 14:07:23 -0500 Received: from source ([192.19.220.66]) (using TLSv1) by na3sys009aob106.postini.com ([74.125.148.12]) with SMTP ID DSNKTW1D6teLLwivriSWMwM/HFG7ce+RjbKP@postini.com; Tue, 01 Mar 2011 11:07:23 PST Received: from coscas01.lsi.com (172.21.36.60) by COSEDGE01.lsi.com (192.19.220.66) with Microsoft SMTP Server (TLS) id 8.3.137.0; Tue, 1 Mar 2011 12:07:24 -0700 Received: from cosmail01.lsi.com ([172.21.36.24]) by coscas01.lsi.com ([172.21.36.60]) with mapi; Tue, 1 Mar 2011 12:08:25 -0700 From: "Moger, Babu" To: "dm-devel@redhat.com" Date: Tue, 1 Mar 2011 12:08:24 -0700 Thread-Topic: [PATCH] multipath: Retry host transient errors for rdac checker Thread-Index: AcvYRAognyWp6xKNRO+OSIIky9CyKg== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id p21J7bE9006492 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH] multipath: Retry host transient errors for rdac checker X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 01 Mar 2011 19:10:40 +0000 (UTC) --- multipath-tools/libmultipath/checkers/rdac.c.orig 2011-02-16 13:58:06.000000000 -0600 +++ multipath-tools/libmultipath/checkers/rdac.c 2011-02-17 12:01:23.000000000 -0600 @@ -48,7 +48,9 @@ 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 @@ 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))) {