Skip to content

Commit 8ed7c6b

Browse files
committed
passthrough: don't flood log with unnecessary error logs
We now take use from_name_at() to query mnt id in do_lookup() and other places, and if the underlying filesystem doesn't support file handle, from_name_at() will print an error message and return ENOTSUPP. And we ignore this error in open_file_or_handle(). But the error message will flood the log. Similarly, we print an error message when open_file_or_handle() returns an error in do_lookup(), so we flood the log every time we lookup a non-existent file, and it's totall fine to return ENOENT to fuse client, it's not a fuse internal error. For example: "from_name_at failed error Os { code: 95, kind: Other, message: \"Not supported\" }","level":"ERRO" "fuse: do_lookup: failed to get file or handle: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }","level":"ERRO" So let's stop flooding the log. Signed-off-by: Eryu Guan <[email protected]>
1 parent dca029e commit 8ed7c6b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/passthrough/file_handle.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ impl FileHandle {
130130
})
131131
} else {
132132
let e = io::Error::last_os_error();
133-
error!("from_name_at failed error {:?}", e);
134133
Err(e)
135134
}
136135
}
@@ -151,7 +150,10 @@ impl FileHandle {
151150
where
152151
F: FnOnce(RawFd, libc::c_int) -> io::Result<File>,
153152
{
154-
let handle = Self::from_name_at(dir_fd, path)?;
153+
let handle = Self::from_name_at(dir_fd, path).map_err(|e| {
154+
error!("from_name_at failed error {:?}", e);
155+
e
156+
})?;
155157

156158
mount_fds.ensure_mount_point(handle.mnt_id, dir_fd, path, reopen_dir)?;
157159

src/passthrough/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,7 @@ impl<D: AsyncDrive, S: BitmapSlice + Send + Sync> PassthroughFs<D, S> {
754754
name,
755755
&self.mount_fds,
756756
|fd, flags| Self::open_proc_file(&self.proc, fd, flags),
757-
)
758-
.map_err(|e| {
759-
error!("fuse: do_lookup: failed to get file or handle: {:?}", e);
760-
e
761-
})?;
757+
)?;
762758

763759
let mut found = None;
764760
'search: loop {

0 commit comments

Comments
 (0)