linux-stable/fs
David Howells 9e655a8b87 afs: Fix afs_getattr() to refetch file status if callback break occurred
[ Upstream commit 2aeb8c86d4 ]

If a callback break occurs (change notification), afs_getattr() needs to
issue an FS.FetchStatus RPC operation to update the status of the file
being examined by the stat-family of system calls.

Fix afs_getattr() to do this if AFS_VNODE_CB_PROMISED has been cleared
on a vnode by a callback break.  Skip this if AT_STATX_DONT_SYNC is set.

This can be tested by appending to a file on one AFS client and then
using "stat -L" to examine its length on a machine running kafs.  This
can also be watched through tracing on the kafs machine.  The callback
break is seen:

     kworker/1:1-46      [001] .....   978.910812: afs_cb_call: c=0000005f YFSCB.CallBack
     kworker/1:1-46      [001] ...1.   978.910829: afs_cb_break: 100058:23b4c:242d2c2 b=2 s=1 break-cb
     kworker/1:1-46      [001] .....   978.911062: afs_call_done:    c=0000005f ret=0 ab=0 [0000000082994ead]

And then the stat command generated no traffic if unpatched, but with
this change a call to fetch the status can be observed:

            stat-4471    [000] .....   986.744122: afs_make_fs_call: c=000000ab 100058:023b4c:242d2c2 YFS.FetchStatus
            stat-4471    [000] .....   986.745578: afs_call_done:    c=000000ab ret=0 ab=0 [0000000087fc8c84]

