kernel-hacking-2024-linux-s.../fs/afs
David Howells a74ee0e878
afs: Fix post-setattr file edit to do truncation correctly
At the end of an kAFS RPC operation, there is an "edit" phase (originally
intended for post-directory modification ops to edit the local image) that
the setattr VFS op uses to fix up the pagecache if the RPC that requested
truncation of a file was successful.

afs_setattr_edit_file() calls truncate_setsize() which sets i_size, expands
the pagecache if needed and truncates the pagecache.  The first two of
those, however, are redundant as they've already been done by
afs_setattr_success() under the io_lock and the first is also done under
the callback lock (cb_lock).

Fix afs_setattr_edit_file() to call truncate_pagecache() instead (which is
called by truncate_setsize(), thereby skipping the redundant parts.

Fixes: 100ccd18bb ("netfs: Optimise away reads above the point at which there can be no data")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20240823200819.532106-3-dhowells@redhat.com
cc: Matthew Wilcox (Oracle) <willy@infradead.org>
cc: Pankaj Raghav <p.raghav@samsung.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: netfs@lists.linux.dev
cc: linux-mm@kvack.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-08-24 16:09:16 +02:00
..
addr_list.c
addr_prefs.c
afs.h
afs_cm.h
afs_fs.h
afs_vl.h
callback.c
cell.c
cmservice.c
dir.c afs: drop usage of folio_file_pos 2024-07-03 19:29:55 -07:00
dir_edit.c afs: drop usage of folio_file_pos 2024-07-03 19:29:55 -07:00
dir_silly.c
dynroot.c afs: Remove afs_dynroot_d_revalidate() as it is redundant 2024-01-22 22:30:14 +00:00
file.c 9p: Fix DIO read through netfs 2024-08-13 13:53:09 +02:00
flock.c afs: adapt to breakup of struct file_lock 2024-02-05 13:11:42 +01:00
fs_operation.c
fs_probe.c
fsclient.c
inode.c afs: Fix post-setattr file edit to do truncation correctly 2024-08-24 16:09:16 +02:00
internal.h netfs, afs: Use writeback retry to deal with alternate keys 2024-05-01 18:07:38 +01:00
Kconfig
main.c afs: Fix ignored callbacks over ipv4 2024-02-20 09:51:21 +01:00
Makefile
misc.c
mntpt.c afs: Don't cross .backup mountpoint from backup volume 2024-05-25 14:02:40 +02:00
proc.c afs: Fix missing/incorrect unlocking of RCU read lock 2024-01-22 22:30:38 +00:00
protocol_afs.h
protocol_uae.h
protocol_yfs.h
rotate.c afs: Fix fileserver rotation getting stuck 2024-05-10 08:49:17 +02:00
rxrpc.c
security.c
server.c afs: Fix ignored callbacks over ipv4 2024-02-20 09:51:21 +01:00
server_list.c
super.c vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
validation.c afs: Use alternative invalidation to using launder_folio 2024-05-01 18:07:34 +01:00
vl_alias.c
vl_list.c
vl_probe.c
vl_rotate.c
vlclient.c
volume.c afs: Increase buffer size in afs_update_volume_status() 2024-02-20 09:51:21 +01:00
write.c netfs, afs: Use writeback retry to deal with alternate keys 2024-05-01 18:07:38 +01:00
xattr.c
xdr_fs.h
yfsclient.c