Skip to content

Commit

Permalink
target: Return error to initiator if SET TARGET PORT GROUPS emulation…
Browse files Browse the repository at this point in the history
… 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 05d1c7c
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>
  • Loading branch information
Roland Dreier authored and Nicholas Bellinger committed Jun 13, 2012
1 parent f2d5d9b commit 59e4f54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/target/target_core_alua.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 59e4f54

Please sign in to comment.