2018-06-26 19:03:37

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v3 0/3] Fix DM DAX handling

This series fixes a few issues that I found with DM's handling of DAX
devices. Here are some of the issues I found:

* We can create a dm-stripe or dm-linear device which is made up of an
fsdax PMEM namespace and a raw PMEM namespace but which can hold a
filesystem mounted with the -o dax mount option. DAX operations to
the raw PMEM namespace part lack struct page and can fail in
interesting/unexpected ways when doing things like fork(), examining
memory with gdb, etc.

* We can create a dm-stripe or dm-linear device which is made up of an
fsdax PMEM namespace and a BRD ramdisk which can hold a filesystem
mounted with the -o dax mount option. All I/O to this filesystem
will fail.

---

Changes since v2:
* Only set QUEUE_FLAG_DAX for fsdax mode PMEM namespaces. (Mike)
* Check for QUEUE_FLAG_DAX in __bdev_dax_supported(). (Mike)
* Get rid of DM_TYPE_DAX_BIO_BASED reworks. (Mike)
* Dropped the first 2 prep patches of v2 since they were merged for
v4.18-rc1. (Thanks, Darrick!)

---

Mike, can you take this series through your tree?

Personally I think this should be treated as a bug fix and merged in the
v4.18-rc* series.

Ross Zwisler (3):
pmem: only set QUEUE_FLAG_DAX for fsdax mode
dax: bdev_dax_supported() check for QUEUE_FLAG_DAX
dm: prevent DAX mounts if not supported

drivers/dax/super.c | 8 ++++++++
drivers/md/dm-ioctl.c | 5 +++++
drivers/md/dm-table.c | 7 +++----
drivers/md/dm.c | 3 +--
drivers/nvdimm/pmem.c | 3 ++-
include/linux/device-mapper.h | 5 +++++
6 files changed, 24 insertions(+), 7 deletions(-)

--
2.14.4



2018-06-26 19:03:08

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v3 3/3] dm: prevent DAX mounts if not supported

Currently device_supports_dax() just checks to see if the QUEUE_FLAG_DAX
flag is set on the device's request queue to decide whether or not the
device supports filesystem DAX. Really we should be using
bdev_dax_supported() like filesystems do at mount time. This performs
other tests like checking to make sure the dax_direct_access() path works.

Conditionally set QUEUE_FLAG_DAX on the DM device's request queue based on
whether all underlying devices support DAX. Now that bdev_dax_supported()
explicitly checks for this flag, this will ensure that filesystems built
upon DM devices will only be able to mount with DAX if all underlying
devices also support DAX.

Signed-off-by: Ross Zwisler <[email protected]>
Fixes: commit 545ed20e6df6 ("dm: add infrastructure for DAX support")
Cc: [email protected]
---
drivers/md/dm-ioctl.c | 5 +++++
drivers/md/dm-table.c | 7 +++----
drivers/md/dm.c | 3 +--
include/linux/device-mapper.h | 5 +++++
4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index b810ea77e6b1..0055bdbee5b1 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1350,6 +1350,11 @@ static int table_load(struct file *filp, struct dm_ioctl *param, size_t param_si
goto err_unlock_md_type;
}

+ if (dm_table_supports_dax(t))
+ blk_queue_flag_set(QUEUE_FLAG_DAX, md->queue);
+ else
+ blk_queue_flag_clear(QUEUE_FLAG_DAX, md->queue);
+
dm_unlock_md_type(md);

/* stage inactive table */
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 938766794c2e..c673b4a51fb2 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -885,12 +885,10 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
{
- struct request_queue *q = bdev_get_queue(dev->bdev);
-
- return q && blk_queue_dax(q);
+ return bdev_dax_supported(dev->bdev, PAGE_SIZE);
}

-static bool dm_table_supports_dax(struct dm_table *t)
+bool dm_table_supports_dax(struct dm_table *t)
{
struct dm_target *ti;
unsigned i;
@@ -909,6 +907,7 @@ static bool dm_table_supports_dax(struct dm_table *t)

return true;
}
+EXPORT_SYMBOL_GPL(dm_table_supports_dax);

static bool dm_table_does_not_support_partial_completion(struct dm_table *t);

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e65429a29c06..bef5a3f243ed 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1056,8 +1056,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,
if (len < 1)
goto out;
nr_pages = min(len, nr_pages);
- if (ti->type->direct_access)
- ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
+ ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);

out:
dm_put_live_table(md, srcu_idx);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 6fb0808e87c8..45ea9e1f9af9 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -461,6 +461,11 @@ void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callback
*/
void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type);

+/*
+ * Check to see if this target type and all table devices support DAX.
+ */
+bool dm_table_supports_dax(struct dm_table *t);
+
/*
* Finally call this to make the table ready for use.
*/
--
2.14.4


2018-06-26 19:04:36

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v3 2/3] dax: bdev_dax_supported() check for QUEUE_FLAG_DAX

Add an explicit check for QUEUE_FLAG_DAX to __bdev_dax_supported(). This
is needed for DM configurations where the first element in the dm-linear or
dm-stripe target supports DAX, but other elements do not. Without this
check __bdev_dax_supported() will pass for such devices, letting a
filesystem on that device mount with the DAX option.

Signed-off-by: Ross Zwisler <[email protected]>
Suggested-by: Mike Snitzer <[email protected]>
Cc: [email protected]
---
drivers/dax/super.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 903d9c473749..45276abf03aa 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -86,6 +86,7 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
{
struct dax_device *dax_dev;
bool dax_enabled = false;
+ struct request_queue *q;
pgoff_t pgoff;
int err, id;
void *kaddr;
@@ -99,6 +100,13 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
return false;
}

