common.sh: Change umount function to account for already deleted mounts.
BUG=chromium-os:31250
TEST=enter chroot; kill ssh-agent; exit chroot
Change-Id: Iea8e0fdd9a82047bb756a459dffc2ef59615074c
Reviewed-on: https://gerrit.chromium.org/gerrit/31929
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
diff --git a/common.sh b/common.sh
index 9f3acb3..7904479 100644
--- a/common.sh
+++ b/common.sh
@@ -542,7 +542,12 @@
# unmount submounts (think /dev/pts and /dev).
awk -v path="$1" -v len="${#1}" \
'(substr($2, 1, len) == path) { print $2 }' /proc/mounts | \
- tac
+ tac | \
+ sed -e 's/\\040(deleted)$//'
+ # Hack(zbehan): If a bind mount's source is mysteriously removed,
+ # we'd end up with an orphaned mount with the above string in its name.
+ # It can only be seen through /proc/mounts and will stick around even
+ # when it should be gone already. crosbug.com/31250
}
# Unmounts a directory, if the unmount fails, warn, and then lazily unmount.