HomeFreeBSD

nextboot: Smarter warning about deleting nextboot

Description

nextboot: Smarter warning about deleting nextboot

Read only filesystems always error when trying to remove something
with EROFS. However, that's true even if the file isn't there. The
code assumed it would always get a ENOENT if the file wasn't there,
but produced a gross message on read only systems. This message was
harmless, but annoying. Instead, stat the file first and return if
it's already not there.

Some readings of POSIX require that the ENOENT error take precidence
over the EROFS error. Linux made this change years ago, and we should
too. POSIX.1-2024 isn't explicit, but does say for unlink() does say
"[EROFS] The directory entry to be unlinked is part of a read-only file
system" and "[ENOENT] A component of path does not name an existing
file" implying that EROFS should only be returned for an existing
file. FreeBSD doesn't implement this, so this workaround is
necessary. Ideally, we'd fix this in the kernel in the future.

Sponsored by: Netflix
Discussed with: jrtc23
Differential Revision: https://reviews.freebsd.org/D48425

Details

Provenance
impAuthored on Tue, Jan 14, 5:32 PM
Differential Revision
D48425: nextboot: Smarter warning about deleting nextboot
Parents
rG618d1621c2d4: nvmecontrol: Fix error message for invalid Fabrics I/O queue size
Branches
Unknown
Tags
Unknown