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
This commit is contained in:
Clint Byrum 2014-10-06 11:04:06 -07:00
parent a9086da83f
commit c781115784

View File

@ -216,7 +216,7 @@ function detach_loopback() {
# loopback dev may be tied up a bit by udev events triggered by partition events # loopback dev may be tied up a bit by udev events triggered by partition events
for try in $(seq 10 -1 1) ; do 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 return 0
fi fi
echo $loopdev may be busy, sleeping up to $try more seconds... echo $loopdev may be busy, sleeping up to $try more seconds...