summaryrefslogtreecommitdiffstats
path: root/fs/afs/internal.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2020-06-12 17:13:52 +0200
committerDavid Howells <dhowells@redhat.com>2020-06-15 16:41:02 +0200
commit793fe82ee33aab1023cf023cd7d744af19a3dff9 (patch)
tree7573b381e7c832b6c589e4057990e6db793567b4 /fs/afs/internal.h
parentafs: Concoct ctimes (diff)
downloadlinux-793fe82ee33aab1023cf023cd7d744af19a3dff9.tar.xz
linux-793fe82ee33aab1023cf023cd7d744af19a3dff9.zip
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/afs/internal.h')
-rw-r--r--fs/afs/internal.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 92cd6b8cc01f..bdc1e5efebd4 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -744,9 +744,10 @@ struct afs_vnode_param {
afs_dataversion_t dv_before; /* Data version before the call */
unsigned int cb_break_before; /* cb_break + cb_s_break before the call */
u8 dv_delta; /* Expected change in data version */
- bool put_vnode; /* T if we have a ref on the vnode */
- bool need_io_lock; /* T if we need the I/O lock on this */
- bool update_ctime; /* Need to update the ctime */
+ bool put_vnode:1; /* T if we have a ref on the vnode */
+ bool need_io_lock:1; /* T if we need the I/O lock on this */
+ bool update_ctime:1; /* Need to update the ctime */
+ bool set_size:1; /* Must update i_size */
};
/*