From d9b6798de122fc1565ae8d5e17d7d2c9a0b3338c Mon Sep 17 00:00:00 2001 From: David James Date: Fri, 26 Oct 2012 09:46:50 -0700 Subject: [PATCH] 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 Reviewed-by: Mike Frysinger Commit-Ready: David James --- common.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common.sh b/common.sh index 30bfb72f79..e66b58056b 100644 --- a/common.sh +++ b/common.sh @@ -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