All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Vishal Verma <vishal.l.verma@intel.com>,
	 Dave Jiang <dave.jiang@intel.com>,
	linux-block@vger.kernel.org,
	 Linux NVDIMM <nvdimm@lists.linux.dev>
Subject: Re: [PATCH 2/3] nvdimm/pmem: move dax_attribute_group from dax to pmem
Date: Mon, 20 Sep 2021 16:36:05 -0700	[thread overview]
Message-ID: <CAPcyv4jn=HJRSMKPCFZzHmMoWD2x2EGjWr0O8mB63RFHj_jDvg@mail.gmail.com> (raw)
In-Reply-To: <20210920225125.GY3169279@iweiny-DESK2.sc.intel.com>

On Mon, Sep 20, 2021 at 3:51 PM Ira Weiny <ira.weiny@intel.com> wrote:
>
> On Mon, Sep 20, 2021 at 09:27:25AM +0200, Christoph Hellwig wrote:
>
> ...
>
> > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> > index ef4950f808326..bbeb3f46db157 100644
> > --- a/drivers/nvdimm/pmem.c
> > +++ b/drivers/nvdimm/pmem.c
> > @@ -328,6 +328,49 @@ static const struct dax_operations pmem_dax_ops = {
> >       .zero_page_range = pmem_dax_zero_page_range,
> >  };
> >
> > +static ssize_t write_cache_show(struct device *dev,
> > +             struct device_attribute *attr, char *buf)
> > +{
> > +     struct pmem_device *pmem = dev_to_disk(dev)->private_data;
>
> I want to say this should be dax_get_private()...  However, looking at the use

No, this wants to do from @dev to @dax_dev. dax_get_private() assumes
that @dax_dev is already known. Also, in this case @dev is the gendisk
device, so this is a gendisk-to-dax-device with special knowledge that
the gendisk is for a pmem device.

> of dax_get_private() not a single caller checks for NULL!  :-(

All the callers are correctly assuming that their usage is before kill_dax().

>
> So now I wonder why dax_get_private() exists...  :-/

It exists so that the definition of 'struct dax_device' can remain
private, as no one should be directly mucking with dax_device
internals outside of the provided APIs.

> A quick history search does not make anything apparent.  When the DAXDEV_ALIVE
> check was added to dax_get_private() no callers were changed to account for a
> potential NULL return.
>
> Dan?

I double checked, but this all looks ok to me.

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

Thread overview: 24+ 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 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 18:00     ` kernel test robot
2021-09-20 23:29     ` Dan Williams
2021-09-20 23:29       ` Dan Williams
2021-09-20 23:29       ` Dan Williams
2021-09-20 22:51   ` Ira Weiny
2021-09-20 23:36     ` Dan Williams [this message]
2021-09-20 23:36       ` Dan Williams
2021-09-20 23:37   ` 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
2021-09-20 23:50     ` Dan Williams
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 2/3] nvdimm/pmem: move dax_attribute_group from dax to pmem Christoph Hellwig
2021-09-22 18:33 fix a dax/block device attribute registration regression Christoph Hellwig
2021-09-22 18:33 ` [PATCH 2/3] nvdimm/pmem: move dax_attribute_group from dax to pmem Christoph Hellwig
2021-09-22 21:40   ` Ira Weiny

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='CAPcyv4jn=HJRSMKPCFZzHmMoWD2x2EGjWr0O8mB63RFHj_jDvg@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 \
    /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.