[Stgt-devel] [PATCH] iscsi: handle dataout padding

Pete Wyckoff pw
Wed Mar 21 21:37:32 CET 2007


All iscsi segments are padded to 4 bytes.  Do this for dataout
too.  Bug seen on transferring certain sizes.  Also return error
from tx_start to avoid segfault from "initiator bug" cases.

Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
 usr/iscsi/iscsid.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 5be2cce..b22f6a9 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1272,7 +1272,7 @@ found:
 
 	conn->rx_buffer = task->data;
 	conn->rx_buffer += be32_to_cpu(req->offset);
-	conn->rx_size = ntoh24(req->dlength);
+	conn->rx_size = roundup(ntoh24(req->dlength), 4);
 
 	task->offset += ntoh24(req->dlength);
 	task->r2t_count -= ntoh24(req->dlength);
@@ -1495,7 +1495,7 @@ static int iscsi_task_rx_start(struct iscsi_connection *conn)
 		break;
 	}
 
-	return 0;
+	return err;
 }
 
 static int iscsi_scsi_cmd_tx_start(struct iscsi_task *task)
-- 
1.5.0.3




More information about the stgt mailing list