diff options
author | Ming Lei <ming.lei@redhat.com> | 2019-07-24 11:48:41 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-08-04 21:41:29 -0600 |
commit | 78ca40724713bd422873cb4ebee86f9f499650f7 (patch) | |
tree | feaeb947cb95a5b57cba870daf71fc84891007b4 /drivers/nvme/host | |
parent | f9934a80f91dba8c7029ba7601459e41ea7770aa (diff) |
nvme: don't abort completed request in nvme_cancel_request
Before aborting in-flight requests, all IO queues and their interrupts
have been shutdown. However, request's completion function may not be
done yet because it can be scheduled to run via IPI.
So don't abort one request if it is marked as completed, otherwise
we may abort one normal completed request.
Cc: Max Gurtovoy <maxg@mellanox.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r-- | drivers/nvme/host/core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8f3fbe5ca937..bcede8c879d1 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -288,6 +288,10 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device, "Cancelling I/O %d", req->tag); + /* don't abort one completed request */ + if (blk_mq_request_completed(req)) + return true; + nvme_req(req)->status = NVME_SC_ABORT_REQ; blk_mq_complete_request_sync(req); return true; |