nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	Vishal Verma <vishal.l.verma@intel.com>,
	 Dave Jiang <dave.jiang@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	linux-block@vger.kernel.org,
	 Linux NVDIMM <nvdimm@lists.linux.dev>
Subject: Re: [PATCH 3/3] block: warn if ->groups is set when calling add_disk
Date: Mon, 20 Sep 2021 16:50:03 -0700	[thread overview]
Message-ID: <CAPcyv4iVL7bevm_MeFnkRK12SkwO4k5aR3-4KOAGMxThmJwOuA@mail.gmail.com> (raw)
In-Reply-To: <20210920072726.1159572-4-hch@lst.de>

On Mon, Sep 20, 2021 at 12:30 AM Christoph Hellwig <hch@lst.de> wrote:
>
> The proper API is to pass the groups to device_add_disk, but the code
> used to also allow groups being set before calling *add_disk.  Warn
> about that but keep the group pointer intact for now so that it can
> be removed again after a grace period.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Fixes: 52b85909f85d ("block: fold register_disk into device_add_disk")
> ---
>  block/genhd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index 7b6e5e1cf9564..409cf608cc5bd 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -439,7 +439,8 @@ int device_add_disk(struct device *parent, struct gendisk *disk,
>         dev_set_uevent_suppress(ddev, 1);
>
>         ddev->parent = parent;
> -       ddev->groups = groups;
> +       if (!WARN_ON_ONCE(ddev->groups))
> +               ddev->groups = groups;

That feels too compact to me, and dev_WARN_ONCE() might save someone a
git blame to look up the reason for the warning:

    dev_WARN_ONCE(parent, ddev->groups, "unexpected pre-populated
attribute group\n");
    if (!ddev->groups)
        ddev->groups = groups;

...but not a deal breaker. Either way you can add:

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

Jens, I'm ok for the final spin of this series to go through block.git
since the referenced commits in Fixes: went that route, just let me
know if you want me to take them.

  parent reply	other threads:[~2021-09-20 23:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  7:27 fix a dax/block device attribute registration regression Christoph Hellwig
2021-09-20  7:27 ` [PATCH 1/3] nvdimm/pmem: fix creating the dax group Christoph Hellwig
2021-09-20 22:52   ` Ira Weiny
2021-09-20 23:09   ` Dan Williams
2021-09-20  7:27 ` [PATCH 2/3] nvdimm/pmem: move dax_attribute_group from dax to pmem Christoph Hellwig
2021-09-20 18:00   ` kernel test robot
2021-09-20 23:29     ` Dan Williams
2021-09-20 22:51   ` Ira Weiny
2021-09-20 23:36     ` Dan Williams
2021-09-20 23:37   ` Dan Williams
2021-09-20  7:27 ` [PATCH 3/3] block: warn if ->groups is set when calling add_disk Christoph Hellwig
2021-09-20 22:52   ` Ira Weiny
2021-09-20 23:50   ` Dan Williams [this message]
2021-09-21  6:32     ` Christoph Hellwig
2021-09-22 17:34 dax_supported() related cleanups v2 Christoph Hellwig
2021-09-22 17:34 ` [PATCH 3/3] block: warn if ->groups is set when calling add_disk Christoph Hellwig
2021-09-22 18:33 fix a dax/block device attribute registration regression Christoph Hellwig
2021-09-22 18:33 ` [PATCH 3/3] block: warn if ->groups is set when calling add_disk 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=CAPcyv4iVL7bevm_MeFnkRK12SkwO4k5aR3-4KOAGMxThmJwOuA@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=axboe@kernel.dk \
    --cc=dave.jiang@intel.com \
    --cc=hch@lst.de \
    --cc=ira.weiny@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    --subject='Re: [PATCH 3/3] block: warn if ->groups is set when calling add_disk' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).