diff options
| author | Rafał Miłecki | 2018-12-12 14:24:34 +0000 |
|---|---|---|
| committer | Rafał Miłecki | 2018-12-28 22:10:32 +0000 |
| commit | 3bb3352a5f6c1cffd8a487b92eb762c857df75ed (patch) | |
| tree | f76d815b1c015c3fade597f69d91809ff114e2e7 | |
| parent | 28753b3f027084fa2ca184bc8f8c54db36cc2421 (diff) | |
| download | fstools-3bb3352a5f6c1cffd8a487b92eb762c857df75ed.tar.gz | |
blockd: unmount device explicitly when it disappears
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@milecki.pl>
| -rw-r--r-- | blockd.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 |