On 01/20/2017 03:14 AM, Varun Prakash wrote: > 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. > > Signed-off-by: Varun Prakash <varun@xxxxxxxxxxx> > --- > drivers/target/iscsi/iscsi_target_erl0.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c > index b54e72c..539e9b5 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 > > - conn->sess->sess_ops->FirstBurstLength) ? > - conn->sess->sess_ops->FirstBurstLength : 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; > return; > } Hello Varun, Sorry but now that I have had some more time to think about this I doubt that the above patch is a correct interpretation of the spec. How about the patch below? Thanks, Bart. From: Varun Prakash <varun@xxxxxxxxxxx> Subject: [PATCH] target/iscsi: Fix seq_end_offset calculation 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. Signed-off-by: Varun Prakash <varun@xxxxxxxxxxx> [ bvanassche: fixed seq_end_offset calculation ] Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> --- drivers/target/iscsi/iscsi_target_erl0.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index b54e72c7ab0f..243326fabf23 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c @@ -44,10 +44,9 @@ 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(conn->sess->sess_ops->FirstBurstLength, + cmd->write_data_done + cmd->se_cmd.data_length); return; } -- 2.11.0 -- 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