[PATCH 6/7] iscsi-target: Fix iscsit_fe_sendpage_sg breakage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

The patch fixes iscsit_fe_sendpage_sg() to follow iscsit_map_iovec() usage of
cmd->first_data_sg_off for the iSCSI data sequence offset into the first page,
along with individual sg->offset set for SCF_SCSI_CONTROL_NONSG_IO_CDB in
iscsit_alloc_buffs().

It also fixes the padding and DataDigest iovec offsets to use the updated
cmd->iov_data_count in iscsit_allocate_iovecs().

Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/target/iscsi/iscsi_target_util.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index c6219e5..7eeddd2 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1277,12 +1277,11 @@ int iscsit_fe_sendpage_sg(
 	struct iscsi_cmd *cmd,
 	struct iscsi_conn *conn)
 {
-	int tx_sent;
-	u32 tx_hdr_size;
-	u32 data_len;
-	struct kvec iov;
 	struct scatterlist *sg = cmd->first_data_sg;
+	struct kvec iov;
+	u32 tx_hdr_size, data_len;
 	u32 offset = cmd->first_data_sg_off;
+	int tx_sent;
 
 send_hdr:
 	tx_hdr_size = ISCSI_HDR_LEN;
@@ -1313,7 +1312,7 @@ send_hdr:
 		u32 sub_len = min_t(u32, data_len, space);
 send_pg:
 		tx_sent = conn->sock->ops->sendpage(conn->sock,
-						    sg_page(sg), offset, sub_len, 0);
+					sg_page(sg), sg->offset + offset, sub_len, 0);
 		if (tx_sent != sub_len) {
 			if (tx_sent == -EAGAIN) {
 				printk(KERN_ERR "tcp_sendpage() returned"
@@ -1328,13 +1327,13 @@ send_pg:
 
 		data_len -= sub_len;
 		offset = 0;
-		sg++;
+		sg = sg_next(sg);
 	}
 
 send_padding:
 	if (cmd->padding) {
 		struct kvec *iov_p =
-			&cmd->iov_data[cmd->iov_data_count-2];
+			&cmd->iov_data[cmd->iov_data_count-1];
 
 		tx_sent = tx_data(conn, iov_p, 1, cmd->padding);
 		if (cmd->padding != tx_sent) {
@@ -1349,7 +1348,7 @@ send_padding:
 send_datacrc:
 	if (conn->conn_ops->DataDigest) {
 		struct kvec *iov_d =
-			&cmd->iov_data[cmd->iov_data_count-1];
+			&cmd->iov_data[cmd->iov_data_count];
 
 		tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN);
 		if (ISCSI_CRC_LEN != tx_sent) {
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux