Commit 1686a65d authored by Roland Dreier's avatar Roland Dreier Committed by Ben Hutchings

target: Return error to initiator if SET TARGET PORT GROUPS emulation fails

commit 59e4f541 upstream.

The error paths in target_emulate_set_target_port_groups() are all
essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores
rc and always returns success.  This means that even if eg explicit
ALUA is turned off, the initiator will always see a good SCSI status
for SET TARGET PORT GROUPS.

Fix this by returning rc as is intended.  It appears this bug was
added by the following patch:

commit 05d1c7c0
Author: Andy Grover <agrover@redhat.com>
Date:   Wed Jul 20 19:13:28 2011 +0000

    target: Make all control CDBs scatter-gather
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Cc: Andy Grover <agrover@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
[bwh: Backported to 3.2: we have transport_complete_task()
 and not target_complete_cmd()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b9f60ea7
...@@ -352,9 +352,11 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -352,9 +352,11 @@ int target_emulate_set_target_port_groups(struct se_task *task)
out: out:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
if (!rc) {
task->task_scsi_status = GOOD; task->task_scsi_status = GOOD;
transport_complete_task(task, 1); transport_complete_task(task, 1);
return 0; }
return rc;
} }
static inline int core_alua_state_nonoptimized( static inline int core_alua_state_nonoptimized(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment