aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-10-12 15:23:39 -0400
committerJens Axboe <axboe@fb.com>2015-10-15 11:04:36 -0400
commit1951feae88c5a39105a704188ccf910faf1d0c50 (patch)
treecf85d3d53b4a69fb2758c48594d4b54bf7ad7223
parent3d42e67fe5ebc1e5c3aae9b1037e38ec99a362cc (diff)
nvme: use an integer value to Linux errno values
Use a separate integer variable to hold the signed Linux errno values we pass back to the block layer. Note that for pass through commands those might still be NVMe values, but those fit into the int as well. Fixes: f4829a9b7a61: ("blk-mq: fix racy updates of rq->errors") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/host/pci.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ad58ee3c3b57..f73c574d59f5 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -606,8 +606,8 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
606 struct nvme_iod *iod = ctx; 606 struct nvme_iod *iod = ctx;
607 struct request *req = iod_get_private(iod); 607 struct request *req = iod_get_private(iod);
608 struct nvme_cmd_info *cmd_rq = blk_mq_rq_to_pdu(req); 608 struct nvme_cmd_info *cmd_rq = blk_mq_rq_to_pdu(req);
609
610 u16 status = le16_to_cpup(&cqe->status) >> 1; 609 u16 status = le16_to_cpup(&cqe->status) >> 1;
610 int error;
611 611
612 if (unlikely(status)) { 612 if (unlikely(status)) {
613 if (!(status & NVME_SC_DNR || blk_noretry_request(req)) 613 if (!(status & NVME_SC_DNR || blk_noretry_request(req))
@@ -624,9 +624,11 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
624 624
625 if (req->cmd_type == REQ_TYPE_DRV_PRIV) { 625 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
626 if (cmd_rq->ctx == CMD_CTX_CANCELLED) 626 if (cmd_rq->ctx == CMD_CTX_CANCELLED)
627 status = -EINTR; 627 error = -EINTR;
628 else
629 error = status;
628 } else { 630 } else {
629 status = nvme_error_status(status); 631 error = nvme_error_status(status);
630 } 632 }
631 } 633 }
632 634
@@ -638,7 +640,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
638 if (cmd_rq->aborted) 640 if (cmd_rq->aborted)
639 dev_warn(nvmeq->dev->dev, 641 dev_warn(nvmeq->dev->dev,
640 "completing aborted command with status:%04x\n", 642 "completing aborted command with status:%04x\n",
641 status); 643 error);
642 644
643 if (iod->nents) { 645 if (iod->nents) {
644 dma_unmap_sg(nvmeq->dev->dev, iod->sg, iod->nents, 646 dma_unmap_sg(nvmeq->dev->dev, iod->sg, iod->nents,
@@ -652,7 +654,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
652 } 654 }
653 nvme_free_iod(nvmeq->dev, iod); 655 nvme_free_iod(nvmeq->dev, iod);
654 656
655 blk_mq_complete_request(req, status); 657 blk_mq_complete_request(req, error);
656} 658}
657 659
658/* length is in bytes. gfp flags indicates whether we may sleep. */ 660/* length is in bytes. gfp flags indicates whether we may sleep. */