diff options
author | Roland Dreier <roland@purestorage.com> | 2012-06-04 23:24:51 -0700 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-06-05 14:20:54 -0700 |
commit | 12e5b94cbda5da548174cda974cc2b71490ecc3f (patch) | |
tree | 2bf2475aa8b1f292e39667674198f8bb717b76d2 | |
parent | b394c78efd3f4a0d9425703dcb1044dcc30c9c4a (diff) | |
download | lio-core-12e5b94cbda5da548174cda974cc2b71490ecc3f.tar.gz |
target: Return error to initiator if SET TARGET PORT GROUPS emulation fails
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_alua.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index e624b836469cdc..91799973081a3d 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c @@ -374,8 +374,9 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd) out: transport_kunmap_data_sg(cmd); - target_complete_cmd(cmd, GOOD); - return 0; + if (!rc) + target_complete_cmd(cmd, GOOD); + return rc; } static inline int core_alua_state_nonoptimized( |