Handle race condition where mounts were unmounted from under our feet.

Mounts can sometimes be unmounted from under our feet. I'm not sure
what's causing this problem, but I can reproduce it both on gPrecise
and on our builders (chromiumos-sdk). I've confirmed this patch fixes
the problem.

BUG=chromium-os:35679
TEST=20 chromiumos-sdk trybot runs. Confirmed this code is executing
     and catching a race condition in the trybot runs.

Change-Id: Iff019e672e9124053ac62cf3017dba485a4989cb
Reviewed-on: https://gerrit.chromium.org/gerrit/36698
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
This commit is contained in:
David James 2012-10-26 09:46:50 -07:00 committed by Gerrit
parent a84e93a688
commit d9b6798de1

View File

@ -568,8 +568,14 @@ safe_umount_tree() {
return 0
fi
# Well that didn't work, so lazy unmount remaining ones.
# Check whether our mounts were successfully unmounted.
mounts=$(sub_mounts "$1")
if [ -z "${mounts}" ]; then
warn "umount failed, but devices were unmounted anyway"
return 0
fi
# Well that didn't work, so lazy unmount remaining ones.
warn "Failed to unmount ${mounts}"
warn "Doing a lazy unmount"
if ! safe_umount -d -l ${mounts}; then