nfs: always make sure page is up-to-date before extending a write to cover the entire...
authorScott Mayhew <smayhew@redhat.com>
Fri, 17 Jan 2014 20:12:05 +0000 (15:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Feb 2014 21:50:16 +0000 (13:50 -0800)
commit4a3cbb28c3bbb4cb24ea59a91c2607d806818b73
tree01bed29143dbbaee13ae60b9171da450f64f36c7
parent0c402bf59c6eb85d4b7dfd8d49083ea675d34c96
nfs: always make sure page is up-to-date before extending a write to cover the entire page

commit 263b4509ec4d47e0da3e753f85a39ea12d1eff24 upstream.

We should always make sure the cached page is up-to-date when we're
determining whether we can extend a write to cover the full page -- even
if we've received a write delegation from the server.

Commit c7559663 added logic to skip this check if we have a write
delegation, which can lead to data corruption such as the following
scenario if client B receives a write delegation from the NFS server:

Client A:
    # echo 123456789 > /mnt/file

Client B:
    # echo abcdefghi >> /mnt/file
    # cat /mnt/file
    0�D0�abcdefghi

Just because we hold a write delegation doesn't mean that we've read in
the entire page contents.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/write.c