diff options
-rw-r--r-- | cryptfs.bin.in | 8 |
1 files changed, 7 insertions, 1 deletions
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 |