core: mount namespaces: Remove auxiliary bind mounts directory after unit termination

Unit that requires its own mount namespace creates a temporary directory
to implement dynamic bind mounts (org.freedesktop.systemd1.Manager.BindMountUnit).
However, this directory is never removed and they will accumulate for
each unique unit (e.g. templated units of systemd-coredump@).

Attach the auxiliary runtime directory existence to lifetime of other
"runtime" only per-unit directories.
This commit is contained in:
Michal Koutný
2023-01-19 21:58:10 +01:00
committed by Lennart Poettering
parent 2f7fe6199c
commit b9f976fb45
3 changed files with 19 additions and 0 deletions
+1
View File
@@ -5765,6 +5765,7 @@ void unit_destroy_runtime_data(Unit *u, const ExecContext *context) {
exec_context_destroy_runtime_directory(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
exec_context_destroy_credentials(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME], u->id);
exec_context_destroy_mount_ns_dir(u);
}
int unit_clean(Unit *u, ExecCleanMask mask) {