diff mbox series

fstools: block: No mount after reload_config confusion

Message ID 0444a7832f4a6f588fc157e45b2ec496c7150c5a.camel@newmedia-net.de
State Not Applicable
Delegated to: Petr Štetiar
Headers show
Series fstools: block: No mount after reload_config confusion | expand

Commit Message

Daniel Danzberger May 6, 2021, 8:55 a.m. UTC
Hi,

when adding a new 'mount' to /etc/config/fstab and executing
reload_config afterwards, I noticed that the new 'mount' is not mounted
automatically.
It is mounted however after reboot or executing 'block mount' manually.

Checking the block util's 'autofs start' which is invoked after a
config change event, it seems like a mount is only invoked when the
device has already been mounted:

--
	blockd_notify("hotplug", pr->dev, m, pr);
	if ((!m || !m->autofs) && (mp = find_mount_point(pr->dev))) {
		blockd_notify("mount", pr->dev, NULL, NULL);
		free(mp);
	}
--

Which makes no sense to me. Shouldn't it be the other way around ?
Like so:
diff mbox series

Patch

diff --git a/block.c b/block.c
index c6d93d1..17d33d1 100644
--- a/block.c
+++ b/block.c
@@ -1179,9 +1179,11 @@  static int main_autofs(int argc, char **argv)
                                continue;
 
   blockd_notify("hotplug", pr->dev, m, pr);
-  if ((!m || !m->autofs) && (mp = find_mount_point(pr->dev))) {
-    blockd_notify("mount", pr->dev, NULL, NULL);
-    free(mp);
+  if ((!m || !m->autofs)) {
+    if ((mp = find_mount_point(pr->dev)))
+       free(mp);
+    else
+       blockd_notify("mount", pr->dev, NULL, NULL);
     }
    }
   } else {