From patchwork Mon Mar 2 05:56:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chauhan, Vijay" X-Patchwork-Id: 9491 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n225v9v5002523 for ; Mon, 2 Mar 2009 05:57:09 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 56C7A618E99; Mon, 2 Mar 2009 00:57:08 -0500 (EST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n225v8PH016039 for ; Mon, 2 Mar 2009 00:57:08 -0500 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n225v8sg014414 for ; Mon, 2 Mar 2009 00:57:09 -0500 Received: from exprod7og108.obsmtp.com (exprod7og108.obsmtp.com [64.18.2.169]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n225uob3025852 for ; Mon, 2 Mar 2009 00:56:50 -0500 Received: from source ([147.145.40.20]) by exprod7ob108.postini.com ([64.18.6.12]) with SMTP ID DSNKSat1GpK7aCwebEKNV0CMS7CnYLopnmqR@postini.com; Sun, 01 Mar 2009 21:56:51 PST Received: from milmhbs0.lsil.com (mhbs.lsil.com [147.145.1.30]) by mail0.lsil.com (8.12.11/8.12.11) with ESMTP id n225ufvA007949; Sun, 1 Mar 2009 21:56:41 -0800 (PST) Received: from inbmail01.lsi.com (inbmail01.in.lsil.com [172.28.140.213]) by milmhbs0.lsil.com (8.12.11/8.12.11) with ESMTP id n225ugl9025021; Sun, 1 Mar 2009 21:56:43 -0800 Received: from inbmail01.lsi.com ([172.28.140.213]) by inbmail01.lsi.com ([172.28.140.213]) with mapi; Mon, 2 Mar 2009 11:26:39 +0530 From: "Chauhan, Vijay" To: "linux-scsi@vger.kernel.org" , "sekharan@us.ibm.com" Date: Mon, 2 Mar 2009 11:26:36 +0530 Thread-Topic: [PATCH]scsi_dh_rdac: Retry mode select for NO_SENSE, ABORTED_COMMAND, UNIT_ATTENTION, NOT_READY(02/04/01) Thread-Index: Acma+6XjQRh11WB0SQ+Sugafc3XSMg== Message-ID: <0D1E8821739E724A86F4D16902CE275C140E25C334@inbmail01.lsi.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.31 X-Scanned-By: MIMEDefang 2.39 X-RedHat-Spam-Score: -4 X-MIME-Autoconverted: from quoted-printable to 8bit by listman.util.phx.redhat.com id n225v8PH016039 X-loop: dm-devel@redhat.com Cc: "dm-devel@redhat.com" Subject: [dm-devel] [PATCH]scsi_dh_rdac: Retry mode select for NO_SENSE, ABORTED_COMMAND, UNIT_ATTENTION, NOT_READY(02/04/01) X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 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 This patch is to add retry for mode select if mode select command is returned with sense key NO_SENSE, ABORTED_COMMAND, UNIT_ATTENTION or NOT_READY(02/04/01). This patch reorganise the sense from if-else to switch-case format in scsi_dh_rdac.c for better maintainability. Signed-off-by: Vijay Chauhan --- -- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel --- linux-2.6.29-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c.orig 2009-02-24 12:08:43.000000000 +0530 +++ linux-2.6.29-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c 2009-02-28 18:18:41.000000000 +0530 @@ -449,28 +449,40 @@ static int mode_select_handle_sense(stru unsigned char *sensebuf) { struct scsi_sense_hdr sense_hdr; - int sense, err = SCSI_DH_IO, ret; + int err = SCSI_DH_IO, ret; ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr); if (!ret) goto done; err = SCSI_DH_OK; - sense = (sense_hdr.sense_key << 16) | (sense_hdr.asc << 8) | - sense_hdr.ascq; - /* If it is retryable failure, submit the c9 inquiry again */ - if (sense == 0x59136 || sense == 0x68b02 || sense == 0xb8b02 || - sense == 0x62900) { - /* 0x59136 - Command lock contention - * 0x[6b]8b02 - Quiesense in progress or achieved - * 0x62900 - Power On, Reset, or Bus Device Reset - */ + + switch (sense_hdr.sense_key) { + case NO_SENSE: + case ABORTED_COMMAND: + case UNIT_ATTENTION: + err = SCSI_DH_RETRY; + break; + case NOT_READY: + if (sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x01) + /* LUN Not Ready and is in the Process + * of becoming ready + */ + err = SCSI_DH_RETRY; + break; + case ILLEGAL_REQUEST: + if (sense_hdr.asc == 0x91 && sense_hdr.ascq == 0x36) + /* + * Command Lock contention + */ err = SCSI_DH_RETRY; + break; + default: + sdev_printk(KERN_INFO, sdev, + "MODE_SELECT failed with sense %02x/%02x/%02x.\n", + sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq); } - if (sense) - sdev_printk(KERN_INFO, sdev, - "MODE_SELECT failed with sense 0x%x.\n", sense); done: return err; }