ISCSI fix broken send logic in iscsi_scsi_async_command

The send logic was completely broken for any cases except
ISCSI_INITIAL_R2T_NO and ISCSI_IMMEDIATE_DATA_YES.
The final flag was set wrong or no data was sent.

It was also broken if the data did not fit into the cmd_pdu as
the consecutive pdus did not have the scsi_cbdata set which
lead to a segfault in iscsi_get_user_out_buffer().

Unfortunately we need to include scsi-lowlevel.h again in iscsi-private.h.
This should be fixed asap by introduction of an iscsi_task struct
to avoid to store iscsi relevant data in the scsi_task.

Signed-off-by: Peter Lieven <pl@kamp.de>

Conflicts:

	lib/iscsi-command.c

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2012-11-27 11:16:38 +01:00
parent b1da7311c4
commit 548bd22f51
2 changed files with 11 additions and 3 deletions

View File

@@ -19,6 +19,8 @@
#include <stdint.h>
#include <time.h>
/* We need this until we have an iscsi_task to get access to the iovector_out */
#include "scsi-lowlevel.h"
#if defined(WIN32)
#include <basetsd.h>
@@ -219,6 +221,8 @@ struct iscsi_pdu {
int written;
struct scsi_task *task; /* Reference to scsi_task to get iov with output data */
struct iscsi_data outdata; /* Header for PDU to send */
uint32_t out_offset; /* Offset into data-out iovector */
uint32_t out_len; /* Amount of data to sent */