Skip to content

Commit

Permalink
cifs: writeback fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Howells authored and Steve French committed Mar 22, 2022
1 parent 5d7e282 commit 70ef385
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 70ef385

Please sign in to comment.