nvmet_fc: fix better length checking
Reorganize nvmet_fc_handle_fcp_rqst() so that the nvmet req.transfer_len field is set after the call nvmet_req_init(). An update to nvmet now has nvmet_req_init() clearing the field, thus the fc transport was losing the value. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
34d9715ac1
commit
cce75291ff
|
@ -2144,6 +2144,7 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
|
||||||
struct nvmet_fc_fcp_iod *fod)
|
struct nvmet_fc_fcp_iod *fod)
|
||||||
{
|
{
|
||||||
struct nvme_fc_cmd_iu *cmdiu = &fod->cmdiubuf;
|
struct nvme_fc_cmd_iu *cmdiu = &fod->cmdiubuf;
|
||||||
|
u32 xfrlen = be32_to_cpu(cmdiu->data_len);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2157,7 +2158,6 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
|
||||||
|
|
||||||
fod->fcpreq->done = nvmet_fc_xmt_fcp_op_done;
|
fod->fcpreq->done = nvmet_fc_xmt_fcp_op_done;
|
||||||
|
|
||||||
fod->req.transfer_len = be32_to_cpu(cmdiu->data_len);
|
|
||||||
if (cmdiu->flags & FCNVME_CMD_FLAGS_WRITE) {
|
if (cmdiu->flags & FCNVME_CMD_FLAGS_WRITE) {
|
||||||
fod->io_dir = NVMET_FCP_WRITE;
|
fod->io_dir = NVMET_FCP_WRITE;
|
||||||
if (!nvme_is_write(&cmdiu->sqe))
|
if (!nvme_is_write(&cmdiu->sqe))
|
||||||
|
@ -2168,7 +2168,7 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
|
||||||
goto transport_error;
|
goto transport_error;
|
||||||
} else {
|
} else {
|
||||||
fod->io_dir = NVMET_FCP_NODATA;
|
fod->io_dir = NVMET_FCP_NODATA;
|
||||||
if (fod->req.transfer_len)
|
if (xfrlen)
|
||||||
goto transport_error;
|
goto transport_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2192,6 +2192,8 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fod->req.transfer_len = xfrlen;
|
||||||
|
|
||||||
/* keep a running counter of tail position */
|
/* keep a running counter of tail position */
|
||||||
atomic_inc(&fod->queue->sqtail);
|
atomic_inc(&fod->queue->sqtail);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue