Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5485215imm; Tue, 26 Jun 2018 12:04:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKLQLuC5p3P8hlSBODq1H0p74uA08mVRg6G8pkslz5sLH3knk+mdOTqLSORoU3PZW7L5JPp X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr2815687plg.135.1530039876762; Tue, 26 Jun 2018 12:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530039876; cv=none; d=google.com; s=arc-20160816; b=jGx6dElup4U3CSNkcwxyu5jCZw2ozDBsiYwhAosxZnsSTR5z04KAnOsxuy+77P5OAR WKvUsAa/ovRzAYW52ihzW/JhO+YnlqGL57mpuduGbbJRxI4eCgOFRI9b9eVsGhsyx89T FhCFEBmr6RIM4npq7AZT3rZHX31pBKkHBXs1Iw9MuacFtA0tsvCGQK6Y0/px51/7mAsa EFdw69bcrFcqO4FlJ1PS+ZhUTP5TOrdf3F2eHklLW6VwCNlELnLNMEHmgdxT/kIHiWNF uju6BguwT/4HjQyfuifh4fmt7u2NOflBNpOEwRjylaZ1Ms8pW4EHTH7KowJDzWYUkR18 mPbg== 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=42Mb990QBpzDesiIbxmuAuLYyfFnTg1lb4oTfP3OvRI=; b=0atwI7uja6fYMRb+v59JYd9hdnT1I+Ww/8CaOMFyKvIhf+nICpGep1L2FoWQMvjm5m JZpPhnYaRmf5xD8t2jYzyvM/5BwJtidFBZDetSh/ALZTo451eAeEEPH1mysgNbypnuU2 KEUGebLuuYM4r6/mnc7ZBZpzzRh2SVgEaL45gs9TE0OA30B6XS0i7RxefJmg80AVhnKx jRWQCxcAkc7rT93arTEIXYE8ogehWorQ5LDFYe99uNJR8H9q/gJJsar1IDymgbKUaLGk 8lEocIZB4Dm5Ke3392ZwOAUylKVkxmr9XewT12mX3BfBe8c0kLuY3ETGaXuFoRLIjvzc SLfQ== 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 67-v6si1860404pgj.329.2018.06.26.12.04.22; Tue, 26 Jun 2018 12:04:36 -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 S933998AbeFZSAZ (ORCPT + 99 others); Tue, 26 Jun 2018 14:00:25 -0400 Received: from mga07.intel.com ([134.134.136.100]:23718 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754813AbeFZR7g (ORCPT ); Tue, 26 Jun 2018 13:59:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2018 10:59:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,275,1526367600"; d="scan'208";a="50086622" Received: from theros.lm.intel.com ([10.232.112.164]) by fmsmga007.fm.intel.com with ESMTP; 26 Jun 2018 10:59:35 -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, linux-xfs@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v3 2/3] dax: bdev_dax_supported() check for QUEUE_FLAG_DAX Date: Tue, 26 Jun 2018 11:59:31 -0600 Message-Id: <20180626175932.8899-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180626175932.8899-1-ross.zwisler@linux.intel.com> References: <20180626175932.8899-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 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