All of lore.kernel.org
 help / color / mirror / Atom feed
From: sagig@dev.mellanox.co.il (Sagi Grimberg)
Subject: [PATCH 1/3] nvme: synchronize access to ctrl->namespaces
Date: Thu, 24 Dec 2015 12:36:01 +0200	[thread overview]
Message-ID: <567BCA91.9090709@dev.mellanox.co.il> (raw)
In-Reply-To: <1450952155-8693-2-git-send-email-hch@lst.de>


> Currently traversal and modification of ctrl->namespaces happens completely
> unsynchronized, which can be fixed by the addition of a simple mutex.

Ha yes, I may have seen strange behavior in this area wrt to
deletes and resets.

> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index b82bbea..e4a6868 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c

Umm, I submitted a patch to move these to the core (which you reviewed
:)). I've not seen any negative feedback on it so far.

Jens, are you planning on taking it? and if you do,
Christoph, would you mind rebasing a top of it?

Otherwise,

Looks good,

Reviewed-by: Sagi Grimberg <sagig at mellanox.com>

> @@ -1907,6 +1907,7 @@ static void nvme_freeze_queues(struct nvme_dev *dev)
>   {
>   	struct nvme_ns *ns;
>
> +	mutex_lock(&dev->ctrl.namespaces_mutex);
>   	list_for_each_entry(ns, &dev->ctrl.namespaces, list) {
>   		blk_mq_freeze_queue_start(ns->queue);
>
> @@ -1917,18 +1918,21 @@ static void nvme_freeze_queues(struct nvme_dev *dev)
>   		blk_mq_cancel_requeue_work(ns->queue);
>   		blk_mq_stop_hw_queues(ns->queue);
>   	}
> +	mutex_unlock(&dev->ctrl.namespaces_mutex);
>   }
>
>   static void nvme_unfreeze_queues(struct nvme_dev *dev)
>   {
>   	struct nvme_ns *ns;
>
> +	mutex_lock(&dev->ctrl.namespaces_mutex);
>   	list_for_each_entry(ns, &dev->ctrl.namespaces, list) {
>   		queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue);
>   		blk_mq_unfreeze_queue(ns->queue);
>   		blk_mq_start_stopped_hw_queues(ns->queue, true);
>   		blk_mq_kick_requeue_list(ns->queue);
>   	}
> +	mutex_unlock(&dev->ctrl.namespaces_mutex);
>   }
>
>   static void nvme_dev_shutdown(struct nvme_dev *dev)
>

  reply	other threads:[~2015-12-24 10:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-24 10:15 namespace list locking and ioctl fixes Christoph Hellwig
2015-12-24 10:15 ` [PATCH 1/3] nvme: synchronize access to ctrl->namespaces Christoph Hellwig
2015-12-24 10:36   ` Sagi Grimberg [this message]
2015-12-24 11:08     ` Christoph Hellwig
2015-12-24 10:15 ` [PATCH 2/3] nvme: fixes for NVME_IOCTL_IO_CMD on the char device Christoph Hellwig
2015-12-24 10:37   ` Sagi Grimberg
2015-12-24 10:15 ` [PATCH 3/3] nvme: make SG_IO support optional Christoph Hellwig
2015-12-24 10:39   ` Sagi Grimberg
2015-12-24 11:12     ` Christoph Hellwig
2015-12-24 11:31       ` Sagi Grimberg
2015-12-24 11:40         ` Christoph Hellwig
2015-12-24 15:29           ` Keith Busch
2015-12-24 15:45             ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=567BCA91.9090709@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.