summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-04-23 16:40:54 +0200
committerErich Eckner <git@eckner.net>2020-04-23 16:40:54 +0200
commitcfed84826acdf6aafb35ee0de7acb29f07834898 (patch)
treee7daddf78d382cfe558937ba0ba4cd5d5062dbec
parenta9673aab150914ca05e079512cc444aafa7c0d48 (diff)
downloadcryptfs-daemon-cfed84826acdf6aafb35ee0de7acb29f07834898.tar.xz
cryptfs: add timeout to do_umount
-rw-r--r--cryptfs.bin.in8
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