xen/block-losetup-retry.diff

26 lines
675 B
Diff

Index: xen-3.0.4-testing/tools/examples/block
===================================================================
--- xen-3.0.4-testing.orig/tools/examples/block
+++ xen-3.0.4-testing/tools/examples/block
@@ -390,8 +390,18 @@ mount it read-write in a guest domain."
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
;;
"")