* [PATCH] fuse: fix leaked ENOSYS error on first statx call
@ 2024-04-14 0:34 Danny Lin
2024-04-15 7:46 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Danny Lin @ 2024-04-14 0:34 UTC (permalink / raw)
To: danny; +Cc: stable, Miklos Szeredi, linux-fsdevel, linux-kernel
FUSE attempts to detect server support for statx by trying it once and
setting no_statx=1 if it fails with ENOSYS, but consider the following
scenario:
- Userspace (e.g. sh) calls stat() on a file
* succeeds
- Userspace (e.g. lsd) calls statx(BTIME) on the same file
- request_mask = STATX_BASIC_STATS | STATX_BTIME
- first pass: sync=true due to differing cache_mask
- statx fails and returns ENOSYS
- set no_statx and retry
- retry sets mask = STATX_BASIC_STATS
- now mask == cache_mask; sync=false (time_before: still valid)
- so we take the "else if (stat)" path
- "err" is still ENOSYS from the failed statx call
Fix this by zeroing "err" before retrying the failed call.
Fixes: d3045530bdd2 ("fuse: implement statx")
Cc: stable@vger.kernel.org # v6.6
Signed-off-by: Danny Lin <danny@orbstack.dev>
---
fs/fuse/dir.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index de452cdbf3cf..a63125ce70a4 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1362,6 +1362,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
err = fuse_do_statx(inode, file, stat);
if (err == -ENOSYS) {
fc->no_statx = 1;
+ err = 0;
goto retry;
}
} else {
--
2.44.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fuse: fix leaked ENOSYS error on first statx call
2024-04-14 0:34 [PATCH] fuse: fix leaked ENOSYS error on first statx call Danny Lin
@ 2024-04-15 7:46 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2024-04-15 7:46 UTC (permalink / raw)
To: Danny Lin; +Cc: stable, linux-fsdevel, linux-kernel
On Sun, 14 Apr 2024 at 02:34, Danny Lin <danny@orbstack.dev> wrote:
>
> FUSE attempts to detect server support for statx by trying it once and
> setting no_statx=1 if it fails with ENOSYS, but consider the following
> scenario:
>
> - Userspace (e.g. sh) calls stat() on a file
> * succeeds
> - Userspace (e.g. lsd) calls statx(BTIME) on the same file
> - request_mask = STATX_BASIC_STATS | STATX_BTIME
> - first pass: sync=true due to differing cache_mask
> - statx fails and returns ENOSYS
> - set no_statx and retry
> - retry sets mask = STATX_BASIC_STATS
> - now mask == cache_mask; sync=false (time_before: still valid)
> - so we take the "else if (stat)" path
> - "err" is still ENOSYS from the failed statx call
>
> Fix this by zeroing "err" before retrying the failed call.
Thanks, applied.
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-15 7:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-14 0:34 [PATCH] fuse: fix leaked ENOSYS error on first statx call Danny Lin
2024-04-15 7:46 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox