Skip to content

Commit

Permalink
Merge branch 'master' of git:https://sourceware.org/git/lvm2
Browse files Browse the repository at this point in the history
  • Loading branch information
jthornber committed Sep 11, 2018
2 parents 3255e38 + 07d2794 commit d0ff078
Show file tree
Hide file tree
Showing 47 changed files with 213 additions and 457 deletions.
2 changes: 2 additions & 0 deletions WHATS_NEW
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Version 3.0.0
=============
Allow raid4 -> linear conversion request.
Fix lvconvert striped/raid0/raid0_meta -> raid6 regression.
Add 'lvm2-activation-generator:' prefix for kmsg messages logged by generator.
Add After=rbdmap.service to {lvm2-activation-net,blk-availability}.service.
Reduce max concurrent aios to avoid EMFILE with many devices.
Expand Down
28 changes: 16 additions & 12 deletions lib/metadata/raid_manip.c
Original file line number Diff line number Diff line change
Expand Up @@ -6127,10 +6127,10 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
/* striped/raid0 -> */
} else if (seg_is_striped(seg_from) || seg_is_any_raid0(seg_from)) {
if (segtype_is_any_raid6(*segtype))
seg_flag = SEG_RAID6_N_6;
seg_flag = seg_from->area_count < 3 ? SEG_RAID5_N : SEG_RAID6_N_6;

if (segtype_is_linear(*segtype) ||
(!segtype_is_raid4(*segtype) && !segtype_is_raid10(*segtype) && !segtype_is_striped(*segtype)))
else if (segtype_is_linear(*segtype) ||
(!segtype_is_raid4(*segtype) && !segtype_is_raid10(*segtype) && !segtype_is_striped(*segtype)))
seg_flag = SEG_RAID5_N;

/* raid1 -> */
Expand All @@ -6149,9 +6149,17 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
else if (!segtype_is_raid4(*segtype) && !segtype_is_any_raid5(*segtype))
seg_flag = SEG_RAID5_LS;

/* raid5* -> */
} else if (seg_is_any_raid5(seg_from)) {
if (segtype_is_raid1(*segtype) || segtype_is_linear(*segtype)) {
/* raid4/raid5* -> */
} else if (seg_is_raid4(seg_from) || seg_is_any_raid5(seg_from)) {
if (seg_is_raid4(seg_from) && segtype_is_any_raid5(*segtype)) {
if (!segtype_is_raid5_n(*segtype))
seg_flag = SEG_RAID5_N;

} else if (seg_is_any_raid5(seg_from) && segtype_is_raid4(*segtype)) {
if (!seg_is_raid5_n(seg_from))
seg_flag = SEG_RAID5_N;

} else if (segtype_is_raid1(*segtype) || segtype_is_linear(*segtype)) {
if (seg_from->area_count != 2) {
log_error("Converting %s LV %s to 2 stripes first.",
lvseg_name(seg_from), display_lvname(seg_from->lv));
Expand All @@ -6173,12 +6181,12 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count);

} else
seg_flag = _raid_seg_flag_5_to_6(seg_from);
seg_flag = seg_is_raid4(seg_from) ? SEG_RAID6_N_6 :_raid_seg_flag_5_to_6(seg_from);

} else if (segtype_is_striped(*segtype) || segtype_is_raid10(*segtype)) {
int change = 0;

if (!seg_is_raid5_n(seg_from)) {
if (!seg_is_raid4(seg_from) && !seg_is_raid5_n(seg_from)) {
seg_flag = SEG_RAID5_N;

} else if (*stripes > 2 && *stripes != seg_from->area_count - seg_from->segtype->parity_devs) {
Expand All @@ -6199,10 +6207,6 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count);
}

/* raid4 -> * */
} else if (seg_is_raid4(seg_from) && !segtype_is_raid4(*segtype) && !segtype_is_striped(*segtype)) {
seg_flag = segtype_is_any_raid6(*segtype) ? SEG_RAID6_N_6 : SEG_RAID5_N;

/* raid6 -> striped/raid0/raid5/raid10 */
} else if (seg_is_any_raid6(seg_from)) {
if (segtype_is_raid1(*segtype)) {
Expand Down
3 changes: 0 additions & 3 deletions test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ help:
@echo " LVM_TEST_PREFER_BRD Prefer using brd (ramdisk) over loop for testing [1]."
@echo " LVM_TEST_DIR Where to create test files [$(LVM_TEST_DIR)]."
@echo " LVM_TEST_LOCKING Normal (1), Cluster (3)."
@echo " LVM_TEST_LVMETAD_DEBUG_OPTS Allows to override debug opts [-l all]."
@echo " LVM_TEST_LVMPOLLD Start lvmpolld"
@echo " LVM_TEST_NODEBUG Do not debug lvm commands."
@echo " LVM_TEST_PARALLEL May skip agresive wipe of LVMTEST resources."
Expand Down Expand Up @@ -252,7 +251,6 @@ lib/flavour-%: $(srcdir)/lib/flavour-%.sh .lib-dir-stamp

lib/paths-common: $(srcdir)/Makefile.in .lib-dir-stamp Makefile
echo 'DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
echo 'LVMETAD_PIDFILE="@LVMETAD_PIDFILE@"' >> $@-t
echo 'LVMPOLLD_PIDFILE="@LVMPOLLD_PIDFILE@"' >> $@-t
echo 'DMEVENTD_PIDFILE="@DMEVENTD_PIDFILE@"' >> $@-t
echo 'LVM_TEST_THIN_CHECK_CMD=$${LVM_TEST_THIN_CHECK_CMD-@THIN_CHECK_CMD@}' >> $@-t
Expand All @@ -264,7 +262,6 @@ lib/paths-common: $(srcdir)/Makefile.in .lib-dir-stamp Makefile
echo 'LVM_TEST_CACHE_REPAIR_CMD=$${LVM_TEST_CACHE_REPAIR_CMD-@CACHE_REPAIR_CMD@}' >> $@-t
echo 'LVM_TEST_CACHE_RESTORE_CMD=$${LVM_TEST_CACHE_RESTORE_CMD-@CACHE_RESTORE_CMD@}' >> $@-t
echo 'export DM_UDEV_SYNCHRONISATION THIN RAID CACHE\' >> $@-t
echo ' LVMETAD_PIDFILE LVMPOLLD_PIDFILE DMEVENTD_PIDFILE \' >> $@-t
echo ' LVM_TEST_THIN_CHECK_CMD LVM_TEST_THIN_DUMP_CMD LVM_TEST_THIN_REPAIR_CMD LVM_TEST_THIN_RESTORE_CMD\' >> $@-t
echo ' LVM_TEST_CACHE_CHECK_CMD LVM_TEST_CACHE_DUMP_CMD LVM_TEST_CACHE_REPAIR_CMD LVM_TEST_CACHE_RESTORE_CMD' >> $@-t
mv $@-t $@
Expand Down
83 changes: 0 additions & 83 deletions test/lib/aux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,62 +214,7 @@ prepare_dmeventd() {
echo ok
}

prepare_lvmetad() {
check_daemon_in_builddir lvmetad

local run_valgrind=""
test "${LVM_VALGRIND_LVMETAD:-0}" -eq 0 || run_valgrind="run_valgrind"

kill_sleep_kill_ LOCAL_LVMETAD "${LVM_VALGRIND_LVMETAD:-0}"

lvmconf "global/use_lvmetad = 1" "devices/md_component_detection = 0"
# Default debug is "-l all" and could be override
# by setting LVM_TEST_LVMETAD_DEBUG_OPTS before calling inittest.
echo -n "## preparing lvmetad..."
# shellcheck disable=SC2086
$run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" \
${LVM_TEST_LVMETAD_DEBUG_OPTS--l all} &
echo $! > LOCAL_LVMETAD
for i in {200..0} ; do
test "$i" -eq 0 && die "Startup of lvmetad is too slow."
test -e "$TESTDIR/lvmetad.socket" && break
echo -n .
sleep .1;
done
echo ok
}

lvmetad_talk() {
local use=nc
if type -p socat >& /dev/null; then
use=socat
elif echo | not nc -U "$TESTDIR/lvmetad.socket" ; then
echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
echo "## failed to contact lvmetad."
return 1
fi

if test "$use" = nc ; then
nc -U "$TESTDIR/lvmetad.socket"
else
socat "unix-connect:$TESTDIR/lvmetad.socket" -
fi | tee -a lvmetad-talk.txt
}

lvmetad_dump() {
(echo 'request="dump"'; echo '##') | lvmetad_talk "$@"
}

notify_lvmetad() {
if test -e LOCAL_LVMETAD; then
# Ignore results here...
LVM_LOG_FILE_EPOCH="" pvscan --cache "$@" || true
rm -f debug.log
fi
}

prepare_lvmpolld() {
check_daemon_in_builddir lvmetad
lvmconf "global/use_lvmpolld = 1"

local run_valgrind=""
Expand Down Expand Up @@ -583,8 +528,6 @@ teardown() {
killall -9 lvmlockd || true
fi

kill_sleep_kill_ LOCAL_LVMETAD "${LVM_VALGRIND_LVMETAD:-0}"

dm_table | not grep -E -q "$vg|$vg1|$vg2|$vg3|$vg4" || {
# Avoid activation of dmeventd if there is no pid
cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}")
Expand Down Expand Up @@ -802,11 +745,7 @@ prepare_md_dev() {
echo "${mddevdir}${mdname}" > MD_DEV_PV ;;
esac
echo "$mddev" > MD_DEV
notify_lvmetad "$(< MD_DEV_PV)"
printf "%s\n" "${@:4}" > MD_DEVICES
for mddev in "${@:4}"; do
notify_lvmetad "$mddev"
done
}

cleanup_md_dev() {
Expand All @@ -820,12 +759,10 @@ cleanup_md_dev() {
mddev_pv=$(< MD_DEV_PV)
udev_wait
mdadm --stop "$mddev" || true
notify_lvmetad "$mddev_pv"
udev_wait # wait till events are process, not zeroing to early
test "$DM_DEV_DIR" != "/dev" && rm -rf "${mddev_pv%/*}"
for dev in $(< MD_DEVICES); do
mdadm --zero-superblock "$dev" || true
notify_lvmetad "$dev"
done
udev_wait
if [ -b "$mddev" ]; then
Expand Down Expand Up @@ -929,12 +866,6 @@ prepare_devs() {
printf "%s\\n" "${DEVICES[@]}" > DEVICES
# ( IFS=$'\n'; echo "${DEVICES[*]}" ) >DEVICES
echo "ok"

if test -e LOCAL_LVMETAD; then
for dev in "${DEVICES[@]}"; do
notify_lvmetad "$dev"
done
fi
}


Expand Down Expand Up @@ -1041,10 +972,6 @@ disable_dev() {
dmsetup remove -f "$dev" 2>/dev/null || true
fi
done

test -n "$silent" || for num in $notify; do
notify_lvmetad --major "${num%%:*}" --minor "${num##*:}"
done
}

enable_dev() {
Expand All @@ -1066,10 +993,6 @@ enable_dev() {
dmsetup resume "$name"
done
finish_udev_transaction

test -n "$silent" || for dev in "$@"; do
notify_lvmetad "$dev"
done
}

# Throttle down performance of kcopyd when mirroring i.e. disk image
Expand Down Expand Up @@ -1108,10 +1031,6 @@ restore_from_devtable() {
dmsetup resume "$name"
done
finish_udev_transaction

test -n "$silent" || for dev in "$@"; do
notify_lvmetad "$dev"
done
}

#
Expand Down Expand Up @@ -1215,7 +1134,6 @@ generate_config() {
fi

LVM_TEST_LOCKING=${LVM_TEST_LOCKING:-1}
LVM_TEST_LVMETAD=${LVM_TEST_LVMETAD:-0}
LVM_TEST_LVMPOLLD=${LVM_TEST_LVMPOLLD:-0}
LVM_TEST_LVMLOCKD=${LVM_TEST_LVMLOCKD:-0}
# FIXME:dct: This is harmful! Variables are unused here and are tested not being empty elsewhere:
Expand Down Expand Up @@ -1264,7 +1182,6 @@ global/si_unit_consistency = 1
global/thin_check_executable = "$LVM_TEST_THIN_CHECK_CMD"
global/thin_dump_executable = "$LVM_TEST_THIN_DUMP_CMD"
global/thin_repair_executable = "$LVM_TEST_THIN_REPAIR_CMD"
global/use_lvmetad = $LVM_TEST_LVMETAD
global/use_lvmpolld = $LVM_TEST_LVMPOLLD
global/use_lvmlockd = $LVM_TEST_LVMLOCKD
log/activation = 1
Expand Down
3 changes: 0 additions & 3 deletions test/lib/flavour-ndev-lvmetad-lvmpolld.sh

This file was deleted.

2 changes: 0 additions & 2 deletions test/lib/flavour-ndev-lvmetad.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/lib/flavour-udev-lvmetad-lvmpolld.sh

This file was deleted.

3 changes: 0 additions & 3 deletions test/lib/flavour-udev-lvmetad.sh

This file was deleted.

9 changes: 0 additions & 9 deletions test/lib/flavour-udev-lvmlockd-test-lvmetad.sh

This file was deleted.

18 changes: 2 additions & 16 deletions test/lib/inittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ LVM_TEST_LVM1=${LVM_TEST_LVM1-}
# TODO: LVM_TEST_SHARED
SHARED=${SHARED-}

LVM_TEST_LVMETAD=${LVM_TEST_LVMETAD-}
LVM_TEST_LVMLOCKD=${LVM_TEST_LVMLOCKD-}
LVM_TEST_LVMLOCKD_TEST=${LVM_TEST_LVMLOCKD_TEST-}
LVM_TEST_LVMPOLLD=${LVM_TEST_LVMPOLLD-}
Expand All @@ -44,9 +43,6 @@ LVM_TEST_LOCK_TYPE_SANLOCK=${LVM_TEST_LOCK_TYPE_SANLOCK-}
SKIP_WITHOUT_CLVMD=${SKIP_WITHOUT_CLVMD-}
SKIP_WITH_CLVMD=${SKIP_WITH_CLVMD-}

SKIP_WITHOUT_LVMETAD=${SKIP_WITHOUT_LVMETAD-}
SKIP_WITH_LVMETAD=${SKIP_WITH_LVMETAD-}

SKIP_WITH_LVMPOLLD=${SKIP_WITH_LVMPOLLD-}
SKIP_WITH_LVMLOCKD=${SKIP_WITH_LVMLOCKD-}
SKIP_ROOT_DM_CHECK=${SKIP_ROOT_DM_CHECK-}
Expand All @@ -58,17 +54,14 @@ test -f "lib/flavour-$LVM_TEST_FLAVOUR" || { echo "NOTE: Flavour '$LVM_TEST_FLAV
test -n "$SKIP_WITHOUT_CLVMD" && test "$LVM_TEST_LOCKING" -ne 3 && initskip
test -n "$SKIP_WITH_CLVMD" && test "$LVM_TEST_LOCKING" = 3 && initskip

test -n "$SKIP_WITHOUT_LVMETAD" && test -z "$LVM_TEST_LVMETAD" && initskip
test -n "$SKIP_WITH_LVMETAD" && test -n "$LVM_TEST_LVMETAD" && initskip

test -n "$SKIP_WITH_LVMPOLLD" && test -n "$LVM_TEST_LVMPOLLD" && test -z "$LVM_TEST_LVMLOCKD" && initskip

test -n "$SKIP_WITH_LVMLOCKD" && test -n "$LVM_TEST_LVMLOCKD" && initskip

unset CDPATH

export LVM_TEST_BACKING_DEVICE LVM_TEST_DEVDIR LVM_TEST_NODEBUG
export LVM_TEST_LVMETAD LVM_TEST_LVMLOCKD LVM_TEST_LVMLOCKD_TEST
export LVM_TEST_LVMLOCKD LVM_TEST_LVMLOCKD_TEST
export LVM_TEST_LVMPOLLD LVM_TEST_LOCK_TYPE_DLM LVM_TEST_LOCK_TYPE_SANLOCK
# grab some common utilities
. lib/utils
Expand Down Expand Up @@ -157,15 +150,8 @@ test -n "$BASH" && set -euE -o pipefail
echo "@TESTDIR=$TESTDIR"
echo "@PREFIX=$PREFIX"

if test -n "$LVM_TEST_LVMETAD" ; then
export LVM_LVMETAD_SOCKET="$TESTDIR/lvmetad.socket"
export LVM_LVMETAD_PIDFILE="$TESTDIR/lvmetad.pid"
aux prepare_lvmetad
elif test -z "$SKIP_ROOT_DM_CHECK" ; then
# lvmetad prepares its own lvmconf
export LVM_LVMETAD_PIDFILE="$TESTDIR/non-existing-file"
if test -z "$SKIP_ROOT_DM_CHECK" ; then
aux lvmconf
aux prepare_clvmd
fi

test -n "$LVM_TEST_LVMPOLLD" && {
Expand Down
2 changes: 0 additions & 2 deletions test/shell/dmsetup-integrity-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# unrelated to lvm2 daemons
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
SKIP_WITH_CLVMD=1
SKIP_WITH_LVMETAD=1

. lib/inittest

Expand Down
2 changes: 0 additions & 2 deletions test/shell/dmsetup-keyring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# unrelated to lvm2 daemons
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
SKIP_WITH_CLVMD=1
SKIP_WITH_LVMETAD=1

. lib/inittest

Expand Down
Loading

0 comments on commit d0ff078

Please sign in to comment.