Lock only the minimal critical section in the block hotplug script.
Patch provided my Manuel Bouyer. Thanks!
This commit is contained in:
parent
ba7af56283
commit
44695687ec
2 changed files with 20 additions and 46 deletions
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.19 2016/04/04 14:45:12 bad Exp $
|
||||
$NetBSD: distinfo,v 1.20 2016/04/04 14:47:19 bad Exp $
|
||||
|
||||
SHA1 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = fecadf952821e830ce1a1d19655288eef8488f88
|
||||
RMD160 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = 539bfa12db7054228250d6dd380bbf96c1a040f8
|
||||
|
@ -31,7 +31,7 @@ SHA1 (patch-firmware_etherboot_Makefile) = f55e14948b7191e533a82b8fc3575f1052f23
|
|||
SHA1 (patch-firmware_etherboot_patches_series) = 2fa1342c78094c6dd5d60a07c236c4a1c0599fc4
|
||||
SHA1 (patch-firmware_hvmloader_Makefile) = bc5e81ddfc5e95887c2af4bb32eced9c5748b3c6
|
||||
SHA1 (patch-hotplug_NetBSD_Makefile) = 6f6ec768b595c332a8757437a64509c0370e52da
|
||||
SHA1 (patch-hotplug_NetBSD_block) = 6f56f2c5927686ac128cf1913b419be20ce2e99d
|
||||
SHA1 (patch-hotplug_NetBSD_block) = 243ec06924ba1b711203cb41620e0374dfd172ef
|
||||
SHA1 (patch-hotplug_NetBSD_vif-bridge) = ac4cc7446715330b504b8cce8cbd47c8035cf33c
|
||||
SHA1 (patch-hotplug_NetBSD_vif-ip) = ed23b0c16d87bd05230399d921e28860c5857b01
|
||||
SHA1 (patch-hotplug_common_Makefile) = 1c8af96a3d0d1d5e9c168b1eb75fabb3e2164a19
|
||||
|
|
|
@ -1,59 +1,33 @@
|
|||
$NetBSD: patch-hotplug_NetBSD_block,v 1.1 2016/04/04 14:45:12 bad Exp $
|
||||
$NetBSD: patch-hotplug_NetBSD_block,v 1.2 2016/04/04 14:47:19 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 @@
|
||||
--- hotplug/NetBSD/block.orig 2015-11-03 09:11:18.000000000 +0000
|
||||
+++ hotplug/NetBSD/block
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
. "${DIR}/hotplugpath.sh"
|
||||
+. "${DIR}/locking.sh"
|
||||
|
||||
PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
|
||||
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
|
||||
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/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)
|
||||
|
||||
error() {
|
||||
@@ -62,6 +63,7 @@ case $xstatus in
|
||||
available_disks="$available_disks $disk"
|
||||
eval $disk=free
|
||||
done
|
||||
+ 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 @@
|
||||
# Mark the used vnd(4) devices as ``used''.
|
||||
for disk in `sysctl hw.disknames`; do
|
||||
case $disk in
|
||||
@@ -77,6 +79,7 @@ case $xstatus in
|
||||
break
|
||||
fi
|
||||
done
|
||||
+ release_lock block
|
||||
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
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in a new issue