[systemd-devel] [PATCH v2] systemd-bootchart: Prevent closing random file descriptors

Daniel Mack daniel at zonque.org
Sun Mar 29 16:09:59 PDT 2015


On 03/29/2015 08:41 PM, Alexander Sverdlin wrote:
> If the kernel has no CONFIG_SCHED_DEBUG option set, systemd-bootchart produces
> empty .svg file. The reason for this is very fragile file descriptor logic in
> log_sample() and main() (/* do some cleanup, close fd's */ block). There are
> many places where file descriptors are closed on failure (missing SCHED_DEBUG
> provokes it), but there are several problems with it:
>  - following iterations in the loop see that the descriptor is non zero and do
>    not open the corresponding file again;
>  - "some cleanup" code closes already closed files and the descriptors are reused
>    already, in particular for resulting .svg file;
>  - static "vmstat" and "schedstat" variables in log_sample() made the situation
>    even worse.

Looks good to me. Applied, thanks!


Daniel



More information about the systemd-devel mailing list