+ q = bdev_get_queue(bdev);
+ if (!q || !blk_queue_dax(q)) {
+ pr_debug("%s: error: request queue doesn't support dax\n",
+ bdevname(bdev, buf));
+ return false;
+ }
+
err = bdev_dax_pgoff(bdev, 0, PAGE_SIZE, &pgoff);
if (err) {
pr_debug("%s: error: unaligned partition for dax\n",
--
2.14.4


2018-06-26 19:10:49

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] dm: prevent DAX mounts if not supported

On Tue, Jun 26 2018 at 1:59pm -0400,
Ross Zwisler <[email protected]> wrote:

> Currently device_supports_dax() just checks to see if the QUEUE_FLAG_DAX
> flag is set on the device's request queue to decide whether or not the
> device supports filesystem DAX. Really we should be using
> bdev_dax_supported() like filesystems do at mount time. This performs
> other tests like checking to make sure the dax_direct_access() path works.
>
> Conditionally set QUEUE_FLAG_DAX on the DM device's request queue based on
> whether all underlying devices support DAX. Now that bdev_dax_supported()
> explicitly checks for this flag, this will ensure that filesystems built
> upon DM devices will only be able to mount with DAX if all underlying
> devices also support DAX.
>
> Signed-off-by: Ross Zwisler <[email protected]>
> Fixes: commit 545ed20e6df6 ("dm: add infrastructure for DAX support")
> Cc: [email protected]
> ---
> drivers/md/dm-ioctl.c | 5 +++++
> drivers/md/dm-table.c | 7 +++----
> drivers/md/dm.c | 3 +--
> include/linux/device-mapper.h | 5 +++++
> 4 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
> index b810ea77e6b1..0055bdbee5b1 100644
> --- a/drivers/md/dm-ioctl.c
> +++ b/drivers/md/dm-ioctl.c
> @@ -1350,6 +1350,11 @@ static int table_load(struct file *filp, struct dm_ioctl *param, size_t param_si
> goto err_unlock_md_type;
> }
>
> + if (dm_table_supports_dax(t))
> + blk_queue_flag_set(QUEUE_FLAG_DAX, md->queue);
> + else
> + blk_queue_flag_clear(QUEUE_FLAG_DAX, md->queue);
> +
> dm_unlock_md_type(md);
>
> /* stage inactive table */

This should occur in drivers/md/dm-table.c:dm_table_set_restrictions().
Which already has:
if (dm_table_supports_dax(t))
blk_queue_flag_set(QUEUE_FLAG_DAX, q);

So it just needs tweaking.

> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 938766794c2e..c673b4a51fb2 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -885,12 +885,10 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
> static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
> sector_t start, sector_t len, void *data)
> {
> - struct request_queue *q = bdev_get_queue(dev->bdev);
> -
> - return q && blk_queue_dax(q);
> + return bdev_dax_supported(dev->bdev, PAGE_SIZE);
> }
>
> -static bool dm_table_supports_dax(struct dm_table *t)
> +bool dm_table_supports_dax(struct dm_table *t)
> {
> struct dm_target *ti;
> unsigned i;
> @@ -909,6 +907,7 @@ static bool dm_table_supports_dax(struct dm_table *t)
>
> return true;
> }
> +EXPORT_SYMBOL_GPL(dm_table_supports_dax);
>
> static bool dm_table_does_not_support_partial_completion(struct dm_table *t);
>

Which would mean you don't need to export dm_table_supports_dax().

> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index e65429a29c06..bef5a3f243ed 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -1056,8 +1056,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,
> if (len < 1)
> goto out;
> nr_pages = min(len, nr_pages);
> - if (ti->type->direct_access)
> - ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
> + ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
>
> out:
> dm_put_live_table(md, srcu_idx);
> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
> index 6fb0808e87c8..45ea9e1f9af9 100644
> --- a/include/linux/device-mapper.h
> +++ b/include/linux/device-mapper.h
> @@ -461,6 +461,11 @@ void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callback
> */
> void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type);
>
> +/*
> + * Check to see if this target type and all table devices support DAX.
> + */
> +bool dm_table_supports_dax(struct dm_table *t);
> +
> /*
> * Finally call this to make the table ready for use.
> */

Nor do you need to publish the dm_table_supports_dax() interface via
include/linux/device-mapper.h

2018-06-26 19:19:19

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
<[email protected]> wrote:
> QUEUE_FLAG_DAX is an indication that a given block device supports
> filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> or "sector" modes. These namespaces lack struct page and are prevented
> from participating in filesystem DAX.
>
> Signed-off-by: Ross Zwisler <[email protected]>
> Suggested-by: Mike Snitzer <[email protected]>
> Cc: [email protected]

Why is this cc: stable? What is the user visible impact of this change
especially given the requirement to validate QUEUE_FLAG_DAX with
bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
afaics.

2018-06-26 19:21:49

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Fix DM DAX handling

On Tue, Jun 26 2018 at 1:59pm -0400,
Ross Zwisler <[email protected]> wrote:

> This series fixes a few issues that I found with DM's handling of DAX
> devices. Here are some of the issues I found:
>
> * We can create a dm-stripe or dm-linear device which is made up of an
> fsdax PMEM namespace and a raw PMEM namespace but which can hold a
> filesystem mounted with the -o dax mount option. DAX operations to
> the raw PMEM namespace part lack struct page and can fail in
> interesting/unexpected ways when doing things like fork(), examining
> memory with gdb, etc.
>
> * We can create a dm-stripe or dm-linear device which is made up of an
> fsdax PMEM namespace and a BRD ramdisk which can hold a filesystem
> mounted with the -o dax mount option. All I/O to this filesystem
> will fail.
>
> ---
>
> Changes since v2:
> * Only set QUEUE_FLAG_DAX for fsdax mode PMEM namespaces. (Mike)
> * Check for QUEUE_FLAG_DAX in __bdev_dax_supported(). (Mike)
> * Get rid of DM_TYPE_DAX_BIO_BASED reworks. (Mike)
> * Dropped the first 2 prep patches of v2 since they were merged for
> v4.18-rc1. (Thanks, Darrick!)
>
> ---
>
> Mike, can you take this series through your tree?
>
> Personally I think this should be treated as a bug fix and merged in the
> v4.18-rc* series.

I'd be fine with staging it for 4.18. Only question is whether others
are fine with the dax patch (and me being the one to get it to Linus)?

I already replied to the 3rd patch with some feedback for v4 (but I can
also take care of those changes if I'm the one to stage these changes).

Maybe if Dan and/or others could provide their review for both the dax
and pmem patches? If I can get review on those I'll get the series
staged for Linus to pull this week.

Thanks,
Mike

2018-06-26 19:22:09

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v4 3/3] dm: prevent DAX mounts if not supported

Currently device_supports_dax() just checks to see if the QUEUE_FLAG_DAX
flag is set on the device's request queue to decide whether or not the
device supports filesystem DAX. Really we should be using
bdev_dax_supported() like filesystems do at mount time. This performs
other tests like checking to make sure the dax_direct_access() path works.

Conditionally set QUEUE_FLAG_DAX on the DM device's request queue based on
whether all underlying devices support DAX. Now that bdev_dax_supported()
explicitly checks for this flag, this will ensure that filesystems built
upon DM devices will only be able to mount with DAX if all underlying
devices also support DAX.

Signed-off-by: Ross Zwisler <[email protected]>
Fixes: commit 545ed20e6df6 ("dm: add infrastructure for DAX support")
Cc: [email protected]

---

