Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5791926imm; Tue, 26 Jun 2018 18:46:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdjrMqPBpk4bjYIUdL1AObu9PidMIfPq8TXOMyQSwNwabsj6WdZkiX+G7Ak0Ddva9C0E3DM X-Received: by 2002:a62:5991:: with SMTP id k17-v6mr3850962pfj.94.1530064011408; Tue, 26 Jun 2018 18:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530064011; cv=none; d=google.com; s=arc-20160816; b=O+nwUBA5AfosDHEVqHE0wCqtmhOBZA8NMMa22hWeGV4/1fgVRsSP8Ne4EAFcpPmiR2 E/gg6inHmtEveyxZH3OqAT/sn8d5ZsZYRj1JiQ5djChlb0y+o1Oe8uBnhGZtMvY1/sYA lIAsg2FlH3cMhBbaSvqaom0UTOXALltwGi2C3OhfnAbyaRj/bnoN6Ljv9TrA0I25YKE5 4c2LmmAbnrBl0A8vliHjWP9lbPI9gF2109cCo5hSLXWT/IJWmYUxC/lSbtiNWOVCDb9c xjaIPt2n4pFS28vxyS4CXZp9fkIoXZmHRF+j2GQlEl5SNS4cCZPc+JFEEeH/my7IDvng nxLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=KA9cnNNZBpDYPc6QLp78IWRYvyIp+h/w/zHbkhDUyp8=; b=p3PEfi/9yxJpEQPYuvwZUsana+3+in3oS4X6k1kRGIlz+sJsEuJzuqvHEY4VevRAhD iype5bxi4H+Q1k5eQIzfvonQzYOj954b2P3g6P2DHptfhdfuRegnwPGvr6PH8X+wiYMW TNZWS8B2dgGWWm5A/fEBevyTepyAwzKrkor9T3VtuNE134lsY9RwI6WW87eQIpnolKif ySDXFFhSYdCrgF94UetNaKKjWy5Bgd6AxNSUH53EYeDgaKOljWvTUo4PQ4VzM1u5ICxL C9hvNIHt66RLliXZWLH6jFW1m0Ll66DztL4+mGX6HBQu2SB9nyiQJ3XkPqfsOOpoxb0L EQyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22-v6si2616419plp.489.2018.06.26.18.46.37; Tue, 26 Jun 2018 18:46:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933995AbeFZWcB (ORCPT + 99 others); Tue, 26 Jun 2018 18:32:01 -0400 Received: from mga06.intel.com ([134.134.136.31]:65177 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbeFZWbJ (ORCPT ); Tue, 26 Jun 2018 18:31:09 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2018 15:31:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,276,1526367600"; d="scan'208";a="235840890" Received: from theros.lm.intel.com ([10.232.112.164]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2018 15:31:08 -0700 From: Ross Zwisler To: Toshi Kani , Mike Snitzer , dm-devel@redhat.com Cc: Ross Zwisler , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, stable@vger.kernel.org Subject: [PATCH v5 2/3] dax: bdev_dax_supported() check for QUEUE_FLAG_DAX Date: Tue, 26 Jun 2018 16:30:40 -0600 Message-Id: <20180626223041.15653-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180626223041.15653-1-ross.zwisler@linux.intel.com> References: <20180626223041.15653-1-ross.zwisler@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Suggested-by: Mike Snitzer Fixes: commit 545ed20e6df6 ("dm: add infrastructure for DAX support") Cc: stable@vger.kernel.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