]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: also remove default deps from /proc/self/mountinfo when it is updated
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 14 May 2022 20:49:01 +0000 (05:49 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Aug 2022 16:35:38 +0000 (01:35 +0900)
The dependencies tagged with UNIT_DEPENDENCY_MOUNTINFO_DEFAULT depend
on both /proc/self/mountinfo and corresponding .mount unit file.
Hence, if some information from mountinfo is updated, e.g. device mounted
on the path, we need to update the dependencies.

src/core/mount.c

index 229b3de4fd2b0cb1e5e9d9ac22bf5e475aa57fa2..71da69cbb5f4dd4b3188ade6eec5111b7aae08a2 100644 (file)
@@ -909,7 +909,7 @@ static void mount_enter_dead(Mount *m, MountResult f) {
         dynamic_creds_destroy(&m->dynamic_creds);
 
         /* Any dependencies based on /proc/self/mountinfo are now stale */
-        unit_remove_dependencies(UNIT(m), UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT);
+        unit_remove_dependencies(UNIT(m), UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT | UNIT_DEPENDENCY_MOUNTINFO_DEFAULT);
 }
 
 static void mount_enter_mounted(Mount *m, MountResult f) {
@@ -1675,7 +1675,7 @@ static int mount_setup_existing_unit(
                 /* If things changed, then make sure that all deps are regenerated. Let's
                  * first remove all automatic deps, and then add in the new ones. */
 
-                unit_remove_dependencies(u, UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT);
+                unit_remove_dependencies(u, UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT | UNIT_DEPENDENCY_MOUNTINFO_DEFAULT);
 
                 r = mount_add_non_exec_dependencies(MOUNT(u));
                 if (r < 0)