From: Keith Busch Date: Fri, 22 May 2015 18:28:31 +0000 (-0600) Subject: NVMe: Fix obtaining command result X-Git-Tag: v4.1.12-92~85^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=59bbb603acbf9bdc54e0d23fb66070ec5804a44a;p=users%2Fjedix%2Flinux-maple.git 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 Cc: Christoph Hellwig Cc: Jens Axboe Fixes: d29ec8241c10 ("nvme: submit internal commands through the block layer") Signed-off-by: Jens Axboe (cherry picked from commit a0a931d6a2c1fbc5d5966ebf0e7a043748692c22 and added missing pieces from d29ec8241c10eacf59c23b3828a88dbae06e7e3f backport) Orabug: 24532912 Signed-off-by: Martin K. Petersen --- diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 48b3ee0913b7d..b3e0a2a57c598 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -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);