chiark / gitweb /
automount: fix segfault when shutting down
authorLennart Poettering <lennart@poettering.net>
Fri, 21 Jan 2011 00:13:09 +0000 (01:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 Jan 2011 00:13:15 +0000 (01:13 +0100)
https://bugs.freedesktop.org/show_bug.cgi?id=32076

TODO
src/mount.c

diff --git a/TODO b/TODO
index 57802a6555b3f7d7fa808e3279f16d57b82732aa..5957b960c6bc959fec810532ce3510c8b706245a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,9 +9,6 @@ Bugs:
 * somehow some /etc/fstab supplied mount params are never applied to api fs
   https://bugzilla.redhat.com/show_bug.cgi?id=663108
 
 * somehow some /etc/fstab supplied mount params are never applied to api fs
   https://bugzilla.redhat.com/show_bug.cgi?id=663108
 
-* automount units can cause a segfault:
-  https://bugs.freedesktop.org/show_bug.cgi?id=32076
-
 * bind mounts with 'fsck' fail and block for a minute:
     /foo /bar none bind 1 1
   (requesting fsck is wrong, but why do we block for a minute
 * bind mounts with 'fsck' fail and block for a minute:
     /foo /bar none bind 1 1
   (requesting fsck is wrong, but why do we block for a minute
index f978a5467d2f542e76046f7292ecafa8168585b0..aae9d982ae2e478ebd565a8e2bb7e47305e5f7aa 100644 (file)
@@ -98,12 +98,21 @@ static void mount_parameters_done(MountParameters *p) {
 
 static void mount_done(Unit *u) {
         Mount *m = MOUNT(u);
 
 static void mount_done(Unit *u) {
         Mount *m = MOUNT(u);
+        Meta *other;
 
         assert(m);
 
         free(m->where);
         m->where = NULL;
 
 
         assert(m);
 
         free(m->where);
         m->where = NULL;
 
+        /* Try to detach us from the automount unit if there is any */
+        LIST_FOREACH(units_per_type, other, m->meta.manager->units_per_type[UNIT_AUTOMOUNT]) {
+                Automount *a = (Automount*) other;
+
+                if (a->mount == m)
+                        a->mount = NULL;
+        }
+
         mount_parameters_done(&m->parameters_etc_fstab);
         mount_parameters_done(&m->parameters_proc_self_mountinfo);
         mount_parameters_done(&m->parameters_fragment);
         mount_parameters_done(&m->parameters_etc_fstab);
         mount_parameters_done(&m->parameters_proc_self_mountinfo);
         mount_parameters_done(&m->parameters_fragment);