* [PATCH stable 6.1] NFS: Fix data corruption caused by congestion.
@ 2024-02-27 23:25 NeilBrown
2024-03-04 11:31 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2024-02-27 23:25 UTC (permalink / raw)
To: stable, Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, Jacek Tomaka
when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects
congestion) it is important that the page 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. From 6.3 onward the patch
is different as it needs to mention "folio", not "page".
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 f41d24b54fd1..6a0606668417 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -667,8 +667,10 @@ static int nfs_writepage_locked(struct page *page,
int err;
if (wbc->sync_mode == WB_SYNC_NONE &&
- NFS_SERVER(inode)->write_congested)
+ NFS_SERVER(inode)->write_congested) {
+ redirty_page_for_writepage(wbc, page);
return AOP_WRITEPAGE_ACTIVATE;
+ }
nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
nfs_pageio_init_write(&pgio, inode, 0,
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH stable 6.1] NFS: Fix data corruption caused by congestion.
2024-02-27 23:25 [PATCH stable 6.1] NFS: Fix data corruption caused by congestion NeilBrown
@ 2024-03-04 11:31 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-03-04 11:31 UTC (permalink / raw)
To: NeilBrown
Cc: stable, Trond Myklebust, Anna Schumaker, linux-nfs, Jacek Tomaka
On Wed, Feb 28, 2024 at 10:25:49AM +1100, NeilBrown wrote:
>
> when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects
> congestion) it is important that the page 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. From 6.3 onward the patch
> is different as it needs to mention "folio", not "page".
>
> 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(-)
All now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-04 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 23:25 [PATCH stable 6.1] NFS: Fix data corruption caused by congestion NeilBrown
2024-03-04 11:31 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).