From a91e19755351b8799493ceb04b2cfa1c657034b8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 12 Apr 2022 21:53:47 +0200 Subject: [PATCH] Avoid looping forever trying to unmount busy tmpfs This split unmount is a bit crude, unfortunately. A user may have set up a bind or overlayfs mount on top of a tmpfs -- so unmounting tmpfs first will then always result in EBUSY. Avoid logging busy errors and fake OK. We'll catch it later in the second stage unmount. Signed-off-by: Joachim Wiberg --- src/mount.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mount.c b/src/mount.c index 430e3a85..23e5a720 100644 --- a/src/mount.c +++ b/src/mount.c @@ -94,10 +94,12 @@ static int unmount(const char *target) int rc; rc = umount(target); - if (rc) + if (rc && errno != EBUSY) { print(2, "Failed unmounting %s, error %d: %s", target, errno, strerror(errno)); + return rc; + } - return rc; + return 0; } void unmount_tmpfs(void)