From: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> Add multipath initialization during handler attachemnet for DH. Also initialize multipath port group data for scsi_device. Signed-off-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> --- drivers/scsi/device_handler/scsi_dh_alua.c | 15 +++++++++++++++ drivers/scsi/scsi_dh.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 4eb0837298d4..29bd6517a2e3 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -258,6 +258,21 @@ static struct alua_port_group *alua_alloc_pg(struct scsi_device *sdev, return tmp_pg; } + if (scsi_mpath_enabled(sdev)) { + struct scsi_mpath_dh_data *dh_data = sdev->mpath_pg_data; + + dh_data->group_id = pg->group_id; + dh_data->tpgs = pg->tpgs; + dh_data->state = pg->state; + dh_data->valid_states = pg->valid_states; + dh_data->prefrence = pg->pref; + dh_data->is_active = 1; + dh_data->device_id_str = kstrdup(pg->device_id_str, GFP_KERNEL); + dh_data->device_id_len = pg->device_id_len; + + sdev->host->mpath_alua_grpid = pg->group_id; + } + list_add(&pg->node, &port_group_list); spin_unlock(&port_group_lock); diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c index 7b56e00c7df6..d61eddc3c1f8 100644 --- a/drivers/scsi/scsi_dh.c +++ b/drivers/scsi/scsi_dh.c @@ -129,6 +129,9 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev, if (!try_module_get(scsi_dh->module)) return -EINVAL; + if (scsi_mpath_enabled(sdev)) + scsi_multipath_init(sdev); + error = scsi_dh->attach(sdev); if (error != SCSI_DH_OK) { switch (error) { -- 2.41.0.rc2