stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [GIT PULL for-3.18 13/13] target/iscsi: Fix unsolicited data seq_end_offset calculation
Date: Wed, 11 Oct 2017 00:45:55 +0000	[thread overview]
Message-ID: <20171011004547.8116-14-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171011004547.8116-1-alexander.levin@verizon.com>

From: Varun Prakash <varun@chelsio.com>

[ Upstream commit 4d65491c269729a1e3b375c45e73213f49103d33 ]

In case of unsolicited data for the first sequence
seq_end_offset must be set to minimum of total data length
and FirstBurstLength, so do not add cmd->write_data_done
to the min of total data length and FirstBurstLength.

This patch avoids that with ImmediateData=Yes, InitialR2T=No,
MaxXmitDataSegmentLength < FirstBurstLength that a WRITE command
with IO size above FirstBurstLength triggers sequence error
messages, for example

Set following parameters on target (linux-4.8.12)
ImmediateData = Yes
InitialR2T = No
MaxXmitDataSegmentLength = 8k
FirstBurstLength = 64k

Log in from Open iSCSI initiator and execute
dd if=/dev/zero of=/dev/sdb bs=128k count=1 oflag=direct

Error messages on target
Command ITT: 0x00000035 with Offset: 65536, Length: 8192 outside
of Sequence 73728:131072 while DataSequenceInOrder=Yes.
Command ITT: 0x00000035, received DataSN: 0x00000001 higher than
expected 0x00000000.
Unable to perform within-command recovery while ERL=0.

Signed-off-by: Varun Prakash <varun@chelsio.com>
[ bvanassche: Use min() instead of open-coding it / edited patch description ]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/target/iscsi/iscsi_target_erl0.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
index f900de64e267..b58c97ab1f8e 100644
--- a/drivers/target/iscsi/iscsi_target_erl0.c
+++ b/drivers/target/iscsi/iscsi_target_erl0.c
@@ -45,10 +45,8 @@ void iscsit_set_dataout_sequence_values(
 	 */
 	if (cmd->unsolicited_data) {
 		cmd->seq_start_offset = cmd->write_data_done;
-		cmd->seq_end_offset = (cmd->write_data_done +
-			((cmd->se_cmd.data_length >
-			  conn->sess->sess_ops->FirstBurstLength) ?
-			 conn->sess->sess_ops->FirstBurstLength : cmd->se_cmd.data_length));
+		cmd->seq_end_offset = min(cmd->se_cmd.data_length,
+					conn->sess->sess_ops->FirstBurstLength);
 		return;
 	}
 
-- 
2.11.0

  parent reply	other threads:[~2017-10-11  0:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  0:45 [GIT PULL for-3.18 00/13] Commits for v3.18 LTS Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 01/13] locking/lockdep: Add nest_lock integrity test Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 03/13] irqchip/crossbar: Fix incorrect type of local variables Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 05/13] iio: adc: xilinx: Fix error handling Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 06/13] Btrfs: send, fix failure to rename top level inode due to name collision Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 02/13] watchdog: kempld: fix gcc-4.3 build Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 04/13] netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 07/13] net/mlx4_core: Fix VF overwrite of module param which disables DMFS on new probed PFs Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 08/13] crypto: xts - Add ECB dependency Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 09/13] ocfs2/dlmglue: prepare tracking logic to avoid recursive cluster lock Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 11/13] uapi: fix linux/rds.h userspace compilation errors Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` [GIT PULL for-3.18 10/13] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Levin, Alexander (Sasha Levin)
2017-10-11  0:45 ` Levin, Alexander (Sasha Levin) [this message]
2017-10-11  0:45 ` [GIT PULL for-3.18 12/13] uapi: fix linux/mroute6.h userspace compilation errors Levin, Alexander (Sasha Levin)
2017-10-19 13:27 ` [GIT PULL for-3.18 00/13] Commits for v3.18 LTS gregkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171011004547.8116-14-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).