From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neilb@suse.de>,
stable@vger.kernel.org,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, Dan Aloni <dan.aloni@vastdata.com>
Subject: Re: [PATCH stable 6.6 and 6.7] NFS: Fix data corruption caused by congestion.
Date: Wed, 06 Mar 2024 08:42:21 -0500 [thread overview]
Message-ID: <cfec488eccfc3469d18dd94b05a00919cc152113.camel@kernel.org> (raw)
In-Reply-To: <170907621128.24797.4390391329078744015@noble.neil.brown.name>
On Wed, 2024-02-28 at 10:23 +1100, NeilBrown wrote:
> when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects
> congestion) it is important that the folio is redirtied.
> nfs_writepage_locked() doesn't do this, so files can become corrupted as
> writes can be lost.
>
> Note that this is not needed in v6.8 as AOP_WRITEPAGE_ACTIVATE cannot be
> returned. It is needed for kernels v5.18..v6.7. Prior to 6.3 the patch
> is different as it needs to mention "page", not "folio".
>
Neil, I have a question about the above statement. In Linus's tree as of
this morning (v6.8-rc7-ish), it does this in nfs_writepages_locked:
if (wbc->sync_mode == WB_SYNC_NONE &&
NFS_SERVER(inode)->write_congested)
return AOP_WRITEPAGE_ACTIVATE;
The only caller of nfs_writepages_locked, and I don't see where it
redirties the page. Why don't we need this in v6.8?
> Reported-and-tested-by: Jacek Tomaka <Jacek.Tomaka@poczta.fm>
> Fixes: 6df25e58532b ("nfs: remove reliance on bdi congestion")
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
> fs/nfs/write.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index b664caea8b4e..9e345d3c305a 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -668,8 +668,10 @@ static int nfs_writepage_locked(struct folio *folio,
> int err;
>
> if (wbc->sync_mode == WB_SYNC_NONE &&
> - NFS_SERVER(inode)->write_congested)
> + NFS_SERVER(inode)->write_congested) {
> + folio_redirty_for_writepage(wbc, folio);
> return AOP_WRITEPAGE_ACTIVATE;
> + }
>
> nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
> nfs_pageio_init_write(&pgio, inode, 0, false,
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-03-06 13:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 23:23 [PATCH stable 6.6 and 6.7] NFS: Fix data corruption caused by congestion NeilBrown
2024-03-06 13:42 ` Jeff Layton [this message]
2024-03-06 17:12 ` Jeff Layton
2024-03-07 11:41 ` NeilBrown
2024-03-07 12:30 ` Jeff Layton
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=cfec488eccfc3469d18dd94b05a00919cc152113.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=anna@kernel.org \
--cc=dan.aloni@vastdata.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=stable@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.