All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Joel Granados <j.granados@samsung.com>
Cc: "Kanchan Joshi" <joshi.k@samsung.com>,
	"Christoph Hellwig" <hch@lst.de>,
	kbusch@kernel.org, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, gost.dev@samsung.com,
	k.jensen@samsung.com, "Javier González" <javier.gonz@samsung.com>
Subject: Re: [PATCH 3/5] nvme: refactor namespace probing
Date: Tue, 19 Jul 2022 16:37:03 +0200	[thread overview]
Message-ID: <20220719143703.GA21148@lst.de> (raw)
In-Reply-To: <20220719130048.gkvgei44m3ssqklv@localhost>

On Tue, Jul 19, 2022 at 03:00:48PM +0200, Joel Granados wrote:
> > +++ b/drivers/nvme/host/core.c
> > @@ -2011,8 +2011,10 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
> > 
> >        if (blk_queue_is_zoned(ns->queue)) {
> >                ret = nvme_revalidate_zones(ns);
> > -               if (ret && !nvme_first_scan(ns->disk))
> > +               if (ret && !nvme_first_scan(ns->disk)) {
> > +                       kfree(id);
> >                        return ret;
> > +               }
> >        }
> > 	
> 
> Should we also take care to hide the device?
> As I read it the call to nvme_revalidate_zones can return a -ENODEV
> (through blk_revalidate_disk_zones) which is the original condition to
> hide the block device.

Yes, I think we need something like the patch below folded in.  This
unfreezes before setting the hidden flag and setting the ns ready,
but I can't see why we'd need it frozen for that.

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bbdf0f95331f3..e6025f80744f6 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2012,7 +2012,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	if (blk_queue_is_zoned(ns->queue)) {
 		ret = nvme_revalidate_zones(ns);
 		if (ret && !nvme_first_scan(ns->disk))
-			return ret;
+			goto out_free_id;
 	}
 
 	if (nvme_ns_head_multipath(ns->head)) {
@@ -2029,6 +2029,8 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	return 0;
 
 out_unfreeze:
+	blk_mq_unfreeze_queue(ns->disk->queue);
+out_free_id:
 	/*
 	 * If probing fails due an unsupported feature, hide the block device,
 	 * but still allow other access.
@@ -2038,7 +2040,6 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 		set_bit(NVME_NS_READY, &ns->flags);
 		ret = 0;
 	}
-	blk_mq_unfreeze_queue(ns->disk->queue);
 	kfree(id);
 	return ret;
 }


  reply	other threads:[~2022-07-19 14:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  5:24 enable generic interface (/dev/ngX) for unknown command sets v2 Christoph Hellwig
2022-07-18  5:24 ` [PATCH 1/5] nvme: rename nvme_validate_or_alloc_ns to nvme_scan_ns Christoph Hellwig
2022-07-19 13:07   ` Joel Granados
2022-07-18  5:25 ` [PATCH 2/5] nvme: generalize the nvme_multi_css check in nvme_scan_ns Christoph Hellwig
2022-07-18  5:25 ` [PATCH 3/5] nvme: refactor namespace probing Christoph Hellwig
2022-07-19  7:08   ` Kanchan Joshi
2022-07-19 13:00     ` Joel Granados
2022-07-19 14:37       ` Christoph Hellwig [this message]
2022-07-20  8:11         ` Joel Granados
2022-07-20  8:19   ` Joel Granados
2022-07-20  9:02     ` Christoph Hellwig
2022-07-20 12:15       ` Joel Granados
2022-07-18  5:25 ` [PATCH 4/5] nvme: factor out a nvme_ns_is_readonly helper Christoph Hellwig
2022-07-18  5:25 ` [PATCH 5/5] nvme: enable generic interface (/dev/ngXnY) for unknown command sets Christoph Hellwig
2022-07-21 22:14 ` enable generic interface (/dev/ngX) for unknown command sets v2 Sagi Grimberg
  -- strict thread matches above, loose matches on Subject: below --
2022-07-13  5:49 enable generic interface (/dev/ngX) for unknown command sets Christoph Hellwig
2022-07-13  5:49 ` [PATCH 3/5] nvme: refactor namespace probing Christoph Hellwig
2022-07-13  9:21   ` Sagi Grimberg
2022-07-13 10:16     ` Christoph Hellwig
2022-07-13 11:29       ` Sagi Grimberg
2022-07-13 10:17   ` Kanchan Joshi
2022-07-13 11:27     ` 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=20220719143703.GA21148@lst.de \
    --to=hch@lst.de \
    --cc=gost.dev@samsung.com \
    --cc=j.granados@samsung.com \
    --cc=javier.gonz@samsung.com \
    --cc=joshi.k@samsung.com \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.