]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
nvme/core: Fix race kicking freed request_queue
authorKeith Busch <keith.busch@intel.com>
Fri, 10 Feb 2017 23:15:51 +0000 (18:15 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:11:51 +0000 (10:11 +0200)
BugLink: http://bugs.launchpad.net/bugs/1681875
commit f33447b90e96076483525b21cc4e0a8977cdd07c upstream.

If a namespace has already been marked dead, we don't want to kick the
request_queue again since we may have just freed it from another thread.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/nvme/host/core.c

index 344a4a7fdfdd5461f804f257ac78e555bb6268fd..98a5ea074ef87a715e21a2d017556d36f327bc7f 100644 (file)
@@ -2252,9 +2252,9 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
                 * Revalidating a dead namespace sets capacity to 0. This will
                 * end buffered writers dirtying pages that can't be synced.
                 */
-               if (ns->disk && !test_and_set_bit(NVME_NS_DEAD, &ns->flags))
-                       revalidate_disk(ns->disk);
-
+               if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags))
+                       continue;
+               revalidate_disk(ns->disk);
                blk_set_queue_dying(ns->queue);
                blk_mq_abort_requeue_list(ns->queue);
                blk_mq_start_stopped_hw_queues(ns->queue, true);