NFS: Ensure that mmapped pages remain stable during writeback
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 18 Jan 2012 03:04:26 +0000 (22:04 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 1 Feb 2012 00:28:08 +0000 (19:28 -0500)
Ensure that nfs_vm_page_mkwrite() waits for the page writeback to
complete before the application is allowed to modify page
contents.
The main reason for wanting to do this in NFS is to ensure that the
server doesn't get confused if we have to resend the RPC request
due to a dropped/missed reply.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/file.c

index c43a452f7da2e70c084bddb7dfe6415d194bdf3e..4fdaaa63cf1c3f0d72ca58088ba312026881aa19 100644 (file)
@@ -530,6 +530,8 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (mapping != dentry->d_inode->i_mapping)
                goto out_unlock;
 
+       wait_on_page_writeback(page);
+
        pagelen = nfs_page_length(page);
        if (pagelen == 0)
                goto out_unlock;