HomeFreeBSD

install: Always use a temporary file.

Description

install: Always use a temporary file.

Previously, we would only use a temporary file if explicitly asked to
with the -S option, and even then, only if the target file already
existed. This meant that an outside observer looking for the target
file might see a partial file, and might see the file disappear and
then reappear.

With this patch, we always use a temporary file, ensuring atomicity.
The downside is slightly increased disk usage. The upside is never
having to worry about, for instance, cron jobs randomly failing if
they happen to run simultaneously with make installworld.

The -S option is retained, partly for compatibility, and partly
to control the use of fsync(2), which has a non-negligible cost
(approximately 10% increase in wall time for make installworld).

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: 0mp, brooks, imp, markj
Differential Revision: https://reviews.freebsd.org/D44742

Details

Provenance
desAuthored on Apr 12 2024, 5:30 PM
Reviewer
0mp
Differential Revision
D44742: install: Always use a temporary file.
Parents
rGbfd2ce2a5a61: efidev: Allow for optionally including efidev and efirtc into the kernel
Branches
Unknown
Tags
Unknown