core/mount: don't keep cred mounts around after mounted

Follow-up for 6577cf1ba9
This commit is contained in:
Mike Yuan
2024-12-13 10:29:27 +00:00
committed by Luca Boccassi
parent 1ca315be00
commit 8abeebdf83
+8
View File
@@ -935,6 +935,14 @@ static void mount_enter_mounted(Mount *m, MountResult f) {
if (m->result == MOUNT_SUCCESS)
m->result = f;
/* Refer to service_set_state() handling of SERVICE_EXITED state for rationale. In particular
* for mount units let's not leave cred mounts around, otherwise the actual number of mounts would be
* somewhat doubled.
*
* Note that this effectively means fresh creds are used during remount, but that's mostly what
* users would expect anyways. */
unit_destroy_runtime_data(UNIT(m), &m->exec_context, /* destroy_runtime_dir = */ false);
mount_set_state(m, MOUNT_MOUNTED);
}