[PATCH] netfs: Fix netfs_page_mkwrite() to flush conflicting data, not wait

David Howells dhowells at redhat.com
Mon Jun 24 04:24:15 PDT 2024


Fix netfs_page_mkwrite() to use filemap_fdatawrite_range(), not
filemap_fdatawait_range() to flush conflicting data.

Fixes: 102a7e2c598c ("netfs: Allow buffered shared-writeable mmap through netfs_page_mkwrite()")
Signed-off-by: David Howells <dhowells at redhat.com>
cc: Matthew Wilcox <willy at infradead.org>
cc: Jeff Layton <jlayton at kernel.org>
cc: netfs at lists.linux.dev
cc: v9fs at lists.linux.dev
cc: linux-afs at lists.infradead.org
cc: linux-cifs at vger.kernel.org
cc: linux-mm at kvack.org
cc: linux-fsdevel at vger.kernel.org
---
 fs/netfs/buffered_write.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c
index 05745bcc54c6..9cbbeeee6170 100644
--- a/fs/netfs/buffered_write.c
+++ b/fs/netfs/buffered_write.c
@@ -554,9 +554,9 @@ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_gr
 	group = netfs_folio_group(folio);
 	if (group != netfs_group && group != NETFS_FOLIO_COPY_TO_CACHE) {
 		folio_unlock(folio);
-		err = filemap_fdatawait_range(mapping,
-					      folio_pos(folio),
-					      folio_pos(folio) + folio_size(folio));
+		err = filemap_fdatawrite_range(mapping,
+					       folio_pos(folio),
+					       folio_pos(folio) + folio_size(folio));
 		switch (err) {
 		case 0:
 			ret = VM_FAULT_RETRY;




More information about the linux-afs mailing list