From: David Howells <dhowells@redhat.com>
Date: Mon, 24 Jan 2022 23:15:18 +0000
Subject: [PATCH] cifs: writeback fix
Git-commit: 70ef38515b664a14a3c8a3007778a56ccd02d43f
References: bsc#1193629
Patch-mainline: v5.18-rc1
Wait for the page to be written to the cache before we allow it
to be modified
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/file.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4215,7 +4215,13 @@ cifs_page_mkwrite(struct vm_fault *vmf)
return VM_FAULT_RETRY;
#endif
- lock_page(page);
+ /* Wait for the page to be written to the cache before we allow it to
+ * be modified. We then assume the entire page will need writing back.
+ */
+ wait_on_page_writeback(page);
+
+ if (lock_page_killable(page) < 0)
+ return VM_FAULT_RETRY;
return VM_FAULT_LOCKED;
}