linux/fs/afs
David Howells b74c02a379 afs: Fix occasional rmdir-then-VNOVNODE with generic/011
Sometimes generic/011 causes kafs to follow up an FS.RemoveDir RPC call by
spending around a second sending a slew of FS.FetchStatus RPC calls to the
directory just deleted that then abort with VNOVNODE, indicating deletion
of the target directory.

This seems to stem from userspace attempting to stat the directory or
something in it:

    afs_select_fileserver+0x46d/0xaa2
    afs_wait_for_operation+0x12/0x17e
    afs_fetch_status+0x56/0x75
    afs_validate+0xfb/0x240
    afs_permission+0xef/0x1b0
    inode_permission+0x90/0x139
    link_path_walk.part.0.constprop.0+0x6f/0x2f0
    path_lookupat+0x4c/0xfa
    filename_lookup+0x63/0xd7
    vfs_statx+0x62/0x13f
    vfs_fstatat+0x72/0x8a

The issue appears to be that afs_dir_remove_subdir() marks the callback
promise as being cancelled by setting the expiry time to AFS_NO_CB_PROMISE
- which then confuses afs_validate() which sends the FetchStatus to try and
get a new one before it checks for the AFS_VNODE_DELETED flag which
indicates that we know the directory got deleted.

Fix this by:

 (1) Make afs_check_validity() return true if AFS_VNODE_DELETED is set, and
     then tweak the return from afs_validate() if the DELETED flag is set.

 (2) Move the AFS_VNODE_DELETED check in afs_validate() up above the
     expiration check to immediately after we've grabbed the validate_lock.

Fixes: 453924de62 ("afs: Overhaul invalidation handling to better support RO volumes")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20240313081505.3060173-3-dhowells@redhat.com
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-14 12:13:21 +01:00
..
addr_list.c afs: Remove the unimplemented afs_cmp_addr_list() 2024-01-01 16:37:26 +00:00
addr_prefs.c afs: Mark address lists with configured priorities 2024-01-01 16:37:27 +00:00
afs_cm.h
afs_fs.h
afs_vl.h
afs.h afs: Parse the VolSync record in the reply of a number of RPC ops 2024-01-01 16:37:27 +00:00
callback.c afs: Overhaul invalidation handling to better support RO volumes 2024-01-01 16:37:27 +00:00
cell.c afs: Overhaul invalidation handling to better support RO volumes 2024-01-01 16:37:27 +00:00
cmservice.c rxrpc, afs: Allow afs to pin rxrpc_peer objects 2023-12-24 15:22:50 +00:00
dir_edit.c afs: fix the afs_dir_get_folio return value 2023-05-06 10:10:08 -07:00
dir_silly.c afs: Simplify error handling 2023-12-24 15:22:53 +00:00
dir.c afs: Revert "afs: Hide silly-rename files from userspace" 2024-03-14 11:51:08 +01:00
dynroot.c afs: Remove afs_dynroot_d_revalidate() as it is redundant 2024-01-22 22:30:14 +00:00
file.c afs: fix __afs_break_callback() / afs_drop_open_mmap() race 2024-02-25 02:10:31 -05:00
flock.c afs: adapt to breakup of struct file_lock 2024-02-05 13:11:42 +01:00
fs_operation.c afs: Fix fileserver rotation 2024-01-01 16:37:27 +00:00
fs_probe.c afs: Fix fileserver rotation 2024-01-01 16:37:27 +00:00
fsclient.c afs: trace: Log afs_make_call(), including server address 2024-01-01 16:37:27 +00:00
inode.c vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
internal.h afs: Fix ignored callbacks over ipv4 2024-02-20 09:51:21 +01:00
Kconfig
main.c afs: Fix ignored callbacks over ipv4 2024-02-20 09:51:21 +01:00
Makefile afs: Move the vnode/volume validity checking code into its own file 2024-01-01 16:37:27 +00:00
misc.c afs: Simplify error handling 2023-12-24 15:22:53 +00:00
mntpt.c
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: Don't cache preferred address 2024-03-14 12:13:21 +01:00
rxrpc.c afs: trace: Log afs_make_call(), including server address 2024-01-01 16:37:27 +00:00
security.c fs: port ->permission() to pass mnt_idmap 2023-01-19 09:24:28 +01:00
server_list.c afs: Fix fileserver rotation 2024-01-01 16:37:27 +00:00
server.c afs: Fix ignored callbacks over ipv4 2024-02-20 09:51:21 +01:00
super.c vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
validation.c afs: Fix occasional rmdir-then-VNOVNODE with generic/011 2024-03-14 12:13:21 +01:00
vl_alias.c afs: Defer volume record destruction to a workqueue 2024-01-01 16:37:27 +00:00
vl_list.c afs: Dispatch vlserver probes in priority order 2024-01-01 16:37:27 +00:00
vl_probe.c afs: Keep a record of the current fileserver endpoint state 2024-01-01 16:37:27 +00:00
vl_rotate.c afs: Add some more info to /proc/net/afs/servers 2024-01-01 16:36:58 +00:00
vlclient.c afs: Don't leave DONTUSE/NEWREPSITE servers out of server list 2024-01-01 16:37:27 +00:00
volume.c afs: Increase buffer size in afs_update_volume_status() 2024-02-20 09:51:21 +01:00
write.c vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
xattr.c afs: Add __counted_by for struct afs_acl and use struct_size() 2023-12-01 09:51:43 -08:00
xdr_fs.h
yfsclient.c afs: trace: Log afs_make_call(), including server address 2024-01-01 16:37:27 +00:00