diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-08-16 20:06:41 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-08-17 20:24:11 -0400 |
commit | 74f4cf290918f05b6489aa732dfb08aa5606b9d6 (patch) | |
tree | d41a876e1046dbfbd89ba4a89960d8e52de12887 /drivers/target | |
parent | 1d2a2cd95ee0137a2353d1b5635739c281f27cd4 (diff) |
target: Fix regression bug with handling of zero-length data CDBs
This patch fixes a regression bug with the handling of zero-length
data CDBs within transport_generic_new_cmd() code. The bug was introduced
with the following commit as part of the single task conversion work:
commit 4101f0a89d4eb13f04cb0344d59a335b862ca5f9
Author: Christoph Hellwig <hch@infradead.org>
Date: Tue Apr 24 00:25:03 2012 -0400
target: always allocate a single task
where the zero-length check for SCF_SCSI_DATA_SG_IO_CDB was incorrectly
changed to SCF_SCSI_CONTROL_SG_IO_CDB because of the seperate comment
in transport_generic_new_cmd() wrt to control CDBs zero-length handling
introduced in:
commit 91ec1d3535b2acf12c599045cc19ad9be3c6a47b
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Fri Jan 13 12:01:34 2012 -0800
target: Add workaround for zero-length control CDB handling
So go ahead and change transport_generic_new_cmd() to handle control+data
zero-length CDBs in the same manner for this special case.
Tested with iscsi-target + loopback fabric port LUNs on 3.6-rc0 code.
This patch will also need to be picked up for 3.5-stable.
(hch: Add proper comment in transport_generic_new_cmd)
Cc: Christoph Hellwig <hch@lst.de>
Cc: 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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index a7589ccdb6f3..ea9a3d2e4f55 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2323,9 +2323,12 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
2323 | if (ret < 0) | 2323 | if (ret < 0) |
2324 | goto out_fail; | 2324 | goto out_fail; |
2325 | } | 2325 | } |
2326 | 2326 | /* | |
2327 | /* Workaround for handling zero-length control CDBs */ | 2327 | * If this command doesn't have any payload and we don't have to call |
2328 | if (!(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) && !cmd->data_length) { | 2328 | * into the fabric for data transfers, go ahead and complete it right |
2329 | * away. | ||
2330 | */ | ||
2331 | if (!cmd->data_length) { | ||
2329 | spin_lock_irq(&cmd->t_state_lock); | 2332 | spin_lock_irq(&cmd->t_state_lock); |
2330 | cmd->t_state = TRANSPORT_COMPLETE; | 2333 | cmd->t_state = TRANSPORT_COMPLETE; |
2331 | cmd->transport_state |= CMD_T_ACTIVE; | 2334 | cmd->transport_state |= CMD_T_ACTIVE; |