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.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c
index c05dff95bd95..2570f48a69c7 100644
--- a/drivers/scsi/scsi_tgt_lib.c
+++ b/drivers/scsi/scsi_tgt_lib.c
@@ -459,16 +459,6 @@ static struct request *tgt_cmd_hash_lookup(struct request_queue *q, u64 tag)
459 return rq; 459 return rq;
460} 460}
461 461
462static void scsi_tgt_build_sense(unsigned char *sense_buffer, unsigned char key,
463 unsigned char asc, unsigned char asq)
464{
465 sense_buffer[0] = 0x70;
466 sense_buffer[2] = key;
467 sense_buffer[7] = 0xa;
468 sense_buffer[12] = asc;
469 sense_buffer[13] = asq;
470}
471
472int scsi_tgt_kspace_exec(int host_no, int result, u64 tag, 462int scsi_tgt_kspace_exec(int host_no, int result, u64 tag,
473 unsigned long uaddr, u32 len, unsigned long sense_uaddr, 463 unsigned long uaddr, u32 len, unsigned long sense_uaddr,
474 u32 sense_len, u8 rw) 464 u32 sense_len, u8 rw)
@@ -528,12 +518,21 @@ int scsi_tgt_kspace_exec(int host_no, int result, u64 tag,
528 * user-space daemon bugs or OOM 518 * user-space daemon bugs or OOM
529 * TODO: we can do better for OOM. 519 * TODO: we can do better for OOM.
530 */ 520 */
521 struct scsi_tgt_queuedata *qdata;
522 struct list_head *head;
523 unsigned long flags;
524
531 eprintk("cmd %p ret %d uaddr %lx len %d rw %d\n", 525 eprintk("cmd %p ret %d uaddr %lx len %d rw %d\n",
532 cmd, err, uaddr, len, rw); 526 cmd, err, uaddr, len, rw);
533 cmd->result = SAM_STAT_CHECK_CONDITION; 527
534 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); 528 qdata = shost->uspace_req_q->queuedata;
535 scsi_tgt_build_sense(cmd->sense_buffer, 529 head = &qdata->cmd_hash[cmd_hashfn(tcmd->tag)];
536 HARDWARE_ERROR, 0, 0); 530
531 spin_lock_irqsave(&qdata->cmd_hash_lock, flags);
532 list_add(&tcmd->hash_list, head);
533 spin_unlock_irqrestore(&qdata->cmd_hash_lock, flags);
534
535 goto done;
537 } 536 }
538 } 537 }
539 err = scsi_tgt_transfer_response(cmd); 538 err = scsi_tgt_transfer_response(cmd);