From: Rafał Miłecki <ra...@milecki.pl>

If umount calls fails (e.g. because of some application accessing old
path) the only chance of getting mount entry cleaned is receiving autofs
expire packet. This isn't fully reliable:
1) Sometimes expire can happen before closing all handles. In such case
   a second unmount try will fail as well and there won't be a next one.
2) Expire happens after specified timeout. If device reappears quickly
   (e.g. due to being replugged or USB controller restart) it may be
   worth having old mount cleaned up earlier for better user experience.

This problem can be easily handled by using MNT_DETACH (lazy) umount as
a fallback.

Signed-off-by: Rafał Miłecki <ra...@milecki.pl>
---
 mount.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mount.c b/mount.c
index ddcd5b3..3994149 100644
--- a/mount.c
+++ b/mount.c
@@ -604,6 +604,7 @@ static int mount_dev_del(struct mount *mount)
                log_printf("device %s has disappeared ... unmounting %s\n", 
mount->dev, tmp);
                if (umount(tmp)) {
                        err = -errno;
+                       umount2(tmp, MNT_DETACH);
                }
                rmdir(tmp);
                mount_dump_uci_state();
-- 
2.11.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to