From c7811157845fba6b31635815cfcf9689a5b32680 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Mon, 6 Oct 2014 11:04:06 -0700 Subject: [PATCH] Do not try to detach non-existant loopback devices A user reported symptoms where the losetup line used to detach the loopback device was failing in tar mode. We don't need to detach a device that does not exist. Change-Id: I807996e16199288927b49b4f300ae9b461cb8fe7 Closes-Bug: #1378033 --- lib/common-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common-functions b/lib/common-functions index 6bd1f975..9ac62bd3 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -216,7 +216,7 @@ function detach_loopback() { # loopback dev may be tied up a bit by udev events triggered by partition events for try in $(seq 10 -1 1) ; do - if sudo losetup -d $loopdev ; then + if ! sudo losetup $loopdev || sudo losetup -d $loopdev ; then return 0 fi echo $loopdev may be busy, sleeping up to $try more seconds...