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 v3 2/3] dax: bdev_dax_supported() check for QUEUE_FLAG_DAX
Date: Tue, 26 Jun 2018 11:59:31 -0600	[thread overview]
Message-ID: <20180626175932.8899-3-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180626175932.8899-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

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 <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Suggested-by: Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 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

  parent reply	other threads:[~2018-06-26 17:59 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   ` Ross Zwisler [this message]
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       ` [PATCH v4 " Ross Zwisler
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=20180626175932.8899-3-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