head 1.4; access; symbols pkgsrc-2020Q2:1.3.0.32 pkgsrc-2020Q2-base:1.3 pkgsrc-2020Q1:1.3.0.12 pkgsrc-2020Q1-base:1.3 pkgsrc-2019Q4:1.3.0.34 pkgsrc-2019Q4-base:1.3 pkgsrc-2019Q3:1.3.0.30 pkgsrc-2019Q3-base:1.3 pkgsrc-2019Q2:1.3.0.28 pkgsrc-2019Q2-base:1.3 pkgsrc-2019Q1:1.3.0.26 pkgsrc-2019Q1-base:1.3 pkgsrc-2018Q4:1.3.0.24 pkgsrc-2018Q4-base:1.3 pkgsrc-2018Q3:1.3.0.22 pkgsrc-2018Q3-base:1.3 pkgsrc-2018Q2:1.3.0.20 pkgsrc-2018Q2-base:1.3 pkgsrc-2018Q1:1.3.0.18 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.16 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.14 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.10 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.8 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.6 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.4 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.2 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.2.0.2 pkgsrc-2016Q1-base:1.2; locks; strict; comment @# @; 1.4 date 2020.08.19.10.39.25; author bouyer; state dead; branches; next 1.3; commitid DGAMglRf0Jde6FkC; 1.3 date 2016.05.21.20.11.21; author bad; state Exp; branches; next 1.2; commitid bj8MqIesYRiE5o7z; 1.2 date 2016.04.04.14.47.19; author bad; state Exp; branches; next 1.1; commitid OupuKqnmAtX3Qj1z; 1.1 date 2016.04.04.14.45.12; author bad; state Exp; branches; next ; commitid bSOFuYttnrZUOj1z; desc @@ 1.4 log @Remove xenkernel and xentools packages older than 4.11. They're not maintained anymore upstream, and don't build on supported NetBSD releases. @ text @$NetBSD: patch-hotplug_NetBSD_block,v 1.3 2016/05/21 20:11:21 bad Exp $ Lock the block script to avoid races during vnd configuration. Use "stat -L" to get device major/minor numbers through symlinks e.g. for lvm volumes. --- hotplug/NetBSD/block.orig 2016-03-23 14:57:27.000000000 +0100 +++ hotplug/NetBSD/block 2016-05-21 17:08:01.000000000 +0200 @@@@ -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}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin export PATH error() { @@@@ -62,6 +63,7 @@@@ available_disks="$available_disks $disk" eval $disk=free done + claim_lock block # Mark the used vnd(4) devices as ``used''. for disk in `sysctl hw.disknames`; do case $disk in @@@@ -77,6 +79,7 @@@@ break fi done + release_lock block if [ x$device = x ] ; then error "no available vnd device" fi @@@@ -86,7 +89,7 @@@@ device=$xparams ;; esac - physical_device=$(stat -f '%r' "$device") + physical_device=$(stat -L -f '%r' "$device") xenstore-write $xpath/physical-device $physical_device xenstore-write $xpath/hotplug-status connected exit 0 @ 1.3 log @Use "stat -L" to determine the physical device. Now one can use lvm's /dev/vgXXlvolYY symlinks in domU config files. PKGREVISION++ @ text @d1 1 a1 1 $NetBSD: patch-hotplug_NetBSD_block,v 1.2 2016/04/04 14:47:19 bad Exp $ @ 1.2 log @Lock only the minimal critical section in the block hotplug script. Patch provided my Manuel Bouyer. Thanks! @ text @d1 1 a1 1 $NetBSD: patch-hotplug_NetBSD_block,v 1.1 2016/04/04 14:45:12 bad Exp $ d5 5 a9 2 --- hotplug/NetBSD/block.orig 2015-11-03 09:11:18.000000000 +0000 +++ hotplug/NetBSD/block d21 1 a21 1 @@@@ -62,6 +63,7 @@@@ case $xstatus in d29 1 a29 1 @@@@ -77,6 +79,7 @@@@ case $xstatus in d37 9 @ 1.1 log @Guard the NetBSD block device hotplug script against concurrent execution. xl(1) runs the hotplug scripts in parallel. This causes failures when the next free vnd device is selected. Locking modeled after the Linux block hotplug script. @ text @d1 1 a1 1 $NetBSD$ d5 3 a7 3 --- 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 @@@@ d13 2 a14 1 PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin d16 6 a21 12 @@@@ -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) d23 5 a27 17 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 @@@@ d30 1 a31 1 + release_lock block a33 9 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 ;; *) @