aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2015-05-22 14:28:31 -0400
committerJens Axboe <axboe@fb.com>2015-05-22 16:13:32 -0400
commita0a931d6a2c1fbc5d5966ebf0e7a043748692c22 (patch)
tree64e312c46a360afa5d0f1633ad880bc1a6d30833 /drivers/block
parentd29ec8241c10eacf59c23b3828a88dbae06e7e3f (diff)
NVMe: Fix obtaining command result
Replaces req->sense_len usage, which is not owned by the LLD, to req->special to contain the command result for driver created commands, and sets the result unconditionally on completion. Signed-off-by: Keith Busch <keith.busch@intel.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Jens Axboe <axboe@fb.com> Fixes: d29ec8241c10 ("nvme: submit internal commands through the block layer") Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 03bd638e76dd..c42bc53f3765 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -606,13 +606,16 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
606 return; 606 return;
607 } 607 }
608 if (req->cmd_type == REQ_TYPE_DRV_PRIV) { 608 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
609 req->sense_len = le32_to_cpup(&cqe->result);
610 req->errors = status; 609 req->errors = status;
611 } else { 610 } else {
612 req->errors = nvme_error_status(status); 611 req->errors = nvme_error_status(status);
613 } 612 }
614 } else 613 } else
615 req->errors = 0; 614 req->errors = 0;
615 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
616 u32 result = le32_to_cpup(&cqe->result);
617 req->special = (void *)(uintptr_t)result;
618 }
616 619
617 if (cmd_rq->aborted) 620 if (cmd_rq->aborted)
618 dev_warn(nvmeq->dev->dev, 621 dev_warn(nvmeq->dev->dev,
@@ -1015,8 +1018,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
1015 1018
1016 req->cmd = (unsigned char *)cmd; 1019 req->cmd = (unsigned char *)cmd;
1017 req->cmd_len = sizeof(struct nvme_command); 1020 req->cmd_len = sizeof(struct nvme_command);
1018 req->sense = NULL; 1021 req->special = (void *)0;
1019 req->sense_len = 0;
1020 1022
1021 if (buffer && bufflen) { 1023 if (buffer && bufflen) {
1022 ret = blk_rq_map_kern(q, req, buffer, bufflen, __GFP_WAIT); 1024 ret = blk_rq_map_kern(q, req, buffer, bufflen, __GFP_WAIT);
@@ -1033,7 +1035,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
1033 if (bio) 1035 if (bio)
1034 blk_rq_unmap_user(bio); 1036 blk_rq_unmap_user(bio);
1035 if (result) 1037 if (result)
1036 *result = req->sense_len; 1038 *result = (u32)(uintptr_t)req->special;
1037 ret = req->errors; 1039 ret = req->errors;
1038 out: 1040 out:
1039 blk_mq_free_request(req); 1041 blk_mq_free_request(req);