Changes in v4:
* Set/clear QUEUE_FLAG_DAX in dm_table_set_restrictions(). (Mike)
---
drivers/md/dm-table.c | 7 ++++---
drivers/md/dm.c | 3 +--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 938766794c2e..3d0e2c198f06 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -885,9 +885,7 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
{
- struct request_queue *q = bdev_get_queue(dev->bdev);
-
- return q && blk_queue_dax(q);
+ return bdev_dax_supported(dev->bdev, PAGE_SIZE);
}

static bool dm_table_supports_dax(struct dm_table *t)
@@ -1907,6 +1905,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,

if (dm_table_supports_dax(t))
blk_queue_flag_set(QUEUE_FLAG_DAX, q);
+ else
+ blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
+
if (dm_table_supports_dax_write_cache(t))
dax_write_cache(t->md->dax_dev, true);

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e65429a29c06..bef5a3f243ed 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1056,8 +1056,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,
if (len < 1)
goto out;
nr_pages = min(len, nr_pages);
- if (ti->type->direct_access)
- ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
+ ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);

out:
dm_put_live_table(md, srcu_idx);
--
2.14.4


2018-06-26 19:29:27

by Ross Zwisler

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 02:58:30PM -0400, Mike Snitzer wrote:
> On Tue, Jun 26 2018 at 2:52pm -0400,
> Dan Williams <[email protected]> wrote:
>
> > On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> > <[email protected]> wrote:
> > > QUEUE_FLAG_DAX is an indication that a given block device supports
> > > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> > > or "sector" modes. These namespaces lack struct page and are prevented
> > > from participating in filesystem DAX.
> > >
> > > Signed-off-by: Ross Zwisler <[email protected]>
> > > Suggested-by: Mike Snitzer <[email protected]>
> > > Cc: [email protected]
> >
> > Why is this cc: stable? What is the user visible impact of this change
> > especially given the requirement to validate QUEUE_FLAG_DAX with
> > bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> > afaics.
>
> This isn't cosmetic when you consider that stacking up a DM device is
> looking at this flag to determine whether a table does or does _not_
> support DAX.
>
> So this patch, in conjunction with the other changes in the series, is
> certainly something I'd consider appropriate for stable.
>
> Mike

Because in patch 3 of this series we now use the full bdev_dax_supported()
instead of just checking the queue flag in device_supports_dax(), I agree that
this isn't strictly necessary for stable. device_supports_dax() will still
notice that the raw/sector namespaces don't support DAX because
bdev_dax_supported() will fail, and we'll end up doing the right thing and not
setting QUEUE_FLAG_DAX on the DM device.

I think maybe it's good to have in stable for completeness (and it's a very
small change), but if we drop it from stable the code will still do the right
thing AFAICT.

2018-06-26 19:30:47

by Ross Zwisler

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 12:07:40PM -0700, Dan Williams wrote:
> On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
> > On Tue, Jun 26 2018 at 2:52pm -0400,
> > Dan Williams <[email protected]> wrote:
> >
> >> On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> >> <[email protected]> wrote:
> >> > QUEUE_FLAG_DAX is an indication that a given block device supports
> >> > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> >> > or "sector" modes. These namespaces lack struct page and are prevented
> >> > from participating in filesystem DAX.
> >> >
> >> > Signed-off-by: Ross Zwisler <[email protected]>
> >> > Suggested-by: Mike Snitzer <[email protected]>
> >> > Cc: [email protected]
> >>
> >> Why is this cc: stable? What is the user visible impact of this change
> >> especially given the requirement to validate QUEUE_FLAG_DAX with
> >> bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> >> afaics.
> >
> > This isn't cosmetic when you consider that stacking up a DM device is
> > looking at this flag to determine whether a table does or does _not_
> > support DAX.
> >
> > So this patch, in conjunction with the other changes in the series, is
> > certainly something I'd consider appropriate for stable.
>
> I think this classifies as something that never worked correctly and
> is not a regression. It does not identify which commit it is repairing
> or the user visible failure mode.

Ah, do I need a Fixes: tag for patch 2, then? That one *does* need to go to
stable, I think.

2018-06-26 20:55:22

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, 2018-06-26 at 15:13 -0400, Mike Snitzer wrote:
> On Tue, Jun 26 2018 at 3:07pm -0400,
> Dan Williams <[email protected]> wrote:
>
> > On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
> > > On Tue, Jun 26 2018 at 2:52pm -0400,
> > > Dan Williams <[email protected]> wrote:
> > >
> > > > On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> > > > <[email protected]> wrote:
> > > > > QUEUE_FLAG_DAX is an indication that a given block device supports
> > > > > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> > > > > or "sector" modes. These namespaces lack struct page and are prevented
> > > > > from participating in filesystem DAX.
> > > > >
> > > > > Signed-off-by: Ross Zwisler <[email protected]>
> > > > > Suggested-by: Mike Snitzer <[email protected]>
> > > > > Cc: [email protected]
> > > >
> > > > Why is this cc: stable? What is the user visible impact of this change
> > > > especially given the requirement to validate QUEUE_FLAG_DAX with
> > > > bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> > > > afaics.
> > >
> > > This isn't cosmetic when you consider that stacking up a DM device is
> > > looking at this flag to determine whether a table does or does _not_
> > > support DAX.
> > >
> > > So this patch, in conjunction with the other changes in the series, is
> > > certainly something I'd consider appropriate for stable.
> >
> > I think this classifies as something that never worked correctly and
> > is not a regression. It does not identify which commit it is repairing
> > or the user visible failure mode.
>
> So you're taking issue with making stacked dax configs work in older
> kernels? That's fine. We can drop the stable cc if you like.
>
> But I mean we intended for this to work.. so the Fixes commit references
> can easily be added, e.g.: 545ed20e6df68a4d2584a29a2a28ee8b2f7e9547
> ("dm: add infrastructure for DAX support")

When this dm change was made, the pmem driver supported DAX for both raw
and memory modes (note: sector mode does not use the pmem driver). I
think the issue was introduced when we dropped DAX support from raw
mode.

Thanks,
-Toshi

