NVMe: Do not cancel command multiple times
authorKeith Busch <keith.busch@intel.com>
Tue, 30 Apr 2013 17:19:38 +0000 (11:19 -0600)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Fri, 17 May 2013 13:18:38 +0000 (09:18 -0400)
Cancelling an already cancelled command does not do anything, so check
the command context before cancelling it, continuing if had already been
cancelled so we do not log the same problem every second if a device
stops responding.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme-core.c

index d783f15e0fc54ff708fb74c55c5abcfa11ab37d3..42abf72d388440832d38970f3c5a79c4f07c0452 100644 (file)
@@ -978,6 +978,8 @@ static void nvme_cancel_ios(struct nvme_queue *nvmeq, bool timeout)
 
                if (timeout && !time_after(now, info[cmdid].timeout))
                        continue;
+               if (info[cmdid].ctx == CMD_CTX_CANCELLED)
+                       continue;
                dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d\n", cmdid);
                ctx = cancel_cmdid(nvmeq, cmdid, &fn);
                fn(nvmeq->dev, ctx, &cqe);