mirror of https://gitee.com/openkylin/linux.git
[SCSI] dh_rdac: Associate HBA and storage in rdac_controller to support partitions in storage
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 <sekharan@us.ibm.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
f170c684b5
commit
d685759539
|
@ -158,6 +158,7 @@ struct rdac_controller {
|
||||||
} mode_select;
|
} mode_select;
|
||||||
u8 index;
|
u8 index;
|
||||||
u8 array_name[ARRAY_LABEL_LEN];
|
u8 array_name[ARRAY_LABEL_LEN];
|
||||||
|
struct Scsi_Host *host;
|
||||||
spinlock_t ms_lock;
|
spinlock_t ms_lock;
|
||||||
int ms_queued;
|
int ms_queued;
|
||||||
struct work_struct ms_work;
|
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,
|
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;
|
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) {
|
list_for_each_entry(tmp, &ctlr_list, node) {
|
||||||
if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) &&
|
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);
|
kref_get(&tmp->kref);
|
||||||
spin_unlock(&list_lock);
|
spin_unlock(&list_lock);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -391,6 +393,7 @@ static struct rdac_controller *get_controller(int index, char *array_name,
|
||||||
/* initialize fields of controller */
|
/* initialize fields of controller */
|
||||||
memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN);
|
memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN);
|
||||||
ctlr->index = index;
|
ctlr->index = index;
|
||||||
|
ctlr->host = sdev->host;
|
||||||
memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN);
|
memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN);
|
||||||
|
|
||||||
kref_init(&ctlr->kref);
|
kref_init(&ctlr->kref);
|
||||||
|
@ -513,7 +516,7 @@ static int initialize_controller(struct scsi_device *sdev,
|
||||||
index = 0;
|
index = 0;
|
||||||
else
|
else
|
||||||
index = 1;
|
index = 1;
|
||||||
h->ctlr = get_controller(index, array_name, array_id);
|
h->ctlr = get_controller(index, array_name, array_id, sdev);
|
||||||
if (!h->ctlr)
|
if (!h->ctlr)
|
||||||
err = SCSI_DH_RES_TEMP_UNAVAIL;
|
err = SCSI_DH_RES_TEMP_UNAVAIL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue