Skip to content

statx probe: ENOSYS might come from a faulty FUSE driver #123928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions library/std/src/sys/pal/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,17 @@ cfg_has_statx! {{
return Some(Err(err));
}

// Availability not checked yet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initial line is still relevant. Please restore it.

// `ENOSYS` might come from a faulty FUSE driver.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment only makes sense in light of the immediately previous version. Please explain it as if the reader has encountered the first time. So: Why are you starting off by mentioning ENOSYS here? Instead say something like "Syscalls can return errors from things other than the kernel per se, like a filesystem driver, so we can't assume this is relevant for all files."

//
// First try the cheap way.
if err.raw_os_error() == Some(libc::ENOSYS) {
STATX_SAVED_STATE.store(STATX_STATE::Unavailable as u8, Ordering::Relaxed);
return None;
}

// Error other than `ENOSYS` is not a good enough indicator -- it is
// Other errors are not a good enough indicator either -- it is
// known that `EPERM` can be returned as a result of using seccomp to
// block the syscall.
//
// Availability is checked by performing a call which expects `EFAULT`
// if the syscall is usable.
//
// See: https://github.com/rust-lang/rust/issues/65662
//
// FIXME this can probably just do the call if `EPERM` was received, but
// previous iteration of the code checked it for all errors and for now
// this is retained.
Expand Down
Loading