Skip to content

Commit

Permalink
Auto merge of rust-lang#123928 - tbu-:pr_statx_enosys, r=workingjubilee
Browse files Browse the repository at this point in the history
`statx` probe: `ENOSYS` might come from a faulty FUSE driver

Do the availability check regardless of the error returned from `statx`.

CC rust-lang#122079 (comment)
  • Loading branch information
bors committed Apr 15, 2024
2 parents 1d8f4a6 + 2325b81 commit 9db7a74
Showing 1 changed file with 5 additions and 8 deletions.
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 @@ -198,20 +198,17 @@ cfg_has_statx! {{
return Some(Err(err));
}

// Availability not checked yet.
// `ENOSYS` might come from a faulty FUSE driver.
//
// 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

0 comments on commit 9db7a74

Please sign in to comment.