From patchwork Wed Jul 27 18:22:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 1012442 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6RIPmQW008752 for ; Wed, 27 Jul 2011 18:26:14 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 p6RIN8Fj009176; Wed, 27 Jul 2011 14:23:10 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6RIN7MU011702 for ; Wed, 27 Jul 2011 14:23:07 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6RIN270011109 for ; Wed, 27 Jul 2011 14:23:02 -0400 Received: from e7.ny.us.ibm.com (e7.ny.us.ibm.com [32.97.182.137]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6RIN0cv017993 for ; Wed, 27 Jul 2011 14:23:00 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e7.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6RHvKvZ018091 for ; Wed, 27 Jul 2011 13:57:20 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6RIMxvc1531944 for ; Wed, 27 Jul 2011 14:22:59 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6REMkRk017612 for ; Wed, 27 Jul 2011 11:22:46 -0300 Received: from [9.47.24.164] ([9.47.24.164]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p6REMiSf017537; Wed, 27 Jul 2011 11:22:45 -0300 From: Chandra Seetharaman To: linux-scsi , James Bottomley Organization: IBM Date: Wed, 27 Jul 2011 11:22:56 -0700 Message-ID: <1311790976.3210.999.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.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: dm-devel , "Moger, Babu" , yanling.Qi@netapp.com, "Stankey, Robert" Subject: [dm-devel] [PATCH v2] 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, 27 Jul 2011 18:26:14 +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 --- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index f57009b..27c9d65 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -158,6 +158,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; @@ -370,7 +371,7 @@ static void release_controller(struct kref *kref) } static struct rdac_controller *get_controller(int index, char *array_name, - u8 *array_id) + u8 *array_id, struct scsi_device *sdev) { struct rdac_controller *ctlr, *tmp; @@ -378,7 +379,8 @@ static struct rdac_controller *get_controller(int index, char *array_name, list_for_each_entry(tmp, &ctlr_list, node) { if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) && - (tmp->index == index)) { + (tmp->index == index) && + (tmp->host == sdev->host)) { kref_get(&tmp->kref); spin_unlock(&list_lock); return tmp; @@ -391,6 +393,7 @@ static struct rdac_controller *get_controller(int index, char *array_name, /* initialize fields of controller */ memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN); ctlr->index = index; + ctlr->host = sdev->host; memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN); kref_init(&ctlr->kref); @@ -513,7 +516,7 @@ static int initialize_controller(struct scsi_device *sdev, index = 0; else index = 1; - h->ctlr = get_controller(index, array_name, array_id); + h->ctlr = get_controller(index, array_name, array_id, sdev); if (!h->ctlr) err = SCSI_DH_RES_TEMP_UNAVAIL; }