From: sagig@dev.mellanox.co.il (Sagi Grimberg)
Subject: [PATCH 2/8] NVMe: Namespace removal simplifications
Date: Thu, 8 Oct 2015 18:47:20 +0300 [thread overview]
Message-ID: <56169008.3000604@dev.mellanox.co.il> (raw)
In-Reply-To: <1443879587-23553-3-git-send-email-hch@lst.de>
On 10/3/2015 4:39 PM, Christoph Hellwig wrote:
> From: Keith Busch <keith.busch at intel.com>
>
> This liberates namespace removal from the device, allowing gendisk
> references to be closed independent of the nvme controller reference
> count.
>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> ---
> drivers/block/nvme-core.c | 42 ++++++++++--------------------------------
> 1 file changed, 10 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index b02ae3d..904b54f 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -1943,6 +1943,7 @@ static int nvme_compat_ioctl(struct block_device *bdev, fmode_t mode,
> #define nvme_compat_ioctl NULL
> #endif
>
> +static void nvme_free_dev(struct kref *kref);
> static void nvme_free_ns(struct kref *kref)
> {
> struct nvme_ns *ns = container_of(kref, struct nvme_ns, kref);
> @@ -1951,6 +1952,7 @@ static void nvme_free_ns(struct kref *kref)
> ns->disk->private_data = NULL;
> spin_unlock(&dev_list_lock);
>
> + kref_put(&ns->dev->kref, nvme_free_dev);
> put_disk(ns->disk);
> kfree(ns);
> }
> @@ -1966,22 +1968,14 @@ static int nvme_open(struct block_device *bdev, fmode_t mode)
> ret = -ENXIO;
> else if (!kref_get_unless_zero(&ns->kref))
> ret = -ENXIO;
> - else if (!kref_get_unless_zero(&ns->dev->kref)) {
> - kref_put(&ns->kref, nvme_free_ns);
> - ret = -ENXIO;
> - }
And this fixes the last patch. I would suggest fixing the former though
for bisect-ability.
next prev parent reply other threads:[~2015-10-08 15:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-03 13:39 nvme reset and probe updates V2 Christoph Hellwig
2015-10-03 13:39 ` [PATCH 1/8] NVMe: Reference count open namespaces Christoph Hellwig
2015-10-08 15:43 ` Sagi Grimberg
2015-10-08 15:47 ` Keith Busch
2015-10-03 13:39 ` [PATCH 2/8] NVMe: Namespace removal simplifications Christoph Hellwig
2015-10-08 15:47 ` Sagi Grimberg [this message]
2015-10-03 13:39 ` [PATCH 3/8] NVMe: Simplify device resume on io queue failure Christoph Hellwig
2015-10-03 13:39 ` [PATCH 4/8] nvme: delete dev from dev_list in nvme_reset Christoph Hellwig
2015-10-03 13:39 ` [PATCH 5/8] nvme: merge nvme_dev_reset into nvme_reset_failed_dev Christoph Hellwig
2015-10-03 13:39 ` [PATCH 6/8] nvme: factor reset code into a common helper Christoph Hellwig
2015-10-03 13:39 ` [PATCH 7/8] nvme: merge nvme_dev_start, nvme_dev_resume and nvme_async_probe Christoph Hellwig
2015-10-03 13:39 ` [PATCH 8/8] nvme: properly handle partially initialized queues in nvme_create_io_queues Christoph Hellwig
2015-10-08 15:52 ` Sagi Grimberg
2015-10-09 6:15 ` Christoph Hellwig
2015-10-09 14:20 ` Keith Busch
2015-10-09 14:39 ` Christoph Hellwig
2015-10-09 16:16 ` Jens Axboe
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=56169008.3000604@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.