]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/coredump/coredump.c
coredump: fix bug that loses core dump files when core dumps are compressed and disk... 2240/head
authorHayden Walles <hgwalles@gmail.com>
Wed, 23 Dec 2015 18:59:31 +0000 (13:59 -0500)
committerHayden Walles <hgwalles@gmail.com>
Mon, 25 Jan 2016 17:21:11 +0000 (12:21 -0500)
commit5f3e0a74689f2acf05c37f5203acec0b8d067458
tree6c8646800fedd459208e5f396064c480015798cd
parent654d1b335030acccf0894a58b7a30e3130b05383
coredump: fix bug that loses core dump files when core dumps are compressed and disk space is low.

Previously the save_external_coredump function returned a file
descriptor corresponding to the dumped file.  This descriptor was used
for two different purposes by calling code: a) access to the raw core
dump data; b) testing candidate files (via inode comparisons) while
vacuuming to protect the current core dump from vacuuming.

The descriptor returned always corresponded to a file containing the raw
core dump data.  However if compresson was used and the core dump was
compressed then the descriptor returned did not correspond to the file
that would eventually be left on disk (ie the compressed file).  Thus
the file was never protected by vacuuming.  When disk space was low all
core dumps including the current one would be vacuumed and the
corresponding log message referred to a file that no longer existed.

This resulted in the following error message from coredumpctl if the
missing core dump was requested:
   Cannot retrieve coredump from journal nor disk.
   Failed to retrieve core: No such file or directory

save_external_coredump now returns two descriptors, one to be used for
inode comparisons to prevent overzealous vacuuming and one to be used
for raw data access.  When compression is not used the returned inode
comparison descriptor will be invalid, indicating that the raw data
access descriptor should be used for inode comparisons as well.

Corresponding use of save_external_coredump and the returned
descriptors also updated.
src/journal/coredump.c