cleanup mountpoints of partitions failing to mount
authorKristof Roelants <kr.roelants@gmail.com>
Fri, 9 Sep 2016 13:46:48 +0000 (15:46 +0200)
committerJohn Crispin <john@phrozen.org>
Wed, 14 Sep 2016 19:36:25 +0000 (21:36 +0200)
If a partition fails to mount, its autofs mountpoint is created and the mounted
flag is unset. When the partition expires or is removed, the autofs mountpoint
is cleaned up only if the mounted flag is set. Added cleanup of the autofs
mountpoint at removal and unset mounted flag.

Signed-off-by: Kristof Roelants <Kristof.Roelants@technicolor.com>
mount.c

diff --git a/mount.c b/mount.c
index 7cbb8ff..8330abe 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -745,6 +745,8 @@ static void mount_enum_drives(void)
                        p->next->prev = p->prev;
                        p = p->next;
                        log_printf("removing %s\n", q->dev);
                        p->next->prev = p->prev;
                        p = p->next;
                        log_printf("removing %s\n", q->dev);
+                       snprintf(tmp, 64, "%s%s", "/tmp/run/mountd/", q->dev);
+                       rmdir(tmp);
                        snprintf(tmp, 64, "%s%s", uci_path, q->name);
                        unlink(tmp);
                        system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name);
                        snprintf(tmp, 64, "%s%s", uci_path, q->name);
                        unlink(tmp);
                        system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name);