Skip to content

Commit

Permalink
libtcmu: log failed commands when debug is set
Browse files Browse the repository at this point in the history
In debug mode log failed commands.
  • Loading branch information
Mike Christie committed Jun 17, 2018
1 parent 047dfed commit 7617877
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libtcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,11 +1024,15 @@ struct tcmulib_cmd *tcmulib_get_next_command(struct tcmu_device *dev)
return NULL;
}

static int tcmu_sts_to_scsi(int tcmu_sts, uint8_t *sense)
static int tcmu_sts_to_scsi(struct tcmu_device *dev, int tcmu_sts,
uint8_t *sense, uint8_t *cdb)
{
switch (tcmu_sts) {
case TCMU_STS_OK:
if (tcmu_sts == TCMU_STS_OK)
return SAM_STAT_GOOD;

tcmu_dev_dbg(dev, "Completing 0x%x with status %d\n", cdb[0], tcmu_sts);

switch (tcmu_sts) {
case TCMU_STS_NO_RESOURCE:
return SAM_STAT_TASK_SET_FULL;
/*
Expand Down Expand Up @@ -1158,7 +1162,8 @@ void tcmulib_command_complete(
ent->hdr.cmd_id = cmd->cmd_id;
}

ent->rsp.scsi_status = tcmu_sts_to_scsi(result, cmd->sense_buf);
ent->rsp.scsi_status = tcmu_sts_to_scsi(dev, result, cmd->sense_buf,
cmd->cdb);
if (ent->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
memcpy(ent->rsp.sense_buffer, cmd->sense_buf,
TCMU_SENSE_BUFFERSIZE);
Expand Down

0 comments on commit 7617877

Please sign in to comment.