aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_tgt_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_tgt_lib.c')
-rw-r--r--drivers/scsi/scsi_tgt_lib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c
index a91761c3645f..deea3cd5bf49 100644
--- a/drivers/scsi/scsi_tgt_lib.c
+++ b/drivers/scsi/scsi_tgt_lib.c
@@ -331,7 +331,7 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd)
331 331
332 scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); 332 scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag);
333 333
334 if (cmd->request_buffer) 334 if (scsi_sglist(cmd))
335 scsi_free_sgtable(cmd); 335 scsi_free_sgtable(cmd);
336 336
337 queue_work(scsi_tgtd, &tcmd->work); 337 queue_work(scsi_tgtd, &tcmd->work);
@@ -365,14 +365,15 @@ static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask)
365 365
366 cmd->request_bufflen = rq->data_len; 366 cmd->request_bufflen = rq->data_len;
367 367
368 dprintk("cmd %p cnt %d %lu\n", cmd, cmd->use_sg, rq_data_dir(rq)); 368 dprintk("cmd %p cnt %d %lu\n", cmd, scsi_sg_count(cmd),
369 count = blk_rq_map_sg(rq->q, rq, cmd->request_buffer); 369 rq_data_dir(rq));
370 if (likely(count <= cmd->use_sg)) { 370 count = blk_rq_map_sg(rq->q, rq, scsi_sglist(cmd));
371 if (likely(count <= scsi_sg_count(cmd))) {
371 cmd->use_sg = count; 372 cmd->use_sg = count;
372 return 0; 373 return 0;
373 } 374 }
374 375
375 eprintk("cmd %p cnt %d\n", cmd, cmd->use_sg); 376 eprintk("cmd %p cnt %d\n", cmd, scsi_sg_count(cmd));
376 scsi_free_sgtable(cmd); 377 scsi_free_sgtable(cmd);
377 return -EINVAL; 378 return -EINVAL;
378} 379}