diff options
Diffstat (limited to 'drivers/target/loopback/tcm_loop.c')
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 5b870c316b9c..b15d8cbf630b 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -290,6 +290,15 @@ static int tcm_loop_queuecommand( | |||
290 | */ | 290 | */ |
291 | tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); | 291 | tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); |
292 | tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; | 292 | tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; |
293 | /* | ||
294 | * Ensure that this tl_tpg reference from the incoming sc->device->id | ||
295 | * has already been configured via tcm_loop_make_naa_tpg(). | ||
296 | */ | ||
297 | if (!tl_tpg->tl_hba) { | ||
298 | set_host_byte(sc, DID_NO_CONNECT); | ||
299 | sc->scsi_done(sc); | ||
300 | return 0; | ||
301 | } | ||
293 | se_tpg = &tl_tpg->tl_se_tpg; | 302 | se_tpg = &tl_tpg->tl_se_tpg; |
294 | /* | 303 | /* |
295 | * Determine the SAM Task Attribute and allocate tl_cmd and | 304 | * Determine the SAM Task Attribute and allocate tl_cmd and |
@@ -1245,6 +1254,9 @@ void tcm_loop_drop_naa_tpg( | |||
1245 | */ | 1254 | */ |
1246 | core_tpg_deregister(se_tpg); | 1255 | core_tpg_deregister(se_tpg); |
1247 | 1256 | ||
1257 | tl_tpg->tl_hba = NULL; | ||
1258 | tl_tpg->tl_tpgt = 0; | ||
1259 | |||
1248 | pr_debug("TCM_Loop_ConfigFS: Deallocated Emulated %s" | 1260 | pr_debug("TCM_Loop_ConfigFS: Deallocated Emulated %s" |
1249 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), | 1261 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), |
1250 | config_item_name(&wwn->wwn_group.cg_item), tpgt); | 1262 | config_item_name(&wwn->wwn_group.cg_item), tpgt); |