afs: afs_fill_page reads too much, or wrong data
authorAnton Blanchard <anton@samba.org>
Mon, 13 Jun 2011 21:31:12 +0000 (22:31 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 16 Jun 2011 15:44:46 +0000 (11:44 -0400)
commit5e7f23373bf9a853e9256e81e86724cdd0a33c29
tree4e49311429c995889853d0ec0f43a3023869c227
parent8aef18845266f5c05904c610088f2d1ed58f6be3
afs: afs_fill_page reads too much, or wrong data

afs_fill_page should read the page that is about to be written but
the current implementation has a number of issues. If we aren't
extending the file we always read PAGE_CACHE_SIZE at offset 0. If we
are extending the file we try to read the entire file.

Change afs_fill_page to read PAGE_CACHE_SIZE at the right offset,
clamped to i_size.

While here, avoid calling afs_fill_page when we are doing a
PAGE_CACHE_SIZE write.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/afs/write.c