Fixes: 08e0e7c82e ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.")
Reported-by: Markus Suvanto <markus.suvanto@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Tested-by: Markus Suvanto <markus.suvanto@gmail.com>
Tested-by: kafs-testing+fedora34_64checkkafs-build-496@auristor.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216010
Link: https://lore.kernel.org/r/165308359800.162686.14122417881564420962.stgit@warthog.procyon.org.uk/ # v1
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-05-25 09:59:15 +02:00
..
9p Revert "fs/9p: search open fids first" 2022-01-30 22:13:37 +09:00
adfs fs/adfs: remove unneeded variable make code cleaner 2022-01-20 08:52:55 +02:00
affs
afs afs: Fix afs_getattr() to refetch file status if callback break occurred 2022-05-25 09:59:15 +02:00
autofs
befs
bfs
btrfs btrfs: always log symlinks in full mode 2022-05-12 12:32:39 +02:00
cachefiles cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr 2022-04-20 09:36:13 +02:00
ceph ceph: fix setting of xattrs on async created inodes 2022-05-18 10:28:21 +02:00
cifs smb3: cleanup and clarify status of tree connections 2022-05-25 09:59:01 +02:00
coda
configfs configfs: fix a race in configfs_{,un}register_subsystem() 2022-02-22 18:30:28 +01:00
cramfs
crypto
debugfs
devpts fsnotify: fix fsnotify hooks in pseudo filesystems 2022-01-24 14:17:02 +01:00
dlm
ecryptfs
efivarfs
efs
erofs erofs: fix use-after-free of on-stack io[] 2022-05-09 09:16:28 +02:00
exfat
exportfs
ext2 ext2: correct max file size computing 2022-04-08 13:58:12 +02:00
ext4 ext4: fix bug_on in start_this_handle during umount filesystem 2022-05-09 09:16:27 +02:00
f2fs f2fs: should not truncate blocks during roll-forward recovery 2022-05-09 09:16:15 +02:00
fat FAT: use io_schedule_timeout() instead of congestion_wait() 2022-01-20 08:52:54 +02:00
freevxfs
fscache fscache: Fix the volume collision wait condition 2022-01-21 21:36:28 +00:00
fuse fuse: fix pipe buffer lifetime for direct_io 2022-03-07 16:30:44 +01:00
gfs2 gfs2: Disable page faults during lockless buffered reads 2022-05-25 09:58:59 +02:00
hfs
hfsplus hfsplus: use struct_group_attr() for memcpy() region 2022-01-20 08:52:54 +02:00
hostfs
hpfs
hugetlbfs mm, hugetlb: allow for "high" userspace addresses 2022-04-27 14:41:11 +02:00
iomap iomap: Fix iomap_invalidatepage tracepoint 2022-04-08 13:57:40 +02:00
isofs
jbd2 jbd2: fix a potential race while discarding reserved buffers after an abort 2022-04-27 14:41:16 +02:00
jffs2 jffs2: fix memory leak in jffs2_scan_medium 2022-04-08 13:57:19 +02:00
jfs jfs: prevent NULL deref in diFree 2022-04-13 19:27:26 +02:00
kernfs kernfs: fix NULL dereferencing in kernfs_remove 2022-05-09 09:16:14 +02:00
ksmbd ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION 2022-05-09 09:16:28 +02:00
lockd Notable bug fixes: 2022-02-02 10:14:31 -08:00
minix minix: fix bug when opening a file with O_DIRECT 2022-04-13 19:27:23 +02:00
netfs netfs: Make ops->init_rreq() optional 2022-01-21 21:36:28 +00:00
nfs nfs: fix broken handling of the softreval mount option 2022-05-18 10:28:14 +02:00
nfs_common
nfsd nfsd: Fix a write performance regression 2022-04-20 09:36:11 +02:00
nilfs2 nilfs2: fix lockdep warnings during disk space reclamation 2022-05-25 09:59:02 +02:00
nls
notify fanotify: do not allow setting dirent events in mask of non-dir 2022-05-18 10:28:14 +02:00
ntfs ntfs: add sanity check on allocation size 2022-04-08 13:58:41 +02:00
ntfs3 mm: remove cleancache 2022-01-22 08:33:38 +02:00
ocfs2 ocfs2: fix crash when mount with quota enabled 2022-04-08 13:57:22 +02:00
omfs
openpromfs
orangefs
overlayfs overlayfs fixes for 5.17-rc3 2022-02-01 11:23:02 -08:00
proc procfs: prevent unprivileged processes accessing fdinfo dir 2022-05-18 10:28:14 +02:00
pstore pstore: Don't use semaphores in always-atomic-context code 2022-04-08 13:57:27 +02:00
qnx4
qnx6
quota quota: make dquot_quota_sync return errors from ->sync_fs 2022-01-30 08:59:47 -08:00
ramfs
reiserfs
romfs
smbfs_common
squashfs
sysfs
sysv
tracefs tracefs: Set the group ownership in apply_options() not parse_options() 2022-02-25 21:05:04 -05:00
ubifs ubifs: rename_whiteout: correct old_dir size computing 2022-04-08 13:58:53 +02:00
udf udf: Avoid using stale lengthOfImpUse 2022-05-15 20:20:52 +02:00
ufs
unicode Fix from Christoph Hellwig merging the CONFIG_UNICODE_UTF8_DATA into the 2022-02-01 11:13:24 -08:00
vboxsf
verity
xfs Bug fixes for 5.17-rc4: 2022-02-26 09:53:19 -08:00
zonefs zonefs: Clear inode information flags on inode creation 2022-05-09 09:16:29 +02:00
aio.c aio: move aio sysctl to aio.c 2022-01-22 08:33:34 +02:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE" 2022-04-20 09:36:24 +02:00
binfmt_elf_fdpic.c coredump: Snapshot the vmas in do_coredump 2022-04-08 13:59:04 +02:00
binfmt_flat.c
binfmt_misc.c Fix regression due to "fs: move binfmt_misc sysctl to its own file" 2022-02-09 09:50:02 -08:00
binfmt_script.c
buffer.c mm: fs: fix lru_cache_disabled race in bh_lru 2022-04-08 13:57:19 +02:00
char_dev.c
compat_binfmt_elf.c
coredump.c coredump: Use the vma snapshot in fill_files_note 2022-04-08 13:59:04 +02:00
d_path.c
dax.c
dcache.c fs: move dcache sysctls to its own file 2022-01-22 08:33:36 +02:00
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c eventpoll: simplify sysctl declaration with register_sysctl() 2022-01-22 08:33:35 +02:00
exec.c exec: Force single empty string when argv is empty 2022-04-08 13:57:28 +02:00
fcntl.c
fhandle.c
file.c fs: fix fd table size alignment properly 2022-04-08 13:58:35 +02:00
file_table.c SUNRPC: Ensure we flush any closed sockets before xs_xprt_free() 2022-04-13 19:27:40 +02:00
filesystems.c
fs-writeback.c writeback: Avoid skipping inode writeback 2022-05-18 10:28:21 +02:00
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fsopen.c
init.c
inode.c fs: move inode sysctls to its own file 2022-01-22 08:33:35 +02:00
internal.h
io-wq.c io_uring-5.17-2022-01-21 2022-01-21 16:07:21 +02:00
io-wq.h io_uring: stop using io_wq_work as an fd placeholder 2022-04-20 09:36:15 +02:00
io_uring.c io_uring: assign non-fixed early for async work 2022-05-18 10:28:17 +02:00
ioctl.c fs: fix an infinite loop in iomap_fiemap 2022-05-25 09:59:01 +02:00
Kconfig ksmbd: add support for key exchange 2022-02-04 00:12:22 -06:00
Kconfig.binfmt
kernel_read_file.c
libfs.c unicode: clean up the Kconfig symbol confusion 2022-01-20 19:57:24 -05:00
locks.c fs: move locking sysctls where they are used 2022-01-22 08:33:36 +02:00
Makefile Fix from Christoph Hellwig merging the CONFIG_UNICODE_UTF8_DATA into the 2022-02-01 11:13:24 -08:00
mbcache.c
mount.h
mpage.c mm: remove cleancache 2022-01-22 08:33:38 +02:00
namei.c VFS: filename_create(): fix incorrect intent. 2022-04-27 14:41:10 +02:00
namespace.c fs: add kernel doc for mnt_{hold,unhold}_writers() 2022-02-14 08:35:32 +01:00
no-block.c
nsfs.c
open.c
pipe.c watch_queue: Fix lack of barrier/sync/lock between post and read 2022-03-11 10:17:13 -08:00
pnode.c
pnode.h
posix_acl.c fs: fix acl translation 2022-04-27 14:41:14 +02:00
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c stat: fix inconsistency between struct stat and struct compat_stat 2022-04-27 14:41:10 +02:00
statfs.c
super.c vfs: make freeze_super abort when sync_filesystem returns error 2022-01-30 08:59:47 -08:00
sync.c vfs: make sync_filesystem return errors from ->sync_fs 2022-01-30 08:59:47 -08:00
sysctls.c fs: move namespace sysctls and declare fs base directory 2022-01-22 08:33:36 +02:00
timerfd.c
userfaultfd.c mm: refactor vm_area_struct::anon_vma_name usage code 2022-03-05 11:08:32 -08:00
utimes.c
xattr.c fs: fix acl translation 2022-04-27 14:41:14 +02:00