Skip to contentSkip to conversation

Allow the block script to retry losetup -d

PATCH New Kirk Allan 1 participant 1 message Jul 13, 2006

lore
Share & tools
lore

Kirk Allan

author
#0 lore raw

PATCH 1/1 Allow the block script to retry losetup -d

Added 'for' loop to retry the losetup -d in the block script. It is possible for the losetup -d to fail if another process is examining the loopback devices e.g. losetup -a.

Signed- off- by: Kirk Allan <[email protected]>

tools/examples/block +12 -2
@@ -381,8 +381,18 @@
 
       file)
         node=$(xenstore_read "$XENBUS_PATH/node")
-	losetup -d "$node"
-	exit 0
+
+        #In case the loopback is temporarily blocked, retry the losetup -d.
+        for i in 1 2 3 4 5
+        do
+          if losetup -d "$node"
+          then
+            exit 0
+          fi
+          sleep 1
+        done
+        log err "losetup -d $node failed."
+        exit 1
 	;;
     esac
     ;;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel