[OpenWrt-Devel] [PATCH 1/2] blockd: unmount device explicitly when it disappears
Rafał Miłecki
zajec5 at gmail.com
Wed Dec 12 09:24:34 EST 2018
From: Rafał Miłecki <rafal at milecki.pl>
To keep autofs behavior consistent blockd should request both: mounting
and unmounting when needed. It's important as autofs-related actions may
require slightly different handling.
Without this patch:
1) autofs mounts were handled using TYPE_AUTOFS
2) autofs unmounts were handled using TYPE_HOTPLUG
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
blockd.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/blockd.c b/blockd.c
index 29d16f2..a00a5b3 100644
--- a/blockd.c
+++ b/blockd.c
@@ -111,8 +111,19 @@ block(char *cmd, char *action, char *device)
static void
device_free(struct device *device)
{
- if (device->autofs && device->target)
+ char *mp;
+
+ if (!device->autofs)
+ return;
+
+ if (device->target)
unlink(device->target);
+
+ mp = _find_mount_point(device->name);
+ if (mp) {
+ block("autofs", "remove", device->name);
+ free(mp);
+ }
}
static void
--
2.13.7
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list