]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Mar 2024 11:33:05 +0000 (12:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Mar 2024 11:33:05 +0000 (12:33 +0100)
added patches:
nfs-fix-data-corruption-caused-by-congestion.patch

queue-6.6/nfs-fix-data-corruption-caused-by-congestion.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/nfs-fix-data-corruption-caused-by-congestion.patch b/queue-6.6/nfs-fix-data-corruption-caused-by-congestion.patch
new file mode 100644 (file)
index 0000000..23a7647
--- /dev/null
@@ -0,0 +1,39 @@
+From neilb@suse.de  Mon Mar  4 12:29:59 2024
+From: "NeilBrown" <neilb@suse.de>
+Date: Wed, 28 Feb 2024 10:23:31 +1100
+Subject: NFS: Fix data corruption caused by congestion.
+To: stable@vger.kernel.org, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>
+Cc: linux-nfs@vger.kernel.org
+Message-ID: <170907621128.24797.4390391329078744015@noble.neil.brown.name>
+
+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".
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/write.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
+@@ -668,8 +668,10 @@ static int nfs_writepage_locked(struct f
+       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,
index 1d050adcbcef7293b2b369891d1ff9dda3275cc7..2787a27aff2c7cfa5d366d2131e52c5fda090d97 100644 (file)
@@ -112,3 +112,4 @@ mptcp-fix-snd_wnd-initialization-for-passive-socket.patch
 mptcp-fix-potential-wake-up-event-loss.patch
 mptcp-fix-double-free-on-socket-dismantle.patch
 mptcp-fix-possible-deadlock-in-subflow-diag.patch
+nfs-fix-data-corruption-caused-by-congestion.patch