From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>
To: David Howells <dhowells@redhat.com>
Cc: Christian Brauner <christian@brauner.io>,
Steve French <sfrench@samba.org>,
Pankaj Raghav <p.raghav@samsung.com>,
Paulo Alcantara <pc@manguebit.com>,
Jeff Layton <jlayton@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
netfs@lists.linux.dev, linux-afs@lists.infradead.org,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
ceph-devel@vger.kernel.org, v9fs@lists.linux.dev,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Marc Dionne <marc.dionne@auristor.com>
Subject: Re: [PATCH 1/9] mm: Fix missing folio invalidation calls during truncation
Date: Wed, 28 Aug 2024 11:38:02 +0000 [thread overview]
Message-ID: <20240828113802.xw5wzlq2hxrquclb@quentin> (raw)
In-Reply-To: <20240823200819.532106-2-dhowells@redhat.com>
On Fri, Aug 23, 2024 at 09:08:09PM +0100, David Howells wrote:
> When AS_RELEASE_ALWAYS is set on a mapping, the ->release_folio() and
> ->invalidate_folio() calls should be invoked even if PG_private and
> PG_private_2 aren't set. This is used by netfslib to keep track of the
Should we update the comment in pagemap?
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 55b254d951da..18dd6174e6cc 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -204,7 +204,8 @@ enum mapping_flags {
AS_EXITING = 4, /* final truncate in progress */
/* writeback related tags are not used */
AS_NO_WRITEBACK_TAGS = 5,
- AS_RELEASE_ALWAYS = 6, /* Call ->release_folio(), even if no private data */
+ AS_RELEASE_ALWAYS = 6, /* Call ->release_folio() and ->invalidate_folio,
+ even if no private data */
AS_STABLE_WRITES = 7, /* must wait for writeback before modifying
folio contents */
AS_INACCESSIBLE = 8, /* Do not attempt direct R/W access to the mapping */
> point above which reads can be skipped in favour of just zeroing pagecache
> locally.
>
> There are a couple of places in truncation in which invalidation is only
> called when folio_has_private() is true. Fix these to check
> folio_needs_release() instead.
>
> Without this, the generic/075 and generic/112 xfstests (both fsx-based
> tests) fail with minimum folio size patches applied[1].
>
> Fixes: b4fa966f03b7 ("mm, netfs, fscache: stop read optimisation when folio removed from pagecache")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> cc: Pankaj Raghav <p.raghav@samsung.com>
> cc: Jeff Layton <jlayton@kernel.org>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: linux-afs@lists.infradead.org
> cc: netfs@lists.linux.dev
> cc: linux-mm@kvack.org
> cc: linux-fsdevel@vger.kernel.org
> Link: https://lore.kernel.org/r/20240815090849.972355-1-kernel@pankajraghav.com/ [1]
> ---
> mm/truncate.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/truncate.c b/mm/truncate.c
> index 4d61fbdd4b2f..0668cd340a46 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -157,7 +157,7 @@ static void truncate_cleanup_folio(struct folio *folio)
> if (folio_mapped(folio))
> unmap_mapping_folio(folio);
>
> - if (folio_has_private(folio))
> + if (folio_needs_release(folio))
> folio_invalidate(folio, 0, folio_size(folio));
>
> /*
> @@ -219,7 +219,7 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end)
> if (!mapping_inaccessible(folio->mapping))
> folio_zero_range(folio, offset, length);
>
> - if (folio_has_private(folio))
> + if (folio_needs_release(folio))
> folio_invalidate(folio, offset, length);
> if (!folio_test_large(folio))
> return true;
>
--
Pankaj Raghav
next prev parent reply other threads:[~2024-08-28 11:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 20:08 [PATCH 0/9] netfs, cifs: Combined repost of fixes for truncation, DIO read and read-retry David Howells
2024-08-23 20:08 ` [PATCH 1/9] mm: Fix missing folio invalidation calls during truncation David Howells
2024-08-23 20:12 ` Matthew Wilcox
2024-08-28 11:38 ` Pankaj Raghav (Samsung) [this message]
2024-08-23 20:08 ` [PATCH 2/9] afs: Fix post-setattr file edit to do truncation correctly David Howells
2024-08-23 20:08 ` [PATCH 3/9] netfs: Fix netfs_release_folio() to say no if folio dirty David Howells
2024-08-23 20:08 ` [PATCH 4/9] netfs: Fix trimming of streaming-write folios in netfs_inval_folio() David Howells
2024-08-23 20:08 ` [PATCH 5/9] netfs: Fix missing iterator reset on retry of short read David Howells
2024-08-23 20:08 ` [PATCH 6/9] cifs: Fix lack of credit renegotiation on read retry David Howells
2024-08-23 20:08 ` [PATCH 7/9] netfs, cifs: Fix handling of short DIO read David Howells
2024-08-23 20:08 ` [PATCH 8/9] cifs: Fix FALLOC_FL_PUNCH_HOLE support David Howells
2024-08-23 20:08 ` [PATCH 9/9] netfs, cifs: Improve some debugging bits David Howells
2024-08-24 11:56 ` [PATCH 10/9] netfs: Fix interaction of streaming writes with zero-point tracker David Howells
2024-08-24 14:09 ` (subset) [PATCH 0/9] netfs, cifs: Combined repost of fixes for truncation, DIO read and read-retry Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240828113802.xw5wzlq2hxrquclb@quentin \
--to=kernel@pankajraghav.com \
--cc=ceph-devel@vger.kernel.org \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netfs@lists.linux.dev \
--cc=p.raghav@samsung.com \
--cc=pc@manguebit.com \
--cc=sfrench@samba.org \
--cc=v9fs@lists.linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox