fstools: block: No mount after reload_config confusion

Daniel Danzberger danzberger at newmedia-net.de
Thu May 6 09:55:12 BST 2021


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 --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 {

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans




More information about the openwrt-devel mailing list