diff options
author | David Howells <dhowells@redhat.com> | 2020-06-12 16:13:52 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2020-06-15 15:41:02 +0100 |
commit | 793fe82ee33aab1023cf023cd7d744af19a3dff9 (patch) | |
tree | 7573b381e7c832b6c589e4057990e6db793567b4 /fs/pnode.c | |
parent | da8d07551275abb3a38fae2d16e02bc9cc7396b2 (diff) |
afs: Fix truncation issues and mmap writeback size
Fix the following issues:
(1) Fix writeback to reduce the size of a store operation to i_size,
effectively discarding the extra data.
The problem comes when afs_page_mkwrite() records that a page is about
to be modified by mmap(). It doesn't know what bits of the page are
going to be modified, so it records the whole page as being dirty
(this is stored in page->private as start and end offsets).
Without this, the marshalling for the store to the server extends the
size of the file to the end of the page (in afs_fs_store_data() and
yfs_fs_store_data()).
(2) Fix setattr to actually truncate the pagecache, thereby clearing
the discarded part of a file.
(3) Fix setattr to check that the new size is okay and to disable
ATTR_SIZE if i_size wouldn't change.
(4) Force i_size to be updated as the result of a truncate.
(5) Don't truncate if ATTR_SIZE is not set.
(6) Call pagecache_isize_extended() if the file was enlarged.
Note that truncate_set_size() isn't used because the setting of i_size is
done inside afs_vnode_commit_status() under the vnode->cb_lock.
Found with the generic/029 and generic/393 xfstests.
Fixes: 31143d5d515e ("AFS: implement basic file write support")
Fixes: 4343d00872e1 ("afs: Get rid of the afs_writeback record")
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/pnode.c')
0 files changed, 0 insertions, 0 deletions