]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
NVMe: Fix obtaining command result
authorKeith Busch <keith.busch@intel.com>
Fri, 22 May 2015 18:28:31 +0000 (12:28 -0600)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 26 Aug 2016 21:15:17 +0000 (14:15 -0700)
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>
(cherry picked from commit a0a931d6a2c1fbc5d5966ebf0e7a043748692c22 and
added missing pieces from d29ec8241c10eacf59c23b3828a88dbae06e7e3f
backport)
Orabug: 24532912
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/nvme/host/pci.c

index 48b3ee0913b7dfba403643a527832bae9a49d068..b3e0a2a57c598eab06b344b64d532a2aaab53aff 100644 (file)
@@ -641,6 +641,11 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
        } else
                req->errors = 0;
 
+       if (req->cmd_type == REQ_TYPE_SPECIAL) {
+               u32 result = le32_to_cpup(&cqe->result);
+               req->special = (void *)(uintptr_t)result;
+       }
+
        if (cmd_rq->aborted)
                dev_warn(nvmeq->dev->dev,
                        "completing aborted command with status:%04x\n",
@@ -1045,8 +1050,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 
        req->cmd = (unsigned char *)cmd;
        req->cmd_len = sizeof(struct nvme_command);
-       req->sense = NULL;
-       req->sense_len = 0;
+       req->special = (void *)0;
 
        if (buffer && bufflen) {
                ret = blk_rq_map_kern(q, req, buffer, bufflen, __GFP_WAIT);
@@ -1063,7 +1067,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
        if (bio)
                blk_rq_unmap_user(bio);
        if (result)
-               *result = req->sense_len;
+               *result = (u32)(uintptr_t)req->special;
        ret = req->errors;
  out:
        blk_mq_free_request(req);