Skip to content
  • Benjamin Berg's avatar
    cgroupify: Fix leaking inotify handler for empty cgroups · 5706224b
    Benjamin Berg authored
    If we create a new cgroup but do not manage to move a PID into it, then
    we ended up leaking the inotify handler. This is because the
    IN_DELETE_SELF will never actually fire at a time that we wanted. We'll
    get an event either way when there is a process because the removal of
    the last process is a change in itself.
    
    As such, only listen for IN_MODIFY and unref the inotify watch ourselves
    in case we succeed in deleting the cgroup again (or, in case someone
    else managed to race with us and it is gone already).
    
    Fixes: #6
    5706224b