diff --git a/scst/include/scst.h b/scst/include/scst.h index 022b38330..1c9bca356 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2140,7 +2140,7 @@ struct scst_cmd { int *p_orig_sg_cnt; int orig_sg_cnt; struct scatterlist *orig_sg_entry; - int orig_entry_len; + int orig_entry_offs, orig_entry_len; /* Used to retry commands in case of double UA */ int dbl_ua_orig_resp_data_len, dbl_ua_orig_data_direction; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 9a1f34623..3b178c65e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2816,6 +2816,7 @@ static void scst_adjust_sg(struct scst_cmd *cmd, struct scatterlist *sg, cmd->p_orig_sg_cnt = sg_cnt; cmd->orig_sg_cnt = *sg_cnt; cmd->orig_sg_entry = &sg[j]; + cmd->orig_entry_offs = sg[j].offset; cmd->orig_entry_len = sg[j].length; *sg_cnt = (left > 0) ? i+1 : i; sg[j].length = left; @@ -2835,10 +2836,11 @@ static void scst_adjust_sg(struct scst_cmd *cmd, struct scatterlist *sg, */ void scst_restore_sg_buff(struct scst_cmd *cmd) { - TRACE_MEM("cmd %p, sg %p, orig_sg_entry %p, " + TRACE_MEM("cmd %p, sg %p, orig_sg_entry %p, orig_entry_offs %d, " "orig_entry_len %d, orig_sg_cnt %d", cmd, cmd->sg, - cmd->orig_sg_entry, cmd->orig_entry_len, + cmd->orig_sg_entry, cmd->orig_entry_offs, cmd->orig_entry_len, cmd->orig_sg_cnt); + cmd->orig_sg_entry->offset = cmd->orig_entry_offs; cmd->orig_sg_entry->length = cmd->orig_entry_len; *cmd->p_orig_sg_cnt = cmd->orig_sg_cnt; cmd->sg_buff_modified = 0;