Skip to content

Commit 2aeb8c8

Browse files
dhowellstorvalds
authored andcommitted
afs: Fix afs_getattr() to refetch file status if callback break occurred
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: 08e0e7c ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.") Reported-by: Markus Suvanto <[email protected]> Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected] Tested-by: Markus Suvanto <[email protected]> Tested-by: [email protected] 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 <[email protected]>
1 parent 978df3e commit 2aeb8c8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

fs/afs/inode.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,22 @@ int afs_getattr(struct user_namespace *mnt_userns, const struct path *path,
740740
{
741741
struct inode *inode = d_inode(path->dentry);
742742
struct afs_vnode *vnode = AFS_FS_I(inode);
743-
int seq = 0;
743+
struct key *key;
744+
int ret, seq = 0;
744745

745746
_enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
746747

748+
if (!(query_flags & AT_STATX_DONT_SYNC) &&
749+
!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
750+
key = afs_request_key(vnode->volume->cell);
751+
if (IS_ERR(key))
752+
return PTR_ERR(key);
753+
ret = afs_validate(vnode, key);
754+
key_put(key);
755+
if (ret < 0)
756+
return ret;
757+
}
758+
747759
do {
748760
read_seqbegin_or_lock(&vnode->cb_lock, &seq);
749761
generic_fillattr(&init_user_ns, inode, stat);

0 commit comments

Comments
 (0)