2018-06-26 21:04:06

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> On Tue, 2018-06-26 at 15:13 -0400, Mike Snitzer wrote:
>> On Tue, Jun 26 2018 at 3:07pm -0400,
>> Dan Williams <[email protected]> wrote:
>>
>> > On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
>> > > On Tue, Jun 26 2018 at 2:52pm -0400,
>> > > Dan Williams <[email protected]> wrote:
>> > >
>> > > > On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
>> > > > <[email protected]> wrote:
>> > > > > QUEUE_FLAG_DAX is an indication that a given block device supports
>> > > > > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
>> > > > > or "sector" modes. These namespaces lack struct page and are prevented
>> > > > > from participating in filesystem DAX.
>> > > > >
>> > > > > Signed-off-by: Ross Zwisler <[email protected]>
>> > > > > Suggested-by: Mike Snitzer <[email protected]>
>> > > > > Cc: [email protected]
>> > > >
>> > > > Why is this cc: stable? What is the user visible impact of this change
>> > > > especially given the requirement to validate QUEUE_FLAG_DAX with
>> > > > bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
>> > > > afaics.
>> > >
>> > > This isn't cosmetic when you consider that stacking up a DM device is
>> > > looking at this flag to determine whether a table does or does _not_
>> > > support DAX.
>> > >
>> > > So this patch, in conjunction with the other changes in the series, is
>> > > certainly something I'd consider appropriate for stable.
>> >
>> > I think this classifies as something that never worked correctly and
>> > is not a regression. It does not identify which commit it is repairing
>> > or the user visible failure mode.
>>
>> So you're taking issue with making stacked dax configs work in older
>> kernels? That's fine. We can drop the stable cc if you like.
>>
>> But I mean we intended for this to work.. so the Fixes commit references
>> can easily be added, e.g.: 545ed20e6df68a4d2584a29a2a28ee8b2f7e9547
>> ("dm: add infrastructure for DAX support")
>
> When this dm change was made, the pmem driver supported DAX for both raw
> and memory modes (note: sector mode does not use the pmem driver). I
> think the issue was introduced when we dropped DAX support from raw
> mode.

Still DAX with raw mode never really worked any way. It was also
something that was broken from day one. So what happens to someone who
happened to avoid all the problems with page-less DAX and enabled
device-mapper on top? That failure mode detail needs to be added to
this changelog if we want to propose this for -stable.

2018-06-26 21:24:36

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> > On Tue, 2018-06-26 at 15:13 -0400, Mike Snitzer wrote:
> > > On Tue, Jun 26 2018 at 3:07pm -0400,
> > > Dan Williams <[email protected]> wrote:
> > >
> > > > On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
> > > > > On Tue, Jun 26 2018 at 2:52pm -0400,
> > > > > Dan Williams <[email protected]> wrote:
> > > > >
> > > > > > On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> > > > > > <[email protected]> wrote:
> > > > > > > QUEUE_FLAG_DAX is an indication that a given block device supports
> > > > > > > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> > > > > > > or "sector" modes. These namespaces lack struct page and are prevented
> > > > > > > from participating in filesystem DAX.
> > > > > > >
> > > > > > > Signed-off-by: Ross Zwisler <[email protected]>
> > > > > > > Suggested-by: Mike Snitzer <[email protected]>
> > > > > > > Cc: [email protected]
> > > > > >
> > > > > > Why is this cc: stable? What is the user visible impact of this change
> > > > > > especially given the requirement to validate QUEUE_FLAG_DAX with
> > > > > > bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> > > > > > afaics.
> > > > >
> > > > > This isn't cosmetic when you consider that stacking up a DM device is
> > > > > looking at this flag to determine whether a table does or does _not_
> > > > > support DAX.
> > > > >
> > > > > So this patch, in conjunction with the other changes in the series, is
> > > > > certainly something I'd consider appropriate for stable.
> > > >
> > > > I think this classifies as something that never worked correctly and
> > > > is not a regression. It does not identify which commit it is repairing
> > > > or the user visible failure mode.
> > >
> > > So you're taking issue with making stacked dax configs work in older
> > > kernels? That's fine. We can drop the stable cc if you like.
> > >
> > > But I mean we intended for this to work.. so the Fixes commit references
> > > can easily be added, e.g.: 545ed20e6df68a4d2584a29a2a28ee8b2f7e9547
> > > ("dm: add infrastructure for DAX support")
> >
> > When this dm change was made, the pmem driver supported DAX for both raw
> > and memory modes (note: sector mode does not use the pmem driver). I
> > think the issue was introduced when we dropped DAX support from raw
> > mode.
>
> Still DAX with raw mode never really worked any way. It was also
> something that was broken from day one. So what happens to someone who
> happened to avoid all the problems with page-less DAX and enabled
> device-mapper on top? That failure mode detail needs to be added to
> this changelog if we want to propose this for -stable.

My point is that the behavior should be consistent between pmem and
device-mapper. When -o dax succeeds on a pmem, then it should succeed
on a device-mapper on top of that pmem.

Has the drop of dax support from raw mode made to -stable back to the
baseline accepted 545ed20e6df6? It will introduce inconsistency,
otherwise.

Thanks,
-Toshi





2018-06-26 21:29:06

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
>> On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
[..]
>> > When this dm change was made, the pmem driver supported DAX for both raw
>> > and memory modes (note: sector mode does not use the pmem driver). I
>> > think the issue was introduced when we dropped DAX support from raw
>> > mode.
>>
>> Still DAX with raw mode never really worked any way. It was also
>> something that was broken from day one. So what happens to someone who
>> happened to avoid all the problems with page-less DAX and enabled
>> device-mapper on top? That failure mode detail needs to be added to
>> this changelog if we want to propose this for -stable.
>
> My point is that the behavior should be consistent between pmem and
> device-mapper. When -o dax succeeds on a pmem, then it should succeed
> on a device-mapper on top of that pmem.
>
> Has the drop of dax support from raw mode made to -stable back to the
> baseline accepted 545ed20e6df6? It will introduce inconsistency,
> otherwise.

That commit, 569d0365f571 "dax: require 'struct page' by default for
filesystem dax", has not been tagged for -stable.

2018-06-26 21:32:04

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
>
> [..]
> > > > When this dm change was made, the pmem driver supported DAX for both raw
> > > > and memory modes (note: sector mode does not use the pmem driver). I
> > > > think the issue was introduced when we dropped DAX support from raw
> > > > mode.
> > >
> > > Still DAX with raw mode never really worked any way. It was also
> > > something that was broken from day one. So what happens to someone who
> > > happened to avoid all the problems with page-less DAX and enabled
> > > device-mapper on top? That failure mode detail needs to be added to
> > > this changelog if we want to propose this for -stable.
> >
> > My point is that the behavior should be consistent between pmem and
> > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> > on a device-mapper on top of that pmem.
> >
> > Has the drop of dax support from raw mode made to -stable back to the
> > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> > otherwise.
>
> That commit, 569d0365f571 "dax: require 'struct page' by default for
> filesystem dax", has not been tagged for -stable.

Then, Fixes tag should be set to 569d0365f571 to keep the behavior
consistent.

-Toshi

