From cfed84826acdf6aafb35ee0de7acb29f07834898 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 23 Apr 2020 16:40:54 +0200 Subject: cryptfs: add timeout to do_umount --- cryptfs.bin.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cryptfs.bin.in b/cryptfs.bin.in index 4e0effd..d7ba868 100644 --- a/cryptfs.bin.in +++ b/cryptfs.bin.in @@ -240,6 +240,7 @@ do_unmount() { local inner_fs local lazy local mount_point + local timeout if [ "x$1" = 'x-l' ]; then lazy='-l' shift @@ -254,12 +255,17 @@ do_unmount() { do_unmount -l "${inner_fs}" fi mount_point=$(mount_details mp "$1") - while ! umount ${lazy} "${mount_point}"; do + timeout=120 + while [ ${timeout} -ge 0 ] && ! umount ${lazy} "${mount_point}"; do >&2 printf '"umount %s" failed.\n' \ "${lazy} ${mount_point}" fuser -k -M -m "${mount_point}" sleep 1 + timeout=$((timeout-1)) done + if [ ${timeout} -lt 0 ]; then + return 1 + fi if [ -n "${inner_fs}" ]; then do_mount "${inner_fs}" fi -- cgit v1.2.3-54-g00ecf