[stgt] [PATCH] tgtd: fix leak of task_in_scsi flag

Ryusuke Konishi konishi.ryusuke at lab.ntt.co.jp
Mon Mar 17 04:39:01 CET 2014

When target_mgmt_request() function receives unknown or unsupported
task management function code or task was already completed for
ABORT_TASK request, iscsi_tm_execute() and iser_tm_exec() functions
exit without clearing task_in_scsi flag even though scsi command is
not in processing.

This is because the current implementation of target_mgmt_request()
function returns -EINVAL or -EEXIST for the above cases and
iscsi_tm_execute() and iser_tm_exec() do not handle these return

This fixes the issue by changing the return value of
target_mgmt_request() to MGMT_REQ_FAILED for such cases.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke at lab.ntt.co.jp>
 usr/target.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/target.c b/usr/target.c
index b6f324c..0f3066b 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1454,7 +1454,7 @@ enum mgmt_req_result target_mgmt_request(int tid, uint64_t itn_id,
 	if (err)
-		return err;
+		return MGMT_REQ_FAILED;
 	else if (send)
 		return MGMT_REQ_DONE;

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list