From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754047AbcAHAnu (ORCPT ); Thu, 7 Jan 2016 19:43:50 -0500 Received: from mga04.intel.com ([192.55.52.120]:52534 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754011AbcAHAnr (ORCPT ); Thu, 7 Jan 2016 19:43:47 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,535,1444719600"; d="scan'208";a="722518787" Subject: [PATCH v3 4/5] xfs: unmap dax at shutdown (force_failure) From: Dan Williams To: xfs@oss.sgi.com Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org, Dave Chinner Date: Thu, 07 Jan 2016 16:43:21 -0800 Message-ID: <20160108004321.36061.17150.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160108004254.36061.32864.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160108004254.36061.32864.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When an exceptional event triggers xfs_force_shutdown() tear down dax mappings. Quoting Dave, "The simple fact is that a /filesystem/ shutdown needs to do DAX mapping invalidation regardless of whether the block device has been unplugged or not. This is not a case of "this only happens when we unplug the device", this is a user data protection mechanism that we use to prevent corruption propagation once it has been detected. A device unplug is just one type of "corruption" that can occur." Acked-by: Dave Chinner Signed-off-by: Dan Williams --- fs/xfs/xfs_fsops.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index ee3aaa0a5317..0c6a52809dcc 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -828,6 +828,15 @@ xfs_do_force_shutdown( if (xfs_log_force_umount(mp, logerror)) return; + /* + * If DAX is in use, we have to unmap all direct access virtual + * mappings to ensure nothing more gets written directly from + * userspace. This will force them to refault and that will + * result in them detecting the shutdown condition and hence + * will fail appropriately. + */ + unmap_dax_inodes(mp->m_super); + if (flags & SHUTDOWN_CORRUPT_INCORE) { xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT, "Corruption of in-memory data detected. Shutting down filesystem");