Signed-off-by: Saurav Kashyap <saurav.kashyap@xxxxxxxxxx> Signed-off-by: Giridhar Malavali <giridhar.malavali@xxxxxxxxxx> --- drivers/target/target_core_fabric_configfs.c | 28 ++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 7de9f04..f97866e 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c @@ -42,6 +42,7 @@ #include "target_core_internal.h" #include "target_core_alua.h" #include "target_core_pr.h" +#include "target_core_ua.h" #define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \ @@ -326,6 +327,8 @@ static struct config_group *target_fabric_make_mappedlun( char *buf; unsigned long mapped_lun; int ret = 0; + struct se_lun *lun; + int i = 0; acl_ci = &group->cg_item; if (!acl_ci) { @@ -400,6 +403,16 @@ static struct config_group *target_fabric_make_mappedlun( goto out; } target_stat_setup_mappedlun_default_groups(lacl); + spin_lock(&se_tpg->tpg_lun_lock); + for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { + lun = se_tpg->tpg_lun_list[i]; + if (lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) + continue; + spin_unlock(&se_tpg->tpg_lun_lock); + core_scsi3_ua_allocate(se_nacl, lun->unpacked_lun, 0x3f, 0xe); + spin_lock(&se_tpg->tpg_lun_lock); + } + spin_unlock(&se_tpg->tpg_lun_lock); kfree(buf); return &lacl->se_lun_group; @@ -419,6 +432,8 @@ static void target_fabric_drop_mappedlun( struct config_item *df_item; struct config_group *lacl_cg = NULL, *ml_stat_grp = NULL; int i; + struct se_lun *lun; + struct se_portal_group *se_tpg = lacl->se_lun_nacl->se_tpg; ml_stat_grp = &lacl->ml_stat_grps.stat_group; for (i = 0; ml_stat_grp->default_groups[i]; i++) { @@ -437,6 +452,19 @@ static void target_fabric_drop_mappedlun( kfree(lacl_cg->default_groups); config_item_put(item); + + spin_lock(&se_tpg->tpg_lun_lock); + for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { + lun = se_tpg->tpg_lun_list[i]; + if (lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) + continue; + spin_unlock(&se_tpg->tpg_lun_lock); + core_scsi3_ua_allocate(lacl->se_lun_nacl, lun->unpacked_lun, + 0x3f, 0xe); + spin_lock(&se_tpg->tpg_lun_lock); + } + spin_unlock(&se_tpg->tpg_lun_lock); + } static void target_fabric_nacl_base_release(struct config_item *item) -- 1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html