2018-06-26 21:52:50

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
>> On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
>> > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
>> > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
>>
>> [..]
>> > > > When this dm change was made, the pmem driver supported DAX for both raw
>> > > > and memory modes (note: sector mode does not use the pmem driver). I
>> > > > think the issue was introduced when we dropped DAX support from raw
>> > > > mode.
>> > >
>> > > Still DAX with raw mode never really worked any way. It was also
>> > > something that was broken from day one. So what happens to someone who
>> > > happened to avoid all the problems with page-less DAX and enabled
>> > > device-mapper on top? That failure mode detail needs to be added to
>> > > this changelog if we want to propose this for -stable.
>> >
>> > My point is that the behavior should be consistent between pmem and
>> > device-mapper. When -o dax succeeds on a pmem, then it should succeed
>> > on a device-mapper on top of that pmem.
>> >
>> > Has the drop of dax support from raw mode made to -stable back to the
>> > baseline accepted 545ed20e6df6? It will introduce inconsistency,
>> > otherwise.
>>
>> That commit, 569d0365f571 "dax: require 'struct page' by default for
>> filesystem dax", has not been tagged for -stable.
>
> Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> consistent.

Sure, and the failure mode is...? I'm thinking the commit log should say:

"Starting with commit 569d0365f571 "dax: require 'struct page' by
default for filesystem dax", dax is no longer supported for page-less
configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
being set and falsely assumes that DAX is enabled, this leads to
<insert user visible failure mode details here>"

2018-06-26 22:45:05

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

QUEUE_FLAG_DAX is an indication that a given block device supports
filesystem DAX and should not be set for PMEM namespaces which are in "raw"
or "sector" modes. These namespaces lack struct page and are prevented
from participating in filesystem DAX.

