From patchwork Tue Dec 17 05:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13911111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97342E7716A for ; Tue, 17 Dec 2024 05:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8VWQbKvMZKkNtjv/Ajd0TUbTX6X5/B0Htgy5V0FzEIY=; b=IpqvfXzxvcQsrlJt2//dkms8MX I2WAsYViFK6JFuDAHoJFxi5Ju0aVj+Phm8TheqMoGoYY7GoKM6wUtzJIQXIlcMzzb9KMbrZlZMn1n EJFkYSjXkH9p5ieEv8ZZxuR7OQe2IAuVdt+jKGfSkLMIzS39wiuwtWLkn8ozokzNH1EgN2+yh/w06 Xe+ktaCyOZ6RZGllkTW18WgDQSz/KTaGNH4Jh0dnTBu0ZwOxhhoojFtWwE8z5/BxrXjUnk/RukJAS 4rFT3KomgJBZDQT7MbaWlcJ4Z5JFOFIzERC+Z/3pTn6ytGHpT4idhvaji9ZdpNo4E+0UBIt0mh+ud Zzobfp7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNQ2I-0000000CGBD-0tgd; Tue, 17 Dec 2024 05:22:22 +0000 Received: from mail-dm6nam11on20603.outbound.protection.outlook.com ([2a01:111:f403:2415::603] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNPuQ-0000000CDDU-2xPw for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 05:14:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MoRAy8lpzBvNLGI+hi6ggVQwRTJD9qExpIQKQs2bmrjlcA9zDgOUmqIG52gjVfpB+c0Kf0Y2iKyFOlJmfytGSqo2va4G5IdcdGU54hfA8f4PQBwQ1MKxpJfrWlcZVL6BAI9zsOzmBcchMpHevQDowP+/oZhfFseDRbVgPb9o0NLIDEJU3HdwCO49MawtrOLjr/8KDu4rDMzsrRbY7WtrdsBAlE5Gi2V3hk3sGf36xCXJpDzP0QGCmV9TlFETfy4HcOdaW7j+7Uf8gtNqnc2Qqykg8z4tW3PbWIb+zBlBXKQjuxDNiUIbxsxbXLsNX4SRU0WT6EzmFq/0xs5Zn30VUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8VWQbKvMZKkNtjv/Ajd0TUbTX6X5/B0Htgy5V0FzEIY=; b=sP4+zHkdz43wHtKyYfGgkLXFB9cUwAo9V9ZqLECHpwGnaHg6FtJpO9C6k6JvW/x7ieRmcWIPsmXoD2MBuvOJK8KkunTY7HnaDogtBXb3CezmiKWoxnV02SR2wxlebiMD2IYW5UoOS5aLmqXJ+wIlBHKMjsRNSMw7pNipXY0fcwd+cjN9H6nbKmExoCUC725aViMB3bvnHxXOFNmbm+cQTcXSOadGR8uXu2psjUWq5lnO6/zrTtrKFb4cxUv7q1qv5ajXENudBCSeW9jl+BjlDRpDJ+4ZAj/NtA3hponKHcSRZSDZ50GE42cs68KgSXZAjVre/zR3pRjjQBIz69BhtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8VWQbKvMZKkNtjv/Ajd0TUbTX6X5/B0Htgy5V0FzEIY=; b=LW7oN0bNN1AM4VfGpHhuO5mZ0miPBkQFcj/vM0RppI7a8vZfyVqfI4SjoqxS6zMQ0TwB0OH6fbKw6/k9erS/kmaG1W2NKoV+LKs5dxhoQdbjUBkSC0A6Vnplc89OwCQRh2EuWKo44tFylpdhteDD4YUEjUX7HDbLqHC+TcEMcuCN+UCqcl84CnW36j5nat0r9yjkcfVJyD420W5eN9h67CdcrjC9s+XamLnT5Xsko6gDQOg436obXyngYIXTEW/bpJKbiN7SzBW1A1uBKMyal8plDovMhiMdUKm6BYKLjLFoVqu72oVoE9OPkXptUy+5Prv1appciCMV7igw03RvKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by CH3PR12MB8936.namprd12.prod.outlook.com (2603:10b6:610:179::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Tue, 17 Dec 2024 05:14:11 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%4]) with mapi id 15.20.8251.015; Tue, 17 Dec 2024 05:14:11 +0000 From: Alistair Popple To: akpm@linux-foundation.org, dan.j.williams@intel.com, linux-mm@kvack.org Cc: Alistair Popple , lina@asahilina.net, zhang.lyra@gmail.com, gerald.schaefer@linux.ibm.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca, catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, willy@infradead.org, djwong@kernel.org, tytso@mit.edu, linmiaohe@huawei.com, david@redhat.com, peterx@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com Subject: [PATCH v4 07/25] fs/dax: Ensure all pages are idle prior to filesystem unmount Date: Tue, 17 Dec 2024 16:12:50 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY5P282CA0173.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:24a::27) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|CH3PR12MB8936:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c631d3f-094d-43b8-c511-08dd1e59a3ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|366016; X-Microsoft-Antispam-Message-Info: as8i8ffgpAstVBPkHwkW1o8DaUglLxTeZKqe3Mr31rGRJabwfbKyx59hDO82KidtVxqtwMq1Txr9OH+Hfn065yf1vR+vFqQ5u9X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oYp2xzZcIMrWoEDrk8OiAvCnr+GOoqHPCM0u3+M/8s5GeAtjQlorX+94aUPEnbXBlLhqhuZIZeEm+Caz5gs3DmcKHO+c2HdmFLQa9T/0v8/uMV4140wg59WXVECDPqgJkup3F/Alw4mhpyDaCk7W0WrLV2i5aXtqp6tZ23uC3dLTVnaDxvI8zT1XnQewHjBWD8gZ9cfPu+uu5C/ZNHq9x1pEhUco/Vz9Mb1P/sbIMlmy9anq+pqiAojmeJ1hT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB7726.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2dpjZsx//tdvur07Icte7WooBnpKiJwUDxaqTRO7xCtGYMaMMiRBT7IzXo5e8gZ4ulP7Ii4JjrTJtjgIVFh7EBT0mLK44bDL+Gd7ds/9Rz28O1jzTLMGfm3ROCWElc7ogfWAwLOimTbZf+hHY4JunRrrt//YSKB4V5hwjMejJRPswW/ka8Z/JLP08PMH/TvYtaab/Cc0hWdzvS813/3uSK+0TYCaPNq5AWUkB4ZdKJA8kW975DCJo84/7NbT71woPNR5CPRAICU+S4c3guHk3L3aGQebnWiPZ69VCNS8VFvOrzoulCaRXeRF73YrQbUudE++yEGHkI3+mMqIK2pB49VrRRXZc85jQE2Tbu9O1aedLZx5AtuKgwyly3RMDWf9hkuhT6YXHKnYBHj7d1PekeqZB8XOMuscVTw7ITAfbgxrwsASFN8D2paNKKogcFHuu7GmxTM9hxxphgCwc6TCVNPrJSPTC390JrXyVv1xM3cjpsT8PwTWeOkdPARJMbOgPxfoWK5kfLRlFyV/OAPuheIiAOcYoY22JCL9/2EUsRbJAfFKRe2OYn+6Uydvt0ek3uHJa3JwUIXiw79NWjUA2jq8sYTlVAA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Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 05:14:10.9586 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8fpD9kQFfa3rtmgSeKjbUhJQWJ31Mx99ccUmBBNiVXu52wY7Rdk1P81Afcf2DX5Tf96m/l+sCijQWog/bc/cHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8936 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241216_211414_868729_A1085BD8 X-CRM114-Status: GOOD ( 20.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org File systems call dax_break_mapping() prior to reallocating file system blocks to ensure the page is not undergoing any DMA or other accesses. Generally this is needed when a file is truncated to ensure that if a block is reallocated nothing is writing to it. However filesystems currently don't call this when an FS DAX inode is evicted. This can cause problems when the file system is unmounted as a page can continue to be under going DMA or other remote access after unmount. This means if the file system is remounted any truncate or other operation which requires the underlying file system block to be freed will not wait for the remote access to complete. Therefore a busy block may be reallocated to a new file leading to corruption. Signed-off-by: Alistair Popple --- fs/dax.c | 26 ++++++++++++++++++++++++++ fs/ext4/inode.c | 32 ++++++++++++++------------------ fs/xfs/xfs_inode.c | 9 +++++++++ fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_super.c | 18 ++++++++++++++++++ include/linux/dax.h | 2 ++ 6 files changed, 70 insertions(+), 18 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index cd6cca8..34a7690 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -883,6 +883,14 @@ static int wait_page_idle(struct page *page, TASK_INTERRUPTIBLE, 0, 0, cb(inode)); } +static void wait_page_idle_uninterruptible(struct page *page, + void (cb)(struct inode *), + struct inode *inode) +{ + ___wait_var_event(page, page_ref_count(page) == 1, + TASK_UNINTERRUPTIBLE, 0, 0, cb(inode)); +} + /* * Unmaps the inode and waits for any DMA to complete prior to deleting the * DAX mapping entries for the range. @@ -908,6 +916,24 @@ int dax_break_mapping(struct inode *inode, loff_t start, loff_t end, } EXPORT_SYMBOL_GPL(dax_break_mapping); +void dax_break_mapping_uninterruptible(struct inode *inode, + void (cb)(struct inode *)) +{ + struct page *page; + + do { + page = dax_layout_busy_page_range(inode->i_mapping, 0, + LLONG_MAX); + if (!page) + break; + + wait_page_idle_uninterruptible(page, cb, inode); + } while (true); + + dax_delete_mapping_range(inode->i_mapping, 0, LLONG_MAX); +} +EXPORT_SYMBOL_GPL(dax_break_mapping_uninterruptible); + /* * Invalidate DAX entry if it is clean. */ diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ee8e83f..fa35161 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -163,6 +163,18 @@ int ext4_inode_is_fast_symlink(struct inode *inode) (inode->i_size < EXT4_N_BLOCKS * 4); } +static void ext4_wait_dax_page(struct inode *inode) +{ + filemap_invalidate_unlock(inode->i_mapping); + schedule(); + filemap_invalidate_lock(inode->i_mapping); +} + +int ext4_break_layouts(struct inode *inode) +{ + return dax_break_mapping_inode(inode, ext4_wait_dax_page); +} + /* * Called at the last iput() if i_nlink is zero. */ @@ -181,6 +193,8 @@ void ext4_evict_inode(struct inode *inode) trace_ext4_evict_inode(inode); + dax_break_mapping_uninterruptible(inode, ext4_wait_dax_page); + if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL) ext4_evict_ea_inode(inode); if (inode->i_nlink) { @@ -3902,24 +3916,6 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, return ret; } -static void ext4_wait_dax_page(struct inode *inode) -{ - filemap_invalidate_unlock(inode->i_mapping); - schedule(); - filemap_invalidate_lock(inode->i_mapping); -} - -int ext4_break_layouts(struct inode *inode) -{ - struct page *page; - int error; - - if (WARN_ON_ONCE(!rwsem_is_locked(&inode->i_mapping->invalidate_lock))) - return -EINVAL; - - return dax_break_mapping_inode(inode, ext4_wait_dax_page); -} - /* * ext4_punch_hole: punches a hole in a file by releasing the blocks * associated with the given offset and length diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 4410b42..c7ec5ab 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2997,6 +2997,15 @@ xfs_break_dax_layouts( return dax_break_mapping_inode(inode, xfs_wait_dax_page); } +void +xfs_break_dax_layouts_uninterruptible( + struct inode *inode) +{ + xfs_assert_ilocked(XFS_I(inode), XFS_MMAPLOCK_EXCL); + + dax_break_mapping_uninterruptible(inode, xfs_wait_dax_page); +} + int xfs_break_layouts( struct inode *inode, diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index c4f03f6..613797a 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -594,6 +594,7 @@ xfs_itruncate_extents( } int xfs_break_dax_layouts(struct inode *inode); +void xfs_break_dax_layouts_uninterruptible(struct inode *inode); int xfs_break_layouts(struct inode *inode, uint *iolock, enum layout_break_reason reason); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 8524b9d..73ec060 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -751,6 +751,23 @@ xfs_fs_drop_inode( return generic_drop_inode(inode); } +STATIC void +xfs_fs_evict_inode( + struct inode *inode) +{ + struct xfs_inode *ip = XFS_I(inode); + uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; + + if (IS_DAX(inode)) { + xfs_ilock(ip, iolock); + xfs_break_dax_layouts_uninterruptible(inode); + xfs_iunlock(ip, iolock); + } + + truncate_inode_pages_final(&inode->i_data); + clear_inode(inode); +} + static void xfs_mount_free( struct xfs_mount *mp) @@ -1189,6 +1206,7 @@ static const struct super_operations xfs_super_operations = { .destroy_inode = xfs_fs_destroy_inode, .dirty_inode = xfs_fs_dirty_inode, .drop_inode = xfs_fs_drop_inode, + .evict_inode = xfs_fs_evict_inode, .put_super = xfs_fs_put_super, .sync_fs = xfs_fs_sync_fs, .freeze_fs = xfs_fs_freeze, diff --git a/include/linux/dax.h b/include/linux/dax.h index ef9e02c..7c3773f 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -274,6 +274,8 @@ static inline int __must_check dax_break_mapping_inode(struct inode *inode, { return dax_break_mapping(inode, 0, LLONG_MAX, cb); } +void dax_break_mapping_uninterruptible(struct inode *inode, + void (cb)(struct inode *)); int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff, struct inode *dest, loff_t destoff, loff_t len, bool *is_same,