From: David Howells Date: Mon, 24 Jan 2022 23:15:18 +0000 (+0000) Subject: cifs: writeback fix X-Git-Tag: v6.1-rc5~1635^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70ef38515b664a14a3c8a3007778a56ccd02d43f;p=platform%2Fkernel%2Flinux-starfive.git cifs: writeback fix Wait for the page to be written to the cache before we allow it to be modified Signed-off-by: David Howells Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French --- diff --git a/fs/cifs/file.c b/fs/cifs/file.c index a2723f7..cf8642c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -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; }