Re: [PATCH] iscsi-target: fix seq_end_offset calculation

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

 



On Fri, Jan 13, 2017 at 11:42:24PM +0530, Bart Van Assche wrote:
> On Fri, 2017-01-13 at 21:15 +0530, Varun Prakash wrote:
> > On Sat, Dec 03, 2016 at 09:14:16PM +0530, Varun Prakash wrote:
> > > Hi Nicholas,
> > > 
> > > On Fri, Sep 16, 2016 at 09:56:38PM +0530, Varun Prakash wrote:
> > > > In case of unsolicited data for the first
> > > > sequence seq_end_offset must be set to
> > > > minimum of firstburstlength and total data length.
> > > > 
> > > > Signed-off-by: Varun Prakash <varun@xxxxxxxxxxx>
> > > > ---
> > > >  drivers/target/iscsi/iscsi_target_erl0.c | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/target/iscsi/iscsi_target_erl0.c
> > > > b/drivers/target/iscsi/iscsi_target_erl0.c
> > > > index b54e72c..98dff74 100644
> > > > --- a/drivers/target/iscsi/iscsi_target_erl0.c
> > > > +++ b/drivers/target/iscsi/iscsi_target_erl0.c
> > > > @@ -44,10 +44,10 @@ 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 >
> > > > +		cmd->seq_end_offset = (cmd->se_cmd.data_length >
> > > >  			  conn->sess->sess_ops->FirstBurstLength) ?
> > > > -			 conn->sess->sess_ops->FirstBurstLength :
> > > > cmd->se_cmd.data_length));
> > > > +			  conn->sess->sess_ops->FirstBurstLength :
> > > > +			  cmd->se_cmd.data_length;
> > > >  		return;
> > > >  	}
> > > > 
> 
> Hello Varun,
> 
> Sorry but this patch looks wrong to me. From the iSCSI RFC: "It is also an
> error for an initiator to send more unsolicited data, whether immediate or
> as separate PDUs, than FirstBurstLength." I think this is why
> iscsit_set_dataout_sequence_values() limits the unsolicited data length to
> FirstBurstLength.

The problem here is that current code adds cmd->write_data_done(immediate
data length) to FirstBurstLength. The value of seq_end_offset for the
first sequence in case of unsolicited can be upto FirstBurstLength,
but current code sets it to cmd->write_data_done + FirstBurstLength
(if total data length > FirstBurstLength), which means it is expecting
immediate data length + FirstBurstLength amount of data in the first sequence.

>From iSCSI RFC https://tools.ietf.org/html/rfc7143#section-13.14

13.14.  FirstBurstLength

FirstBurstLength=<numerical-value-512-to-(2**24 - 1)>

   Default is 65536 (64 KB).
   Result function is Minimum.

   The initiator and target negotiate the maximum amount in bytes of
   unsolicited data an iSCSI initiator may send to the target during the
   execution of a single SCSI command.  This covers the immediate data
   (if any) and the sequence of unsolicited Data-Out PDUs (if any) that
   follow the command.

> 
> > > If I set ImmediateData=Yes, InitialR2T=No, MaxXmitDataSegmentLength <
> > > FirstBurstLength on the target and issue a WRITE cmd (IO size >
> > > FirstBurstLength) from initiator then target prints sequence error
> > > messages, for example
> > > 
> > > Set following parameters on target (linux-4.8.12)
> > > ImmediateData = Yes
> > > InitialR2T = No
> > > MaxXmitDataSegmentLength = 8k
> > > FirstBurstLength = 64k
> 
> Did you set these parameters at the target side or at the initiator side?

This issue is easily reproducible by setting above paramaters on the target.
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux