nvme_fc: Clean up host fcpio done status handling
As Dan Carpenter pointed out: mixing 16-bit nvme status with 32-bit error status from driver. Corrected comment on fcp request struct status field, and converted done routine to explicitly set nvme status codes for nvme status. Signed-off-by: James Smart <james.smart@broadcom.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
c820ad4cda
commit
62eeacb0e0
|
@ -1147,7 +1147,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
|
||||||
struct nvme_fc_ctrl *ctrl = op->ctrl;
|
struct nvme_fc_ctrl *ctrl = op->ctrl;
|
||||||
struct nvme_fc_queue *queue = op->queue;
|
struct nvme_fc_queue *queue = op->queue;
|
||||||
struct nvme_completion *cqe = &op->rsp_iu.cqe;
|
struct nvme_completion *cqe = &op->rsp_iu.cqe;
|
||||||
u16 status;
|
u16 status = NVME_SC_SUCCESS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WARNING:
|
* WARNING:
|
||||||
|
@ -1183,8 +1183,8 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
|
||||||
|
|
||||||
if (atomic_read(&op->state) == FCPOP_STATE_ABORTED)
|
if (atomic_read(&op->state) == FCPOP_STATE_ABORTED)
|
||||||
status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
|
status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
|
||||||
else
|
else if (freq->status)
|
||||||
status = freq->status;
|
status = NVME_SC_FC_TRANSPORT_ERROR;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the linux implementation, if we have an unsuccesful
|
* For the linux implementation, if we have an unsuccesful
|
||||||
|
@ -1212,7 +1212,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
|
||||||
*/
|
*/
|
||||||
if (freq->transferred_length !=
|
if (freq->transferred_length !=
|
||||||
be32_to_cpu(op->cmd_iu.data_len)) {
|
be32_to_cpu(op->cmd_iu.data_len)) {
|
||||||
status = -EIO;
|
status = NVME_SC_FC_TRANSPORT_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
op->nreq.result.u64 = 0;
|
op->nreq.result.u64 = 0;
|
||||||
|
@ -1229,7 +1229,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
|
||||||
freq->transferred_length ||
|
freq->transferred_length ||
|
||||||
op->rsp_iu.status_code ||
|
op->rsp_iu.status_code ||
|
||||||
op->rqno != le16_to_cpu(cqe->command_id))) {
|
op->rqno != le16_to_cpu(cqe->command_id))) {
|
||||||
status = -EIO;
|
status = NVME_SC_FC_TRANSPORT_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
op->nreq.result = cqe->result;
|
op->nreq.result = cqe->result;
|
||||||
|
@ -1237,7 +1237,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
status = -EIO;
|
status = NVME_SC_FC_TRANSPORT_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1763,7 +1763,7 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
|
||||||
op->fcp_req.io_dir = io_dir;
|
op->fcp_req.io_dir = io_dir;
|
||||||
op->fcp_req.transferred_length = 0;
|
op->fcp_req.transferred_length = 0;
|
||||||
op->fcp_req.rcv_rsplen = 0;
|
op->fcp_req.rcv_rsplen = 0;
|
||||||
op->fcp_req.status = 0;
|
op->fcp_req.status = NVME_SC_SUCCESS;
|
||||||
op->fcp_req.sqid = cpu_to_le16(queue->qnum);
|
op->fcp_req.sqid = cpu_to_le16(queue->qnum);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -137,9 +137,9 @@ enum nvmefc_fcp_datadir {
|
||||||
* transferred. Should equal payload_length on success.
|
* transferred. Should equal payload_length on success.
|
||||||
* @rcv_rsplen: length, in bytes, of the FCP RSP IU received.
|
* @rcv_rsplen: length, in bytes, of the FCP RSP IU received.
|
||||||
* @status: Completion status of the FCP operation. must be 0 upon success,
|
* @status: Completion status of the FCP operation. must be 0 upon success,
|
||||||
* NVME_SC_FC_xxx value upon failure. Note: this is NOT a
|
* negative errno value upon failure (ex: -EIO). Note: this is
|
||||||
* reflection of the NVME CQE completion status. Only the status
|
* NOT a reflection of the NVME CQE completion status. Only the
|
||||||
* of the FCP operation at the NVME-FC level.
|
* status of the FCP operation at the NVME-FC level.
|
||||||
*/
|
*/
|
||||||
struct nvmefc_fcp_req {
|
struct nvmefc_fcp_req {
|
||||||
void *cmdaddr;
|
void *cmdaddr;
|
||||||
|
|
Loading…
Reference in New Issue