1 From 92764e8822d4e7f8efb5ad959fac195a7f8ea0c6 Mon Sep 17 00:00:00 2001
2 From: David Howells <dhowells@redhat.com>
3 Date: Wed, 14 Aug 2024 21:38:21 +0100
4 Subject: netfs, ceph: Partially revert "netfs: Replace PG_fscache by setting folio->private and marking dirty"
6 From: David Howells <dhowells@redhat.com>
8 commit 92764e8822d4e7f8efb5ad959fac195a7f8ea0c6 upstream.
10 This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c.
12 In addition to reverting the removal of PG_private_2 wrangling from the
13 buffered read code[1][2], the removal of the waits for PG_private_2 from
14 netfs_release_folio() and netfs_invalidate_folio() need reverting too.
16 It also adds a wait into ceph_evict_inode() to wait for netfs read and
17 copy-to-cache ops to complete.
19 Fixes: 2ff1e97587f4 ("netfs: Replace PG_fscache by setting folio->private and marking dirty")
20 Signed-off-by: David Howells <dhowells@redhat.com>
21 Link: https://lore.kernel.org/r/3575457.1722355300@warthog.procyon.org.uk [1]
22 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e5ced7804cb9184c4a23f8054551240562a8eda [2]
23 Link: https://lore.kernel.org/r/20240814203850.2240469-2-dhowells@redhat.com
24 cc: Max Kellermann <max.kellermann@ionos.com>
25 cc: Ilya Dryomov <idryomov@gmail.com>
26 cc: Xiubo Li <xiubli@redhat.com>
27 cc: Jeff Layton <jlayton@kernel.org>
28 cc: Matthew Wilcox <willy@infradead.org>
29 cc: ceph-devel@vger.kernel.org
30 cc: netfs@lists.linux.dev
31 cc: linux-fsdevel@vger.kernel.org
32 cc: linux-mm@kvack.org
33 Signed-off-by: Christian Brauner <brauner@kernel.org>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37 fs/netfs/misc.c | 7 +++++++
38 2 files changed, 8 insertions(+)
42 @@ -697,6 +697,7 @@ void ceph_evict_inode(struct inode *inod
44 percpu_counter_dec(&mdsc->metric.total_inodes);
46 + netfs_wait_for_outstanding_io(inode);
47 truncate_inode_pages_final(&inode->i_data);
48 if (inode->i_state & I_PINNING_NETFS_WB)
49 ceph_fscache_unuse_cookie(inode, true);
52 @@ -101,6 +101,8 @@ void netfs_invalidate_folio(struct folio
54 kenter("{%lx},%zx,%zx", folio->index, offset, length);
56 + folio_wait_private_2(folio); /* [DEPRECATED] */
58 if (!folio_test_private(folio))
61 @@ -165,6 +167,11 @@ bool netfs_release_folio(struct folio *f
63 if (folio_test_private(folio))
65 + if (unlikely(folio_test_private_2(folio))) { /* [DEPRECATED] */
66 + if (current_is_kswapd() || !(gfp & __GFP_FS))
68 + folio_wait_private_2(folio);
70 fscache_note_page_release(netfs_i_cookie(ctx));