diff options
Diffstat (limited to 'sysutils/xentools45/patches/patch-hotplug_NetBSD_block')
-rw-r--r-- | sysutils/xentools45/patches/patch-hotplug_NetBSD_block | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sysutils/xentools45/patches/patch-hotplug_NetBSD_block b/sysutils/xentools45/patches/patch-hotplug_NetBSD_block new file mode 100644 index 00000000000..c2f575fe458 --- /dev/null +++ b/sysutils/xentools45/patches/patch-hotplug_NetBSD_block @@ -0,0 +1,59 @@ +$NetBSD: patch-hotplug_NetBSD_block,v 1.1 2016/04/04 14:45:12 bad Exp $ + +Lock the block script to avoid races during vnd configuration. + +--- hotplug/NetBSD/block.orig 2015-11-03 10:11:18.000000000 +0100 ++++ hotplug/NetBSD/block 2016-03-25 14:37:34.000000000 +0100 +@@ -6,6 +6,7 @@ + + DIR=$(dirname "$0") + . "${DIR}/hotplugpath.sh" ++. "${DIR}/locking.sh" + + PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin + export PATH +@@ -14,6 +15,7 @@ + echo "$@" >&2 + xenstore-write $xpath/hotplug-status error \ + $xpath/hotplug-error "$@" ++ release_lock block + exit 1 + } + +@@ -37,10 +39,12 @@ + # device removed + case $xtype in + file) ++ claim_lock block + vnd=$(xenstore-read "$xpath/vnd" || echo none) + if [ $vnd != none ]; then + vnconfig -u $vnd + fi ++ release_lock block + ;; + phy) + ;; +@@ -52,6 +56,7 @@ + exit 0 + ;; + 2) ++ claim_lock block + case $xtype in + file) + # Store the list of available vnd(4) devices in +@@ -78,6 +83,7 @@ + fi + done + if [ x$device = x ] ; then ++ release_lock block + error "no available vnd device" + fi + xenstore-write $xpath/vnd $device +@@ -89,6 +95,7 @@ + physical_device=$(stat -f '%r' "$device") + xenstore-write $xpath/physical-device $physical_device + xenstore-write $xpath/hotplug-status connected ++ release_lock block + exit 0 + ;; + *) |