Page MenuHomeFreeBSD

savecore: bail on write error even when decompressing
ClosedPublic

Authored by rlibby on Dec 10 2020, 8:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 11 2024, 6:02 PM
Unknown Object (File)
Mar 11 2024, 6:02 PM
Unknown Object (File)
Mar 11 2024, 6:02 PM
Unknown Object (File)
Mar 8 2024, 3:10 AM
Unknown Object (File)
Jan 4 2024, 11:46 AM
Unknown Object (File)
Jan 4 2024, 11:46 AM
Unknown Object (File)
Jan 4 2024, 11:46 AM
Unknown Object (File)
Jan 4 2024, 2:39 AM
Subscribers

Details

Summary

gcc complained about the impossibility of the test nw < 0 in
DoRegularFile where nw is unsigned. Looking further, this was
preventing code from logging an error writing to the output file while
decompressing.

Test Plan

Tested by doing a zstd dump and then trying to savecore -u it to a
too-small tmpfs fs. Before this patch, savecore "succeeds" (exits 0)
but leaves a truncated core file. After this patch, savecore fails
(exits 1).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35325
Build 32256: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Dec 10 2020, 10:16 PM

Should we also add an fflush/fsync? We are now successfully failing--because we get an error early enough, but that is not guaranteed. Waiting for savecore to fsync could slow it down slightly, but that seems okay, given how rare this usually is.