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.24; author bouyer; state dead; branches; next 1.3; commitid DGAMglRf0Jde6FkC; 1.3 date 2016.05.21.20.12.18; author bad; state Exp; branches; next 1.2; commitid SicYUUbnrhH98o7z; 1.2 date 2016.04.04.15.16.03; author bad; state Exp; branches; next 1.1; commitid XZSagO3i5Yd80k1z; 1.1 date 2016.04.04.15.13.15; author bad; state Exp; branches; next ; commitid RmsHa93wUBweZj1z; 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:12:18 bad Exp $ Use a lock around the allocation of an unused vnd because xl(1) starts the hotplug scripts in parallel. Use "stat -L" to get device major/minor numbers through symlinks e.g. for lvm volumes. --- hotplug/NetBSD/block.orig 2014-09-02 08:22:57.000000000 +0200 +++ hotplug/NetBSD/block 2016-05-21 17:03:35.000000000 +0200 @@@@ -6,6 +6,7 @@@@ DIR=$(dirname "$0") . "${DIR}/hotplugpath.sh" +. "${DIR}/locking.sh" PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin export PATH @@@@ -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 15:16:03 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 15:13:15 bad Exp $ d6 5 a10 2 --- hotplug/NetBSD/block.orig 2014-09-02 06:22:57.000000000 +0000 +++ hotplug/NetBSD/block d19 1 a19 1 @@@@ -62,6 +63,7 @@@@ case $xstatus in d27 1 a27 1 @@@@ -77,6 +79,7 @@@@ case $xstatus in d35 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 4 a4 1 $NetBSD$ d16 4 a19 12 @@@@ -14,6 +15,7 @@@@ error() { echo "$@@" >&2 xenstore-write $xpath/hotplug-status error \ $xpath/hotplug-error "$@@" + release_lock block exit 1 } @@@@ -37,10 +39,12 @@@@ case $xstatus in # device removed case $xtype in file) d21 5 a25 17 vnd=$(xenstore-read "$xpath/vnd" || echo none) if [ $vnd != none ]; then vnconfig -u $vnd fi + release_lock block ;; phy) ;; @@@@ -52,6 +56,7 @@@@ case $xstatus in exit 0 ;; 2) + claim_lock block case $xtype in file) # Store the list of available vnd(4) devices in @@@@ -78,6 +83,7 @@@@ case $xstatus in d28 1 a29 1 + release_lock block a31 9 xenstore-write $xpath/vnd $device @@@@ -89,6 +95,7 @@@@ case $xstatus in physical_device=$(stat -f '%r' "$device") xenstore-write $xpath/physical-device $physical_device xenstore-write $xpath/hotplug-status connected + release_lock block exit 0 ;; *) @