From patchwork Wed Jul 20 21:22:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 993122 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6KLQdRD012876 for ; Wed, 20 Jul 2011 21:27:10 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6KLNuh9026563; Wed, 20 Jul 2011 17:23:57 -0400 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 p6KLNsMl030049 for ; Wed, 20 Jul 2011 17:23:54 -0400 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6KLNndN020073 for ; Wed, 20 Jul 2011 17:23:49 -0400 Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.145]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6KLNm8l019315 for ; Wed, 20 Jul 2011 17:23:48 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6KKspEO006152 for ; Wed, 20 Jul 2011 16:54:51 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6KLMV1d166376 for ; Wed, 20 Jul 2011 17:22:31 -0400 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6KFMTmU011850 for ; Wed, 20 Jul 2011 09:22:30 -0600 Received: from [9.47.24.164] (chandra-lucid.beaverton.ibm.com [9.47.24.164]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p6KFMSkb011782; Wed, 20 Jul 2011 09:22:29 -0600 From: Chandra Seetharaman To: linux-scsi Organization: IBM Date: Wed, 20 Jul 2011 14:22:28 -0700 Message-ID: <1311196948.5505.10779.camel@chandra-lucid.beaverton.ibm.com> Mime-Version: 1.0 X-RedHat-Spam-Score: -3.493 (RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: dm-devel , "Moger, Babu" , yanling.Qi@netapp.com, "Stankey, Robert" Subject: [dm-devel] [PATCH] Associate HBA and storage in rdac_controller to support partitions in storage X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: sekharan@us.ibm.com, 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 (demeter2.kernel.org [140.211.167.43]); Wed, 20 Jul 2011 21:27:10 +0000 (UTC) rdac hardware handler assumes that there is one-to-one relation ship between the host and the controller w.r.t lun. IOW, it does not support "multiple storage partitions" within a storage. Example: HBA1 and HBA2 see lun 0 and 1 in storage A (1) HBA3 and HBA4 see lun 0 and 1 in storage A (2) HBA5 and HBA6 see lun 0 and 1 in storage A (3) luns 0 and 1 in (1), (2) and (3) are totally different. But, rdac handler treats the lun 0s (and lun 1s) as the same when sending a mode select to the controller, which is wrong. This patch makes the rdac hardware handler associate HBA and the storage w.r.t lun (and not the host itself). Signed-off-by: Chandra Seetharaman --- drivers/scsi/device_handler/scsi_dh_rdac.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 214d7f0..67c2c99 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -149,6 +149,7 @@ struct rdac_controller { } mode_select; u8 index; u8 array_name[ARRAY_LABEL_LEN]; + struct Scsi_Host *host; spinlock_t ms_lock; int ms_queued; struct work_struct ms_work; @@ -380,7 +381,7 @@ static void release_controller(struct kref *kref) } static struct rdac_controller *get_controller(u8 *serial, int index, - char *array_name) + char *array_name, struct scsi_device *sdev) { struct rdac_controller *ctlr, *tmp; @@ -388,7 +389,8 @@ static struct rdac_controller *get_controller(u8 *serial, int index, list_for_each_entry(tmp, &ctlr_list, node) { if ((memcmp(tmp->serial, serial, SERIAL_NO_LEN) == 0) && - (tmp->index == index)) { + (tmp->index == index) && + (tmp->host == sdev->host)) { kref_get(&tmp->kref); spin_unlock(&list_lock); return tmp; @@ -402,6 +404,7 @@ static struct rdac_controller *get_controller(u8 *serial, int index, memcpy(ctlr->serial, serial, SERIAL_NO_LEN); memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN); ctlr->index = index; + ctlr->host = sdev->host; kref_init(&ctlr->kref); ctlr->use_ms10 = -1; @@ -525,7 +528,8 @@ static int initialize_controller(struct scsi_device *sdev, if (err != SCSI_DH_OK) return err; inq_p80 = &h->inq.p80; - h->ctlr = get_controller(inq_p80->serial, index, array_name); + h->ctlr = get_controller(inq_p80->serial, index, + array_name, sdev); if (!h->ctlr) err = SCSI_DH_RES_TEMP_UNAVAIL; }