From patchwork Mon Feb 22 18:59:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 8381911 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12B089F2F0 for ; Mon, 22 Feb 2016 18:59:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2046720585 for ; Mon, 22 Feb 2016 18:59:43 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 284652056D for ; Mon, 22 Feb 2016 18:59:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 477B61A1F09; Mon, 22 Feb 2016 10:59:44 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id ADE801A1F09 for ; Mon, 22 Feb 2016 10:59:42 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 22 Feb 2016 10:59:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,485,1449561600"; d="scan'208";a="657296574" Received: from rzwisler-desk.amr.corp.intel.com (HELO phyrexia.intel.com) ([10.254.181.157]) by FMSMGA003.fm.intel.com with ESMTP; 22 Feb 2016 10:59:39 -0800 From: Ross Zwisler To: linux-kernel@vger.kernel.org Subject: [PATCH v4 1/5] block: disable block device DAX by default Date: Mon, 22 Feb 2016 11:59:18 -0700 Message-Id: <1456167562-28576-2-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456167562-28576-1-git-send-email-ross.zwisler@linux.intel.com> References: <1456167562-28576-1-git-send-email-ross.zwisler@linux.intel.com> Cc: Jens Axboe , Jens Axboe , Theodore Ts'o , linux-nvdimm@lists.01.org, Jan Kara , Al Viro , Dave Chinner , xfs@oss.sgi.com, linux-block@vger.kernel.org, linux-mm@kvack.org, Andreas Dilger , Alexander Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Andrew Morton , Matthew Wilcox X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dan Williams The recent *sync enabling discovered that we are inserting into the block_device pagecache counter to the expectations of the dirty data tracking for dax mappings. This can lead to data corruption. We want to support DAX for block devices eventually, but it requires wider changes to properly manage the pagecache. [] dump_stack+0x85/0xc2 [] dax_writeback_mapping_range+0x60/0xe0 [] blkdev_writepages+0x3f/0x50 [] do_writepages+0x21/0x30 [] __filemap_fdatawrite_range+0xc6/0x100 [] filemap_write_and_wait+0x4a/0xa0 [] set_blocksize+0x70/0xd0 [] sb_set_blocksize+0x1d/0x50 [] ext4_fill_super+0x75b/0x3360 [] ? vsnprintf+0x201/0x4c0 [] ? snprintf+0x49/0x60 [] mount_bdev+0x180/0x1b0 [] ? ext4_calculate_overhead+0x370/0x370 [] ext4_mount+0x15/0x20 [] mount_fs+0x38/0x170 Mark the support broken so its disabled by default, but otherwise still available for testing. Cc: Jan Kara Cc: Jens Axboe Cc: Matthew Wilcox Cc: Al Viro Reported-by: Ross Zwisler Suggested-by: Dave Chinner Signed-off-by: Dan Williams Signed-off-by: Ross Zwisler Reviewed-by: Jan Kara --- block/Kconfig | 13 +++++++++++++ fs/block_dev.c | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/block/Kconfig b/block/Kconfig index 161491d..0363cd7 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -88,6 +88,19 @@ config BLK_DEV_INTEGRITY T10/SCSI Data Integrity Field or the T13/ATA External Path Protection. If in doubt, say N. +config BLK_DEV_DAX + bool "Block device DAX support" + depends on FS_DAX + depends on BROKEN + help + When DAX support is available (CONFIG_FS_DAX) raw block + devices can also support direct userspace access to the + storage capacity via MMAP(2) similar to a file on a + DAX-enabled filesystem. However, the DAX I/O-path disables + some standard I/O-statistics, and the MMAP(2) path has some + operational differences due to bypassing the page + cache. If in doubt, say N. + config BLK_DEV_THROTTLING bool "Block layer bio throttling support" depends on BLK_CGROUP=y diff --git a/fs/block_dev.c b/fs/block_dev.c index 39b3a17..31c6d10 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1201,7 +1201,11 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) bdev->bd_disk = disk; bdev->bd_queue = disk->queue; bdev->bd_contains = bdev; - bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0; + if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops->direct_access) + bdev->bd_inode->i_flags = S_DAX; + else + bdev->bd_inode->i_flags = 0; + if (!partno) { ret = -ENXIO; bdev->bd_part = disk_get_part(disk, partno);