oomd: fix race with path unavailability when killing cgroups
authorAnita Zhang <the.anitazha@gmail.com>
Wed, 19 Jan 2022 18:40:46 +0000 (10:40 -0800)
committerLuca Boccassi <bluca@debian.org>
Mon, 14 Feb 2022 21:56:48 +0000 (21:56 +0000)
commit0456e3aaaae7c21a037f4d3c758463c3ba4d167c
treef509998e06c8ae767deb1c1a468326df3d72d5a2
parent740dd39e070b3b827cbac37df2a40d61bd9cdb89
oomd: fix race with path unavailability when killing cgroups

There can be a situation where systemd-oomd would kill all of the processes
in a cgroup, pid1 would clean up that cgroup, and systemd-oomd would get
ENODEV trying to iterate the cgroup a final time to ensure it was empty.
systemd-oomd sees this as an error and immediately picks a new candidate even
though pressure may have recovered. To counter this, check and handle
path unavailability errnos specially.

Fixes: #22030
(cherry picked from commit 2ee209466bb51f39ae9df7fec4d5594ce8cfa3f0)
src/oom/oomd-util.c