aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/loopback/tcm_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/loopback/tcm_loop.c')
-rw-r--r--drivers/target/loopback/tcm_loop.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 73ab75ddaf42..6d2f37578b29 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -179,7 +179,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
179 struct tcm_loop_hba *tl_hba; 179 struct tcm_loop_hba *tl_hba;
180 struct tcm_loop_tpg *tl_tpg; 180 struct tcm_loop_tpg *tl_tpg;
181 struct scatterlist *sgl_bidi = NULL; 181 struct scatterlist *sgl_bidi = NULL;
182 u32 sgl_bidi_count = 0; 182 u32 sgl_bidi_count = 0, transfer_length;
183 int rc; 183 int rc;
184 184
185 tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); 185 tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
@@ -213,12 +213,21 @@ static void tcm_loop_submission_work(struct work_struct *work)
213 213
214 } 214 }
215 215
216 if (!scsi_prot_sg_count(sc) && scsi_get_prot_op(sc) != SCSI_PROT_NORMAL) 216 transfer_length = scsi_transfer_length(sc);
217 if (!scsi_prot_sg_count(sc) &&
218 scsi_get_prot_op(sc) != SCSI_PROT_NORMAL) {
217 se_cmd->prot_pto = true; 219 se_cmd->prot_pto = true;
220 /*
221 * loopback transport doesn't support
222 * WRITE_GENERATE, READ_STRIP protection
223 * information operations, go ahead unprotected.
224 */
225 transfer_length = scsi_bufflen(sc);
226 }
218 227
219 rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, 228 rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd,
220 &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, 229 &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun,
221 scsi_bufflen(sc), tcm_loop_sam_attr(sc), 230 transfer_length, tcm_loop_sam_attr(sc),
222 sc->sc_data_direction, 0, 231 sc->sc_data_direction, 0,
223 scsi_sglist(sc), scsi_sg_count(sc), 232 scsi_sglist(sc), scsi_sg_count(sc),
224 sgl_bidi, sgl_bidi_count, 233 sgl_bidi, sgl_bidi_count,