From cc9870ec1142cc46fd3e2e84a2d2e38c78d57d60 Mon Sep 17 00:00:00 2001 From: "Haomeng, Wang" Date: Mon, 23 Mar 2015 08:35:41 +0000 Subject: [PATCH] Try 5 times for rmdir command call after umount Sometime, we will get "Device or resource busy" during the mount point deleting, umount return 0, but the resouce is busy for a while, so need to add sleep interval to wait resource free, then we can delete it. Change-Id: Idaa219d12e847824960eec8907739add5d619d1a Closes-Bug: 1332521 --- lib/img-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/img-functions b/lib/img-functions index 35a820d1..7c8aaa88 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -86,7 +86,10 @@ function run_d_in_target () { trap - ERR check_break after-$1 run_in_target bash sudo umount -f $TMP_MOUNT_PATH/tmp/in_target.d - sudo rmdir $TMP_MOUNT_PATH/tmp/in_target.d + if ! timeout 5 sh -c " while ! sudo rmdir $TMP_MOUNT_PATH/tmp/in_target.d; do sleep 1; done"; then + echo "ERROR: unable to cleanly remove $TMP_MOUNT_PATH/tmp/in_target.d" + exit 1 + fi fi }