Signed-off-by: Ross Zwisler <[email protected]>
Suggested-by: Mike Snitzer <[email protected]>
Cc: [email protected]
---
drivers/nvdimm/pmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 68940356cad3..8b1fd7f1a224 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -414,7 +414,8 @@ static int pmem_attach_disk(struct device *dev,
blk_queue_logical_block_size(q, pmem_sector_size(ndns));
blk_queue_max_hw_sectors(q, UINT_MAX);
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
- blk_queue_flag_set(QUEUE_FLAG_DAX, q);
+ if (pmem->pfn_flags & PFN_MAP)
+ blk_queue_flag_set(QUEUE_FLAG_DAX, q);
q->queuedata = pmem;

disk = alloc_disk_node(0, nid);
--
2.14.4


2018-06-27 00:11:39

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26 2018 at 2:52pm -0400,
Dan Williams <[email protected]> wrote:

> On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> <[email protected]> wrote:
> > QUEUE_FLAG_DAX is an indication that a given block device supports
> > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> > or "sector" modes. These namespaces lack struct page and are prevented
> > from participating in filesystem DAX.
> >
> > Signed-off-by: Ross Zwisler <[email protected]>
> > Suggested-by: Mike Snitzer <[email protected]>
> > Cc: [email protected]
>
> Why is this cc: stable? What is the user visible impact of this change
> especially given the requirement to validate QUEUE_FLAG_DAX with
> bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> afaics.

This isn't cosmetic when you consider that stacking up a DM device is
looking at this flag to determine whether a table does or does _not_
support DAX.

So this patch, in conjunction with the other changes in the series, is
certainly something I'd consider appropriate for stable.

Mike

2018-06-27 00:23:29

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
> On Tue, Jun 26 2018 at 2:52pm -0400,
> Dan Williams <[email protected]> wrote:
>
>> On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
>> <[email protected]> wrote:
>> > QUEUE_FLAG_DAX is an indication that a given block device supports
>> > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
>> > or "sector" modes. These namespaces lack struct page and are prevented
>> > from participating in filesystem DAX.
>> >
>> > Signed-off-by: Ross Zwisler <[email protected]>
>> > Suggested-by: Mike Snitzer <[email protected]>
>> > Cc: [email protected]
>>
>> Why is this cc: stable? What is the user visible impact of this change
>> especially given the requirement to validate QUEUE_FLAG_DAX with
>> bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
>> afaics.
>
> This isn't cosmetic when you consider that stacking up a DM device is
> looking at this flag to determine whether a table does or does _not_
> support DAX.
>
> So this patch, in conjunction with the other changes in the series, is
> certainly something I'd consider appropriate for stable.

I think this classifies as something that never worked correctly and
is not a regression. It does not identify which commit it is repairing
or the user visible failure mode.

2018-06-27 00:39:31

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26 2018 at 3:07pm -0400,
Dan Williams <[email protected]> wrote:

> On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
> > On Tue, Jun 26 2018 at 2:52pm -0400,
> > Dan Williams <[email protected]> wrote:
> >
> >> On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
> >> <[email protected]> wrote:
> >> > QUEUE_FLAG_DAX is an indication that a given block device supports
> >> > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
> >> > or "sector" modes. These namespaces lack struct page and are prevented
> >> > from participating in filesystem DAX.
> >> >
> >> > Signed-off-by: Ross Zwisler <[email protected]>
> >> > Suggested-by: Mike Snitzer <[email protected]>
> >> > Cc: [email protected]
> >>
> >> Why is this cc: stable? What is the user visible impact of this change
> >> especially given the requirement to validate QUEUE_FLAG_DAX with
> >> bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
> >> afaics.
> >
> > This isn't cosmetic when you consider that stacking up a DM device is
> > looking at this flag to determine whether a table does or does _not_
> > support DAX.
> >
> > So this patch, in conjunction with the other changes in the series, is
> > certainly something I'd consider appropriate for stable.
>
> I think this classifies as something that never worked correctly and
> is not a regression. It does not identify which commit it is repairing
> or the user visible failure mode.

So you're taking issue with making stacked dax configs work in older
kernels? That's fine. We can drop the stable cc if you like.

But I mean we intended for this to work.. so the Fixes commit references
can easily be added, e.g.: 545ed20e6df68a4d2584a29a2a28ee8b2f7e9547
("dm: add infrastructure for DAX support")

2018-06-27 00:41:50

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 12:13 PM, Mike Snitzer <[email protected]> wrote:
> On Tue, Jun 26 2018 at 3:07pm -0400,
> Dan Williams <[email protected]> wrote:
>
>> On Tue, Jun 26, 2018 at 11:58 AM, Mike Snitzer <[email protected]> wrote:
>> > On Tue, Jun 26 2018 at 2:52pm -0400,
>> > Dan Williams <[email protected]> wrote:
>> >
>> >> On Tue, Jun 26, 2018 at 10:59 AM, Ross Zwisler
>> >> <[email protected]> wrote:
>> >> > QUEUE_FLAG_DAX is an indication that a given block device supports
>> >> > filesystem DAX and should not be set for PMEM namespaces which are in "raw"
>> >> > or "sector" modes. These namespaces lack struct page and are prevented
>> >> > from participating in filesystem DAX.
>> >> >
>> >> > Signed-off-by: Ross Zwisler <[email protected]>
>> >> > Suggested-by: Mike Snitzer <[email protected]>
>> >> > Cc: [email protected]
>> >>
>> >> Why is this cc: stable? What is the user visible impact of this change
>> >> especially given the requirement to validate QUEUE_FLAG_DAX with
>> >> bdev_dax_supported()? Patch looks good, but it's just a cosmetic fixup
>> >> afaics.
>> >
>> > This isn't cosmetic when you consider that stacking up a DM device is
>> > looking at this flag to determine whether a table does or does _not_
>> > support DAX.
>> >
>> > So this patch, in conjunction with the other changes in the series, is
>> > certainly something I'd consider appropriate for stable.
>>
>> I think this classifies as something that never worked correctly and
>> is not a regression. It does not identify which commit it is repairing
>> or the user visible failure mode.
>
> So you're taking issue with making stacked dax configs work in older
> kernels? That's fine. We can drop the stable cc if you like.
>
> But I mean we intended for this to work.. so the Fixes commit references
> can easily be added, e.g.: 545ed20e6df68a4d2584a29a2a28ee8b2f7e9547
> ("dm: add infrastructure for DAX support")

...but to be clear stacked DAX configs are not broken, right? They
just happen not to work in this corner case of pmem devices without
pages. Given we dropped DAX support for page less devices what
configurations are repaired by this change? Am I missing something? Is
it a data corruption scenario if this DM gets the wrong idea about DAX
support. I could be convinced to recommend this for -stable, but the
changelog as written does not make a strong case.

2018-06-27 01:37:00

by Ross Zwisler

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> >> On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> >> > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> >> > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> >>
> >> [..]
> >> > > > When this dm change was made, the pmem driver supported DAX for both raw
> >> > > > and memory modes (note: sector mode does not use the pmem driver). I
> >> > > > think the issue was introduced when we dropped DAX support from raw
> >> > > > mode.
> >> > >
> >> > > Still DAX with raw mode never really worked any way. It was also
> >> > > something that was broken from day one. So what happens to someone who
> >> > > happened to avoid all the problems with page-less DAX and enabled
> >> > > device-mapper on top? That failure mode detail needs to be added to
> >> > > this changelog if we want to propose this for -stable.
> >> >
> >> > My point is that the behavior should be consistent between pmem and
> >> > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> >> > on a device-mapper on top of that pmem.
> >> >
> >> > Has the drop of dax support from raw mode made to -stable back to the
> >> > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> >> > otherwise.
> >>
> >> That commit, 569d0365f571 "dax: require 'struct page' by default for
> >> filesystem dax", has not been tagged for -stable.
> >
> > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> > consistent.
>
> Sure, and the failure mode is...? I'm thinking the commit log should say:
>
> "Starting with commit 569d0365f571 "dax: require 'struct page' by
> default for filesystem dax", dax is no longer supported for page-less
> configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
> being set and falsely assumes that DAX is enabled, this leads to
> <insert user visible failure mode details here>"

Dan is correct that there is no user visible change for this. It is the right
thing to do for consistency and sanity, but it doesn't actually have user
visible behavior that needs to be backported to stable.

Toshi is correct that this change is only for raw mode namespaces, not btt
namespaces.

I'll adjust the changelog and remove the stable flag for v5, and I'll add a
Fixes: tag for patch 2.

2018-06-28 19:36:25

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
> On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> > > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> > > > On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> > > > > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> > > > > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> > > >
> > > > [..]
> > > > > > > When this dm change was made, the pmem driver supported DAX for both raw
> > > > > > > and memory modes (note: sector mode does not use the pmem driver). I
> > > > > > > think the issue was introduced when we dropped DAX support from raw
> > > > > > > mode.
> > > > > >
> > > > > > Still DAX with raw mode never really worked any way. It was also
> > > > > > something that was broken from day one. So what happens to someone who
> > > > > > happened to avoid all the problems with page-less DAX and enabled
> > > > > > device-mapper on top? That failure mode detail needs to be added to
> > > > > > this changelog if we want to propose this for -stable.
> > > > >
> > > > > My point is that the behavior should be consistent between pmem and
> > > > > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> > > > > on a device-mapper on top of that pmem.
> > > > >
> > > > > Has the drop of dax support from raw mode made to -stable back to the
> > > > > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> > > > > otherwise.
> > > >
> > > > That commit, 569d0365f571 "dax: require 'struct page' by default for
> > > > filesystem dax", has not been tagged for -stable.
> > >
> > > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> > > consistent.
> >
> > Sure, and the failure mode is...? I'm thinking the commit log should say:
> >
> > "Starting with commit 569d0365f571 "dax: require 'struct page' by
> > default for filesystem dax", dax is no longer supported for page-less
> > configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
> > being set and falsely assumes that DAX is enabled, this leads to
> > <insert user visible failure mode details here>"
>
> Dan is correct that there is no user visible change for this. It is the right
> thing to do for consistency and sanity, but it doesn't actually have user
> visible behavior that needs to be backported to stable.
>
> Toshi is correct that this change is only for raw mode namespaces, not btt
> namespaces.
>
> I'll adjust the changelog and remove the stable flag for v5, and I'll add a
> Fixes: tag for patch 2.

Hi Ross,

Your patches look good. But I am still not clear about the Fixes &
stable handling. Talking about user visible behavior, I do not think we
had any issue until dax support was dropped from raw mode. Until then,
the pmem driver supported dax for all modes, and the check for
direct_access worked.

Thanks,
-Toshi

2018-06-28 19:36:31

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Thu, Jun 28, 2018 at 10:48 AM, Mike Snitzer <[email protected]> wrote:
> On Thu, Jun 28 2018 at 1:42pm -0400,
> Kani, Toshi <[email protected]> wrote:
>
>> On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
>> > On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
>> > > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
>> > > > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
>> > > > > On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
>> > > > > > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
>> > > > > > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
>> > > > >
>> > > > > [..]
>> > > > > > > > When this dm change was made, the pmem driver supported DAX for both raw
>> > > > > > > > and memory modes (note: sector mode does not use the pmem driver). I
>> > > > > > > > think the issue was introduced when we dropped DAX support from raw
>> > > > > > > > mode.
>> > > > > > >
>> > > > > > > Still DAX with raw mode never really worked any way. It was also
>> > > > > > > something that was broken from day one. So what happens to someone who
>> > > > > > > happened to avoid all the problems with page-less DAX and enabled
>> > > > > > > device-mapper on top? That failure mode detail needs to be added to
>> > > > > > > this changelog if we want to propose this for -stable.
>> > > > > >
>> > > > > > My point is that the behavior should be consistent between pmem and
>> > > > > > device-mapper. When -o dax succeeds on a pmem, then it should succeed
>> > > > > > on a device-mapper on top of that pmem.
>> > > > > >
>> > > > > > Has the drop of dax support from raw mode made to -stable back to the
>> > > > > > baseline accepted 545ed20e6df6? It will introduce inconsistency,
>> > > > > > otherwise.
>> > > > >
>> > > > > That commit, 569d0365f571 "dax: require 'struct page' by default for
>> > > > > filesystem dax", has not been tagged for -stable.
>> > > >
>> > > > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
>> > > > consistent.
>> > >
>> > > Sure, and the failure mode is...? I'm thinking the commit log should say:
>> > >
>> > > "Starting with commit 569d0365f571 "dax: require 'struct page' by
>> > > default for filesystem dax", dax is no longer supported for page-less
>> > > configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
>> > > being set and falsely assumes that DAX is enabled, this leads to
>> > > <insert user visible failure mode details here>"
>> >
>> > Dan is correct that there is no user visible change for this. It is the right
>> > thing to do for consistency and sanity, but it doesn't actually have user
>> > visible behavior that needs to be backported to stable.
>> >
>> > Toshi is correct that this change is only for raw mode namespaces, not btt
>> > namespaces.
>> >
>> > I'll adjust the changelog and remove the stable flag for v5, and I'll add a
>> > Fixes: tag for patch 2.
>>
>> Hi Ross,
>>
>> Your patches look good. But I am still not clear about the Fixes &
>> stable handling. Talking about user visible behavior, I do not think we
>> had any issue until dax support was dropped from raw mode. Until then,
>> the pmem driver supported dax for all modes, and the check for
>> direct_access worked.
>
> I've staged the changes to send to Linus shortly.
>
> The first patch has:
>
> Fixes: 569d0365f571 ("dax: require 'struct page' by default for filesystem dax")
> Cc: [email protected]
>
> As that is the right thing to do given the other 2 patches are marked
> for stable. We don't want to have a stable kernel with the last 2
> patches but not the first.

Ok, I'm still grumbling about the changelog being more clear about
what the problem was, but let's just go with what you got.

2018-06-28 19:37:55

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Thu, 2018-06-28 at 13:48 -0400, Mike Snitzer wrote:
> On Thu, Jun 28 2018 at 1:42pm -0400,
> Kani, Toshi <[email protected]> wrote:
>
> > On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
> > > On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> > > > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> > > > > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> > > > > > On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> > > > > > > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> > > > > > > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> > > > > >
> > > > > > [..]
> > > > > > > > > When this dm change was made, the pmem driver supported DAX for both raw
> > > > > > > > > and memory modes (note: sector mode does not use the pmem driver). I
> > > > > > > > > think the issue was introduced when we dropped DAX support from raw
> > > > > > > > > mode.
> > > > > > > >
> > > > > > > > Still DAX with raw mode never really worked any way. It was also
> > > > > > > > something that was broken from day one. So what happens to someone who
> > > > > > > > happened to avoid all the problems with page-less DAX and enabled
> > > > > > > > device-mapper on top? That failure mode detail needs to be added to
> > > > > > > > this changelog if we want to propose this for -stable.
> > > > > > >
> > > > > > > My point is that the behavior should be consistent between pmem and
> > > > > > > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> > > > > > > on a device-mapper on top of that pmem.
> > > > > > >
> > > > > > > Has the drop of dax support from raw mode made to -stable back to the
> > > > > > > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> > > > > > > otherwise.
> > > > > >
> > > > > > That commit, 569d0365f571 "dax: require 'struct page' by default for
> > > > > > filesystem dax", has not been tagged for -stable.
> > > > >
> > > > > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> > > > > consistent.
> > > >
> > > > Sure, and the failure mode is...? I'm thinking the commit log should say:
> > > >
> > > > "Starting with commit 569d0365f571 "dax: require 'struct page' by
> > > > default for filesystem dax", dax is no longer supported for page-less
> > > > configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
> > > > being set and falsely assumes that DAX is enabled, this leads to
> > > > <insert user visible failure mode details here>"
> > >
> > > Dan is correct that there is no user visible change for this. It is the right
> > > thing to do for consistency and sanity, but it doesn't actually have user
> > > visible behavior that needs to be backported to stable.
> > >
> > > Toshi is correct that this change is only for raw mode namespaces, not btt
> > > namespaces.
> > >
> > > I'll adjust the changelog and remove the stable flag for v5, and I'll add a
> > > Fixes: tag for patch 2.
> >
> > Hi Ross,
> >
> > Your patches look good. But I am still not clear about the Fixes &
> > stable handling. Talking about user visible behavior, I do not think we
> > had any issue until dax support was dropped from raw mode. Until then,
> > the pmem driver supported dax for all modes, and the check for
> > direct_access worked.
>
> I've staged the changes to send to Linus shortly.
>
> The first patch has:
>
> Fixes: 569d0365f571 ("dax: require 'struct page' by default for filesystem dax")
> Cc: [email protected]
>
> As that is the right thing to do given the other 2 patches are marked
> for stable. We don't want to have a stable kernel with the last 2
> patches but not the first.

Agreed.

Technically, all 3 patches may have "Fixes: 569d0365f571 dax..", but I
think having "Fixes 545ed20e6df6 dm.." for patch 2 & 3 provide a
protection in case 569d0365f571 gets backported in future.

For the series:
Reviewed-by: Toshi Kani <[email protected]>

Thanks,
-Toshi

2018-06-28 19:39:29

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Thu, Jun 28 2018 at 1:42pm -0400,
Kani, Toshi <[email protected]> wrote:

> On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
> > On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> > > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> > > > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> > > > > On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> > > > > > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> > > > > > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> > > > >
> > > > > [..]
> > > > > > > > When this dm change was made, the pmem driver supported DAX for both raw
> > > > > > > > and memory modes (note: sector mode does not use the pmem driver). I
> > > > > > > > think the issue was introduced when we dropped DAX support from raw
> > > > > > > > mode.
> > > > > > >
> > > > > > > Still DAX with raw mode never really worked any way. It was also
> > > > > > > something that was broken from day one. So what happens to someone who
> > > > > > > happened to avoid all the problems with page-less DAX and enabled
> > > > > > > device-mapper on top? That failure mode detail needs to be added to
> > > > > > > this changelog if we want to propose this for -stable.
> > > > > >
> > > > > > My point is that the behavior should be consistent between pmem and
> > > > > > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> > > > > > on a device-mapper on top of that pmem.
> > > > > >
> > > > > > Has the drop of dax support from raw mode made to -stable back to the
> > > > > > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> > > > > > otherwise.
> > > > >
> > > > > That commit, 569d0365f571 "dax: require 'struct page' by default for
> > > > > filesystem dax", has not been tagged for -stable.
> > > >
> > > > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> > > > consistent.
> > >
> > > Sure, and the failure mode is...? I'm thinking the commit log should say:
> > >
> > > "Starting with commit 569d0365f571 "dax: require 'struct page' by
> > > default for filesystem dax", dax is no longer supported for page-less
> > > configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
> > > being set and falsely assumes that DAX is enabled, this leads to
> > > <insert user visible failure mode details here>"
> >
> > Dan is correct that there is no user visible change for this. It is the right
> > thing to do for consistency and sanity, but it doesn't actually have user
> > visible behavior that needs to be backported to stable.
> >
> > Toshi is correct that this change is only for raw mode namespaces, not btt
> > namespaces.
> >
> > I'll adjust the changelog and remove the stable flag for v5, and I'll add a
> > Fixes: tag for patch 2.
>
> Hi Ross,
>
> Your patches look good. But I am still not clear about the Fixes &
> stable handling. Talking about user visible behavior, I do not think we
> had any issue until dax support was dropped from raw mode. Until then,
> the pmem driver supported dax for all modes, and the check for
> direct_access worked.

I've staged the changes to send to Linus shortly.

The first patch has:

Fixes: 569d0365f571 ("dax: require 'struct page' by default for filesystem dax")
Cc: [email protected]

As that is the right thing to do given the other 2 patches are marked
for stable. We don't want to have a stable kernel with the last 2
patches but not the first.

Mike

2018-06-28 20:22:06

by Ross Zwisler

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Thu, Jun 28, 2018 at 05:42:34PM +0000, Kani, Toshi wrote:
> On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
> > On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> > > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
> > > > On Tue, 2018-06-26 at 14:28 -0700, Dan Williams wrote:
> > > > > On Tue, Jun 26, 2018 at 2:23 PM, Kani, Toshi <[email protected]> wrote:
> > > > > > On Tue, 2018-06-26 at 14:02 -0700, Dan Williams wrote:
> > > > > > > On Tue, Jun 26, 2018 at 1:54 PM, Kani, Toshi <[email protected]> wrote:
> > > > >
> > > > > [..]
> > > > > > > > When this dm change was made, the pmem driver supported DAX for both raw
> > > > > > > > and memory modes (note: sector mode does not use the pmem driver). I
> > > > > > > > think the issue was introduced when we dropped DAX support from raw
> > > > > > > > mode.
> > > > > > >
> > > > > > > Still DAX with raw mode never really worked any way. It was also
> > > > > > > something that was broken from day one. So what happens to someone who
> > > > > > > happened to avoid all the problems with page-less DAX and enabled
> > > > > > > device-mapper on top? That failure mode detail needs to be added to
> > > > > > > this changelog if we want to propose this for -stable.
> > > > > >
> > > > > > My point is that the behavior should be consistent between pmem and
> > > > > > device-mapper. When -o dax succeeds on a pmem, then it should succeed
> > > > > > on a device-mapper on top of that pmem.
> > > > > >
> > > > > > Has the drop of dax support from raw mode made to -stable back to the
> > > > > > baseline accepted 545ed20e6df6? It will introduce inconsistency,
> > > > > > otherwise.
> > > > >
> > > > > That commit, 569d0365f571 "dax: require 'struct page' by default for
> > > > > filesystem dax", has not been tagged for -stable.
> > > >
> > > > Then, Fixes tag should be set to 569d0365f571 to keep the behavior
> > > > consistent.
> > >
> > > Sure, and the failure mode is...? I'm thinking the commit log should say:
> > >
> > > "Starting with commit 569d0365f571 "dax: require 'struct page' by
> > > default for filesystem dax", dax is no longer supported for page-less
> > > configurations. However, device-mapper sees the QUEUE_FLAG_DAX still
> > > being set and falsely assumes that DAX is enabled, this leads to
> > > <insert user visible failure mode details here>"
> >
> > Dan is correct that there is no user visible change for this. It is the right
> > thing to do for consistency and sanity, but it doesn't actually have user
> > visible behavior that needs to be backported to stable.
> >
> > Toshi is correct that this change is only for raw mode namespaces, not btt
> > namespaces.
> >
> > I'll adjust the changelog and remove the stable flag for v5, and I'll add a
> > Fixes: tag for patch 2.
>
> Hi Ross,
>
> Your patches look good. But I am still not clear about the Fixes &
> stable handling. Talking about user visible behavior, I do not think we
> had any issue until dax support was dropped from raw mode. Until then,
> the pmem driver supported dax for all modes, and the check for
> direct_access worked.

I agree that the fsdax + raw mode failure mode I mentioned in my cover letter
only started when we restricted filesystem DAX to having struct page, but I
think that the other failure mode, fsdax + some random block driver (I used
brd) was present in DM from the beginning.

In any case, I think both are fixed with the patches, and I think it's fine
that all 3 get thrown at stable. Thanks, Mike, for the help.

2018-06-29 04:32:00

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode

On Thu, 2018-06-28 at 13:04 -0600, Ross Zwisler wrote:
> On Thu, Jun 28, 2018 at 05:42:34PM +0000, Kani, Toshi wrote:
> > On Tue, 2018-06-26 at 16:04 -0600, Ross Zwisler wrote:
> > > On Tue, Jun 26, 2018 at 02:51:52PM -0700, Dan Williams wrote:
> > > > On Tue, Jun 26, 2018 at 2:31 PM, Kani, Toshi <[email protected]> wrote:
:
> > Your patches look good. But I am still not clear about the Fixes &
> > stable handling. Talking about user visible behavior, I do not think we
> > had any issue until dax support was dropped from raw mode. Until then,
> > the pmem driver supported dax for all modes, and the check for
> > direct_access worked.
>
> I agree that the fsdax + raw mode failure mode I mentioned in my cover letter
> only started when we restricted filesystem DAX to having struct page, but I
> think that the other failure mode, fsdax + some random block driver (I used
> brd) was present in DM from the beginning.

Ah, I see.

> In any case, I think both are fixed with the patches, and I think it's fine
> that all 3 get thrown at stable. Thanks, Mike, for the help.

Yup, agreed.

Thanks!
-Toshi