cifs: writeback fix
authorDavid Howells <dhowells@redhat.com>
Mon, 24 Jan 2022 23:15:18 +0000 (23:15 +0000)
committerSteve French <stfrench@microsoft.com>
Tue, 22 Mar 2022 20:38:20 +0000 (15:38 -0500)
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>
fs/cifs/file.c

index a2723f7..cf8642c 100644 (file)
@@ -4210,13 +4210,19 @@ cifs_page_mkwrite(struct vm_fault *vmf)
 {
        struct page *page = vmf->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.
+        */
 #ifdef CONFIG_CIFS_FSCACHE
        if (PageFsCache(page) &&
            wait_on_page_fscache_killable(page) < 0)
                return VM_FAULT_RETRY;
 #endif
 
-       lock_page(page);
+       wait_on_page_writeback(page);
+
+       if (lock_page_killable(page) < 0)
+               return VM_FAULT_RETRY;
        return VM_FAULT_LOCKED;
 }