summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-06-04 23:24:51 -0700
committerBen Hutchings <ben@decadent.org.uk>2012-06-19 23:18:24 +0100
commit1686a65dce9c39014e28dc77a9ac9abd1efba48c (patch)
tree05284ba161bca7de9a7fe9f035e046577b5c30c8
parentb9f60ea7bcd215aca12be7989406fd04c43e8adf (diff)
target: Return error to initiator if SET TARGET PORT GROUPS emulation fails
commit 59e4f541baf728dbb426949bfa9f6862387ffd0e 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 05d1c7c0d0db4cc25548d9aadebb416888a82327 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: Roland Dreier <roland@purestorage.com> Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> [bwh: Backported to 3.2: we have transport_complete_task() and not target_complete_cmd()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/target/target_core_alua.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 5b0574484f55..0364ca2d42ec 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -352,9 +352,11 @@ int target_emulate_set_target_port_groups(struct se_task *task)
out:
transport_kunmap_data_sg(cmd);
- task->task_scsi_status = GOOD;
- transport_complete_task(task, 1);
- return 0;
+ if (!rc) {
+ task->task_scsi_status = GOOD;
+ transport_complete_task(task, 1);
+ }
+ return rc;
}
static inline int core_alua_state_nonoptimized(