Linux Device Mapper development
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Toshi Kani <toshi.kani-ZPxbGqLxI0U@public.gmane.org>,
	Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v4 3/3] dm: prevent DAX mounts if not supported
Date: Tue, 26 Jun 2018 13:01:29 -0600	[thread overview]
Message-ID: <20180626190129.18112-1-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180626175932.8899-4-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

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 <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Fixes: commit 545ed20e6df6 ("dm: add infrastructure for DAX support")
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

---

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

  parent reply	other threads:[~2018-06-26 19:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 17:59 [PATCH v3 0/3] Fix DM DAX handling Ross Zwisler
     [not found] ` <20180626175932.8899-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-26 17:59   ` [PATCH v3 1/3] pmem: only set QUEUE_FLAG_DAX for fsdax mode Ross Zwisler
     [not found]     ` <20180626175932.8899-2-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-26 18:52       ` Dan Williams
2018-06-26 18:58         ` Mike Snitzer
     [not found]           ` <20180626185830.GA7171-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-06-26 19:07             ` Dan Williams
     [not found]               ` <CAPcyv4h6HO6fs6k7QMD77jkz2djCeWCtWomCdNb0-1Q4VKanqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-26 19:12                 ` Ross Zwisler
2018-06-26 19:13                 ` Mike Snitzer
     [not found]                   ` <20180626191346.GA7233-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-06-26 19:19                     ` Dan Williams
2018-06-26 20:54                     ` Kani, Toshi
     [not found]                       ` <1530046327.14039.273.camel-ZPxbGqLxI0U@public.gmane.org>
2018-06-26 21:02                         ` Dan Williams
     [not found]                           ` <CAPcyv4hP_Y3xdyCa-UkYCMJ5OtnjnkwPZDS2Z2Ge8+5ymBONwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-26 21:23                             ` Kani, Toshi
     [not found]                               ` <1530048093.14039.286.camel-ZPxbGqLxI0U@public.gmane.org>
2018-06-26 21:28                                 ` Dan Williams
2018-06-26 21:31                                   ` Kani, Toshi
     [not found]                                     ` <1530048545.14039.288.camel-ZPxbGqLxI0U@public.gmane.org>
2018-06-26 21:51                                       ` Dan Williams
2018-06-26 22:04                                         ` Ross Zwisler
     [not found]                                           ` <20180626220430.GA4269-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-28 17:42                                             ` Kani, Toshi
2018-06-28 17:48                                               ` Mike Snitzer
     [not found]                                                 ` <20180628174815.GA18768-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-06-28 17:59                                                   ` Dan Williams
2018-06-28 18:01                                                   ` Kani, Toshi
     [not found]                                               ` <1530207635.14039.308.camel-ZPxbGqLxI0U@public.gmane.org>
2018-06-28 19:04                                                 ` Ross Zwisler
     [not found]                                                   ` <20180628190424.GC17758-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-28 19:40                                                     ` Kani, Toshi
2018-06-26 19:11             ` Ross Zwisler
2018-06-26 17:59   ` [PATCH v3 2/3] dax: bdev_dax_supported() check for QUEUE_FLAG_DAX Ross Zwisler
2018-06-26 17:59   ` [PATCH v3 3/3] dm: prevent DAX mounts if not supported Ross Zwisler
     [not found]     ` <20180626175932.8899-4-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-26 18:17       ` Mike Snitzer
2018-06-26 19:01       ` Ross Zwisler [this message]
2018-06-26 18:48   ` [PATCH v3 0/3] Fix DM DAX handling Mike Snitzer

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=20180626190129.18112-1-ross.zwisler@linux.intel.com \
    --to=ross.zwisler-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=toshi.kani-ZPxbGqLxI0U@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox