* [PATCH] afs: Fix afs_getattr() to refetch file status if callback break occurred
@ 2022-05-20 21:53 David Howells
2022-05-21 6:44 ` markus.suvanto
0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2022-05-20 21:53 UTC (permalink / raw)
To: Markus Suvanto
Cc: Marc Dionne, linux-afs, dhowells, linux-fsdevel, linux-kernel
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: 08e0e7c82eea ("[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
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216010
---
fs/afs/inode.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 2fe402483ad5..30b066299d39 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -740,10 +740,22 @@ int afs_getattr(struct user_namespace *mnt_userns, const struct path *path,
{
struct inode *inode = d_inode(path->dentry);
struct afs_vnode *vnode = AFS_FS_I(inode);
- int seq = 0;
+ struct key *key;
+ int ret, seq = 0;
_enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
+ if (!(query_flags & AT_STATX_DONT_SYNC) &&
+ !test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
+ key = afs_request_key(vnode->volume->cell);
+ if (IS_ERR(key))
+ return PTR_ERR(key);
+ ret = afs_validate(vnode, key);
+ key_put(key);
+ if (ret < 0)
+ return ret;
+ }
+
do {
read_seqbegin_or_lock(&vnode->cb_lock, &seq);
generic_fillattr(&init_user_ns, inode, stat);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] afs: Fix afs_getattr() to refetch file status if callback break occurred
2022-05-20 21:53 [PATCH] afs: Fix afs_getattr() to refetch file status if callback break occurred David Howells
@ 2022-05-21 6:44 ` markus.suvanto
0 siblings, 0 replies; 3+ messages in thread
From: markus.suvanto @ 2022-05-21 6:44 UTC (permalink / raw)
To: David Howells; +Cc: Marc Dionne, linux-afs, linux-fsdevel, linux-kernel
pe, 2022-05-20 kello 22:53 +0100, David Howells kirjoitti:
> 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: 08e0e7c82eea ("[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
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216010
> ---
>
> fs/afs/inode.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/fs/afs/inode.c b/fs/afs/inode.c
> index 2fe402483ad5..30b066299d39 100644
> --- a/fs/afs/inode.c
> +++ b/fs/afs/inode.c
> @@ -740,10 +740,22 @@ int afs_getattr(struct user_namespace
> *mnt_userns, const struct path *path,
> {
> struct inode *inode = d_inode(path->dentry);
> struct afs_vnode *vnode = AFS_FS_I(inode);
> - int seq = 0;
> + struct key *key;
> + int ret, seq = 0;
>
> _enter("{ ino=%lu v=%u }", inode->i_ino, inode-
> >i_generation);
>
> + if (!(query_flags & AT_STATX_DONT_SYNC) &&
> + !test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
> + key = afs_request_key(vnode->volume->cell);
> + if (IS_ERR(key))
> + return PTR_ERR(key);
> + ret = afs_validate(vnode, key);
> + key_put(key);
> + if (ret < 0)
> + return ret;
> + }
> +
> do {
> read_seqbegin_or_lock(&vnode->cb_lock, &seq);
> generic_fillattr(&init_user_ns, inode, stat);
>
>
Tested-by: Markus Suvanto <markus.suvanto@gmail.com>
-Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] afs: Fix afs_getattr() to refetch file status if callback break occurred
@ 2022-05-21 7:18 David Howells
0 siblings, 0 replies; 3+ messages in thread
From: David Howells @ 2022-05-21 7:18 UTC (permalink / raw)
To: torvalds
Cc: Markus Suvanto, Marc Dionne, linux-afs, Markus Suvanto,
kafs-testing+fedora34_64checkkafs-build-496, dhowells,
linux-fsdevel, linux-kernel
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: 08e0e7c82eea ("[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
---
fs/afs/inode.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 2fe402483ad5..30b066299d39 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -740,10 +740,22 @@ int afs_getattr(struct user_namespace *mnt_userns, const struct path *path,
{
struct inode *inode = d_inode(path->dentry);
struct afs_vnode *vnode = AFS_FS_I(inode);
- int seq = 0;
+ struct key *key;
+ int ret, seq = 0;
_enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
+ if (!(query_flags & AT_STATX_DONT_SYNC) &&
+ !test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
+ key = afs_request_key(vnode->volume->cell);
+ if (IS_ERR(key))
+ return PTR_ERR(key);
+ ret = afs_validate(vnode, key);
+ key_put(key);
+ if (ret < 0)
+ return ret;
+ }
+
do {
read_seqbegin_or_lock(&vnode->cb_lock, &seq);
generic_fillattr(&init_user_ns, inode, stat);
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-21 7:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 21:53 [PATCH] afs: Fix afs_getattr() to refetch file status if callback break occurred David Howells
2022-05-21 6:44 ` markus.suvanto
2022-05-21 7:18 David Howells
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.