summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorDanny Lin <danny@orbstack.dev>2024-04-14 03:34:31 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2024-04-15 11:12:44 +0300
commiteb4b691b9115fae4c844f5941418335575cf667f (patch)
treeaa8dadfa942c65ef35d2167268b66d6383e80ddf /fs/fuse
parent7cc911262835419fe469ebfae89891c0e97c62ef (diff)
downloadlinux-eb4b691b9115fae4c844f5941418335575cf667f.tar.xz
fuse: fix leaked ENOSYS error on first statx call
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> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 4a6df591add6..2b0d4781f394 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1321,6 +1321,7 @@ retry:
err = fuse_do_statx(inode, file, stat);
if (err == -ENOSYS) {
fc->no_statx = 1;
+ err = 0;
goto retry;
}
} else {