xen/block-sync.diff

43 lines
1.1 KiB
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
@@ -42,6 +42,20 @@ canonicalise_mode()
fi
}
+##
+# sync_flags mode
+#
+sync_flags()
+{
+ local mode="$1"
+ if expr index "$mode" 'S' >/dev/null
+ then
+ echo "-y"
+ else
+ echo ""
+ fi
+}
+
##
# check_sharing device mode
@@ -262,6 +276,7 @@ case "$command" in
# Canonicalise the file, for sharing check comparison, and the mode
# for ease of use here.
file=$(readlink -f "$p") || fatal "$p does not exist."
+ sync=$(sync_flags "$mode")
mode=$(canonicalise_mode "$mode")
claim_lock "block"
@@ -367,7 +382,7 @@ mount it read-write in a guest domain."
fatal 'Failed to find an unused loop device'
fi
- do_or_die losetup "$loopdev" "$file"
+ do_or_die losetup $sync "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"