Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcm_loop: Implement target reset

Implement target reset by resetting the transport status.

(nab: Remove unused ret in tcm_loop_target_reset)

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Hannes Reinecke and committed by
Nicholas Bellinger
8f4a1fb0 969871cd

+26
+26
drivers/target/loopback/tcm_loop.c
··· 392 392 return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; 393 393 } 394 394 395 + static int tcm_loop_target_reset(struct scsi_cmnd *sc) 396 + { 397 + struct tcm_loop_hba *tl_hba; 398 + struct tcm_loop_tpg *tl_tpg; 399 + 400 + /* 401 + * Locate the tcm_loop_hba_t pointer 402 + */ 403 + tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); 404 + if (!tl_hba) { 405 + pr_err("Unable to perform device reset without" 406 + " active I_T Nexus\n"); 407 + return FAILED; 408 + } 409 + /* 410 + * Locate the tl_tpg pointer from TargetID in sc->device->id 411 + */ 412 + tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; 413 + if (tl_tpg) { 414 + tl_tpg->tl_transport_status = TCM_TRANSPORT_ONLINE; 415 + return SUCCESS; 416 + } 417 + return FAILED; 418 + } 419 + 395 420 static int tcm_loop_slave_alloc(struct scsi_device *sd) 396 421 { 397 422 set_bit(QUEUE_FLAG_BIDI, &sd->request_queue->queue_flags); ··· 446 421 .change_queue_type = tcm_loop_change_queue_type, 447 422 .eh_abort_handler = tcm_loop_abort_task, 448 423 .eh_device_reset_handler = tcm_loop_device_reset, 424 + .eh_target_reset_handler = tcm_loop_target_reset, 449 425 .can_queue = 1024, 450 426 .this_id = -1, 451 427 .sg_tablesize = 256,