mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
aux: retry brd removal
Try to remove brd twice if there is some collision with udevd. Instanciate only 1 ramdisk. Use just 'eval' for '--nameprefixes' results.
This commit is contained in:
parent
87eae82195
commit
6e8ede833b
@ -418,9 +418,7 @@ teardown_devs_prefixed() {
|
|||||||
|
|
||||||
for dm in $(dm_info name,open --separator ';' --nameprefixes --unquoted --sort open,"$sortby" -S "name=~$prefix" --mangle none || true) ; do
|
for dm in $(dm_info name,open --separator ';' --nameprefixes --unquoted --sort open,"$sortby" -S "name=~$prefix" --mangle none || true) ; do
|
||||||
test "$dm" != "No devices found" || break 2
|
test "$dm" != "No devices found" || break 2
|
||||||
DM_NAME=${dm##DM_NAME=}
|
eval "$dm"
|
||||||
DM_NAME=${DM_NAME%%;DM_OPEN*}
|
|
||||||
DM_OPEN=${dm##*;DM_OPEN=}
|
|
||||||
local force="-f"
|
local force="-f"
|
||||||
if test "$i" = 0; then
|
if test "$i" = 0; then
|
||||||
if test "$once" = 1 ; then
|
if test "$once" = 1 ; then
|
||||||
@ -452,17 +450,24 @@ teardown_devs() {
|
|||||||
|
|
||||||
test ! -f MD_DEV || cleanup_md_dev
|
test ! -f MD_DEV || cleanup_md_dev
|
||||||
test ! -f DEVICES || teardown_devs_prefixed "$PREFIX"
|
test ! -f DEVICES || teardown_devs_prefixed "$PREFIX"
|
||||||
test ! -f RAMDISK || { modprobe -r brd || true ; }
|
if test -f RAMDISK ; then
|
||||||
|
for i in 1 2 ; do
|
||||||
|
modprobe -r brd && break
|
||||||
|
sleep .1
|
||||||
|
udev_wait
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# NOTE: SCSI_DEBUG_DEV test must come before the LOOP test because
|
# NOTE: SCSI_DEBUG_DEV test must come before the LOOP test because
|
||||||
# prepare_scsi_debug_dev() also sets LOOP to short-circuit prepare_loop()
|
# prepare_scsi_debug_dev() also sets LOOP to short-circuit prepare_loop()
|
||||||
if test -f SCSI_DEBUG_DEV; then
|
if test -f SCSI_DEBUG_DEV; then
|
||||||
udev_wait
|
udev_wait
|
||||||
test "${LVM_TEST_PARALLEL:-0}" -eq 1 || {
|
test "${LVM_TEST_PARALLEL:-0}" -eq 1 || {
|
||||||
if ! modprobe -r scsi_debug ; then
|
for i in 1 2 ; do
|
||||||
sleep 1
|
modprobe -r scsi_debug && break
|
||||||
modprobe -r scsi_debug || true
|
sleep .1
|
||||||
fi
|
udev_wait
|
||||||
|
done
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
test ! -f LOOP || losetup -d "$(< LOOP)" || true
|
test ! -f LOOP || losetup -d "$(< LOOP)" || true
|
||||||
@ -684,7 +689,7 @@ prepare_ramdisk() {
|
|||||||
modprobe -r brd || return 0
|
modprobe -r brd || return 0
|
||||||
|
|
||||||
echo -n "## preparing ramdisk device..."
|
echo -n "## preparing ramdisk device..."
|
||||||
modprobe brd rd_size=$((size * 1024)) || return
|
modprobe brd rd_size=$((size * 1024)) rd_nr=1 || return
|
||||||
|
|
||||||
BACKING_DEV=/dev/ram0
|
BACKING_DEV=/dev/ram0
|
||||||
echo "ok ($BACKING_DEV)"
|
echo "ok ($BACKING_DEV)"
|
||||||
|
Loading…
Reference in New Issue
Block a user