import lvm2-2.03.11-4.el8
This commit is contained in:
parent
7cccc6ff12
commit
bd661a2856
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/LVM2.2.03.09.tgz
|
||||
SOURCES/LVM2.2.03.11.tgz
|
||||
|
@ -1 +1 @@
|
||||
15a90d5039a2a1e9f67611a2a6c2faa72e8996aa SOURCES/LVM2.2.03.09.tgz
|
||||
9484fd277914a85f330b4067aa222ee13f061189 SOURCES/LVM2.2.03.11.tgz
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,210 +0,0 @@
|
||||
From f540a18fd7f5f65599a6c85c0bd3ba84e54f1cc8 Mon Sep 17 00:00:00 2001
|
||||
From: Marian Csontos <mcsontos@redhat.com>
|
||||
Date: Thu, 28 May 2020 18:02:16 +0200
|
||||
Subject: [PATCH] Merge master up to commit be61bd6ff5c6
|
||||
|
||||
---
|
||||
VERSION | 2 +-
|
||||
VERSION_DM | 2 +-
|
||||
test/shell/cache-single-usage.sh | 13 +++++++++++++
|
||||
test/shell/integrity-dmeventd.sh | 8 ++++++++
|
||||
test/shell/integrity-large.sh | 8 ++++++++
|
||||
test/shell/integrity-misc.sh | 8 ++++++++
|
||||
test/shell/integrity.sh | 8 ++++++++
|
||||
test/shell/thin-foreign-repair.sh | 14 ++++++++++----
|
||||
tools/lvconvert.c | 15 +++++++++++++++
|
||||
9 files changed, 72 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/VERSION b/VERSION
|
||||
index 00618e0..9ad7a70 100644
|
||||
--- a/VERSION
|
||||
+++ b/VERSION
|
||||
@@ -1 +1 @@
|
||||
-2.03.09(2)-RHEL8 (2020-04-21)
|
||||
+2.03.09(2)-RHEL8 (2020-05-28)
|
||||
diff --git a/VERSION_DM b/VERSION_DM
|
||||
index b9ec43e..bcd97de 100644
|
||||
--- a/VERSION_DM
|
||||
+++ b/VERSION_DM
|
||||
@@ -1 +1 @@
|
||||
-1.02.171-RHEL8 (2020-04-21)
|
||||
+1.02.171-RHEL8 (2020-05-28)
|
||||
diff --git a/test/shell/cache-single-usage.sh b/test/shell/cache-single-usage.sh
|
||||
index a885bf7..8936aa3 100644
|
||||
--- a/test/shell/cache-single-usage.sh
|
||||
+++ b/test/shell/cache-single-usage.sh
|
||||
@@ -127,4 +127,17 @@ umount "$mount_dir"
|
||||
lvchange -an $vg/$lv1
|
||||
lvchange -an $vg/$lv2
|
||||
|
||||
+# misc tests
|
||||
+
|
||||
+lvremove $vg
|
||||
+
|
||||
+lvcreate -n $lv1 -l 2 -an $vg "$dev1"
|
||||
+lvcreate -n $lv2 -l 2 -an $vg "$dev1"
|
||||
+lvcreate -n $lv3 -l 2 -an $vg "$dev2"
|
||||
+
|
||||
+lvconvert -y --type writecache --cachevol $lv3 $vg/$lv1
|
||||
+not lvconvert -y --type writecache --cachevol ${lv3}_cvol $vg/$lv2
|
||||
+not lvconvert -y --type cache --cachevol ${lv3}_cvol $vg/$lv2
|
||||
+not lvconvert -y --type cache --cachepool ${lv3}_cvol $vg/$lv2
|
||||
+
|
||||
vgremove -ff $vg
|
||||
diff --git a/test/shell/integrity-dmeventd.sh b/test/shell/integrity-dmeventd.sh
|
||||
index ed2436a..296f556 100644
|
||||
--- a/test/shell/integrity-dmeventd.sh
|
||||
+++ b/test/shell/integrity-dmeventd.sh
|
||||
@@ -109,6 +109,14 @@ _wait_recalc() {
|
||||
sleep 1
|
||||
done
|
||||
|
||||
+ # TODO: There is some strange bug, first leg of RAID with integrity
|
||||
+ # enabled never gets in sync. I saw this in BB, but not when executing
|
||||
+ # the commands manually
|
||||
+ if test -z "$sync"; then
|
||||
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
|
||||
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
|
||||
+ exit
|
||||
+ fi
|
||||
echo "timeout waiting for recalc"
|
||||
return 1
|
||||
}
|
||||
diff --git a/test/shell/integrity-large.sh b/test/shell/integrity-large.sh
|
||||
index 7a333c1..5aba80e 100644
|
||||
--- a/test/shell/integrity-large.sh
|
||||
+++ b/test/shell/integrity-large.sh
|
||||
@@ -95,6 +95,14 @@ _wait_recalc() {
|
||||
sleep 1
|
||||
done
|
||||
|
||||
+ # TODO: There is some strange bug, first leg of RAID with integrity
|
||||
+ # enabled never gets in sync. I saw this in BB, but not when executing
|
||||
+ # the commands manually
|
||||
+ if test -z "$sync"; then
|
||||
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
|
||||
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
|
||||
+ exit
|
||||
+ fi
|
||||
echo "timeout waiting for recalc"
|
||||
return 1
|
||||
}
|
||||
diff --git a/test/shell/integrity-misc.sh b/test/shell/integrity-misc.sh
|
||||
index a176f18..0d05689 100644
|
||||
--- a/test/shell/integrity-misc.sh
|
||||
+++ b/test/shell/integrity-misc.sh
|
||||
@@ -109,6 +109,14 @@ _wait_recalc() {
|
||||
sleep 1
|
||||
done
|
||||
|
||||
+ # TODO: There is some strange bug, first leg of RAID with integrity
|
||||
+ # enabled never gets in sync. I saw this in BB, but not when executing
|
||||
+ # the commands manually
|
||||
+ if test -z "$sync"; then
|
||||
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
|
||||
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
|
||||
+ exit
|
||||
+ fi
|
||||
echo "timeout waiting for recalc"
|
||||
return 1
|
||||
}
|
||||
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
|
||||
index 6baccf0..77e9430 100644
|
||||
--- a/test/shell/integrity.sh
|
||||
+++ b/test/shell/integrity.sh
|
||||
@@ -204,6 +204,14 @@ _wait_recalc() {
|
||||
sleep 1
|
||||
done
|
||||
|
||||
+ # TODO: There is some strange bug, first leg of RAID with integrity
|
||||
+ # enabled never gets in sync. I saw this in BB, but not when executing
|
||||
+ # the commands manually
|
||||
+ if test -z "$sync"; then
|
||||
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
|
||||
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
|
||||
+ exit
|
||||
+ fi
|
||||
echo "timeout waiting for recalc"
|
||||
return 1
|
||||
}
|
||||
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
|
||||
index 8b4018e..55e9f62 100644
|
||||
--- a/test/shell/thin-foreign-repair.sh
|
||||
+++ b/test/shell/thin-foreign-repair.sh
|
||||
@@ -17,9 +17,15 @@ SKIP_WITH_LVMPOLLD=1
|
||||
|
||||
. lib/inittest
|
||||
|
||||
+clean_thin_()
|
||||
+{
|
||||
+ aux udev_wait
|
||||
+ dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" ; }
|
||||
+}
|
||||
+
|
||||
cleanup_mounted_and_teardown()
|
||||
{
|
||||
- dmsetup remove $THIN || true
|
||||
+ clean_thin_ || true
|
||||
vgremove -ff $vg
|
||||
aux teardown
|
||||
}
|
||||
@@ -56,9 +62,7 @@ dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
|
||||
|
||||
mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
|
||||
|
||||
-aux udev_wait
|
||||
-
|
||||
-dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" }
|
||||
+clean_thin_
|
||||
|
||||
lvchange -an $vg/pool
|
||||
|
||||
@@ -72,3 +76,5 @@ lvchange -ay $vg/pool
|
||||
dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
|
||||
|
||||
fsck -n "$DM_DEV_DIR/mapper/$THIN"
|
||||
+
|
||||
+# exit calls cleanup_mounted_and_teardown
|
||||
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
||||
index cf93538..8652252 100644
|
||||
--- a/tools/lvconvert.c
|
||||
+++ b/tools/lvconvert.c
|
||||
@@ -4264,6 +4264,11 @@ static int _lvconvert_cachevol_attach_single(struct cmd_context *cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ if (lv_is_cache_vol(cachevol_lv)) {
|
||||
+ log_error("LV %s is already used as a cachevol.", display_lvname(cachevol_lv));
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/* Ensure the LV is not active elsewhere. */
|
||||
if (!lockd_lv(cmd, lv, "ex", 0))
|
||||
goto_out;
|
||||
@@ -4347,6 +4352,11 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ if (lv_is_cache_vol(cachepool_lv)) {
|
||||
+ log_error("LV %s is already used as a cachevol.", display_lvname(cachepool_lv));
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
if (cachepool_lv == lv) {
|
||||
log_error("Use a different LV for cache pool LV and cache LV %s.",
|
||||
display_lvname(cachepool_lv));
|
||||
@@ -5629,6 +5639,11 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
+ if (lv_is_cache_vol(lv_fast)) {
|
||||
+ log_error("LV %s is already used as a cachevol.", display_lvname(lv_fast));
|
||||
+ goto bad;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* To permit this we need to check the block size of the fs using lv
|
||||
* (recently in libblkid) so that we can use a matching writecache
|
||||
--
|
||||
1.8.3.1
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
From 48105f492f7f8c157ba714217ae55c6fb50e76c0 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Plotnikov <wgh@torlan.ru>
|
||||
Date: Wed, 22 Apr 2020 00:16:29 +0300
|
||||
Subject: [PATCH] Fix scripts/lvmlocks.service.in using nonexistent --lock-opt
|
||||
autowait
|
||||
|
||||
The --lock-opt autowait was dropped back in 9ab6bdce01,
|
||||
and attempting to specify it has quite an opposite effect:
|
||||
no waiting is done, which makes the unit almost useless.
|
||||
|
||||
(cherry picked from commit a509776588a5c0c0bfc2394e4d1ed717531b0257)
|
||||
---
|
||||
scripts/lvmlocks.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/lvmlocks.service.in b/scripts/lvmlocks.service.in
|
||||
index f6a951f..a3d0bd4 100644
|
||||
--- a/scripts/lvmlocks.service.in
|
||||
+++ b/scripts/lvmlocks.service.in
|
||||
@@ -8,7 +8,7 @@ Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
# start lockspaces and wait for them to finish starting
|
||||
-ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt autowait
|
||||
+ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt auto
|
||||
|
||||
# stop lockspaces and wait for them to finish stopping
|
||||
ExecStop=@SBINDIR@/lvmlockctl --stop-lockspaces --wait 1
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,24 +0,0 @@
|
||||
From a08afc8d0d18b2547176e731852b816df76c63eb Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 11:04:12 -0500
|
||||
Subject: [PATCH 3/3] WHATS_NEW: integrity with raid
|
||||
|
||||
(cherry picked from commit 211eaa284c4df992916e0a523d0ff932aa790a98)
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 89583f7..c0267b7 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.03.10 -
|
||||
=================================
|
||||
+ Add integrity with raid capability.
|
||||
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
|
||||
|
||||
Version 2.03.09 - 26th March 2020
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,15 +0,0 @@
|
||||
WHATS_NEW | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index db914c0..89583f7 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,3 +1,7 @@
|
||||
+Version 2.03.10 -
|
||||
+=================================
|
||||
+ Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
|
||||
+
|
||||
Version 2.03.09 - 26th March 2020
|
||||
=================================
|
||||
Fix formating of vdopool (vdo_slab_size_mb was smaller by 2 bits).
|
@ -1,179 +0,0 @@
|
||||
WHATS_NEW_DM | 4 ++++
|
||||
man/blkdeactivate.8_main | 11 +++++++++++
|
||||
scripts/blkdeactivate.sh.in | 48 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
3 files changed, 62 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
|
||||
index 12bdcea..3ec9c3c 100644
|
||||
--- a/WHATS_NEW_DM
|
||||
+++ b/WHATS_NEW_DM
|
||||
@@ -1,3 +1,7 @@
|
||||
+Version 1.02.173 -
|
||||
+==================================
|
||||
+ Add support for VDO in blkdeactivate script.
|
||||
+
|
||||
Version 1.02.171 - 26th March 2020
|
||||
==================================
|
||||
Fix dm_list interators with gcc 10 optimization (-ftree-pta).
|
||||
diff --git a/man/blkdeactivate.8_main b/man/blkdeactivate.8_main
|
||||
index f3c19a8..06af52e 100644
|
||||
--- a/man/blkdeactivate.8_main
|
||||
+++ b/man/blkdeactivate.8_main
|
||||
@@ -9,6 +9,7 @@ blkdeactivate \(em utility to deactivate block devices
|
||||
.RB [ -l \ \fIlvm_options\fP ]
|
||||
.RB [ -m \ \fImpath_options\fP ]
|
||||
.RB [ -r \ \fImdraid_options\fP ]
|
||||
+.RB [ -o \ \fIvdo_options\fP ]
|
||||
.RB [ -u ]
|
||||
.RB [ -v ]
|
||||
.RI [ device ]
|
||||
@@ -70,6 +71,15 @@ Comma-separated list of MD RAID specific options:
|
||||
Wait MD device's resync, recovery or reshape action to complete
|
||||
before deactivation.
|
||||
.RE
|
||||
+
|
||||
+.TP
|
||||
+.BR -o ", " --vdooptions \ \fIvdo_options\fP
|
||||
+Comma-separated list of VDO specific options:
|
||||
+.RS
|
||||
+.IP \fIconfigfile=file\fP
|
||||
+Use specified VDO configuration file.
|
||||
+.RE
|
||||
+
|
||||
.TP
|
||||
.BR -u ", " --umount
|
||||
Unmount a mounted device before trying to deactivate it.
|
||||
@@ -120,4 +130,5 @@ of a device-mapper device fails, retry it and force removal.
|
||||
.BR lvm (8),
|
||||
.BR mdadm (8),
|
||||
.BR multipathd (8),
|
||||
+.BR vdo (8),
|
||||
.BR umount (8)
|
||||
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
|
||||
index a4b8a8f..57b3e58 100644
|
||||
--- a/scripts/blkdeactivate.sh.in
|
||||
+++ b/scripts/blkdeactivate.sh.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
-# Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
|
||||
+# Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -38,6 +38,7 @@ MDADM="/sbin/mdadm"
|
||||
MOUNTPOINT="/bin/mountpoint"
|
||||
MPATHD="/sbin/multipathd"
|
||||
UMOUNT="/bin/umount"
|
||||
+VDO="/bin/vdo"
|
||||
|
||||
sbindir="@SBINDIR@"
|
||||
DMSETUP="$sbindir/dmsetup"
|
||||
@@ -54,6 +55,7 @@ DMSETUP_OPTS=""
|
||||
LVM_OPTS=""
|
||||
MDADM_OPTS=""
|
||||
MPATHD_OPTS=""
|
||||
+VDO_OPTS=""
|
||||
|
||||
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
||||
LSBLK_VARS="local devtype local kname local name local mnt"
|
||||
@@ -124,6 +126,7 @@ usage() {
|
||||
echo " -l | --lvmoptions LVM_OPTIONS Comma separated LVM specific options"
|
||||
echo " -m | --mpathoptions MPATH_OPTIONS Comma separated DM-multipath specific options"
|
||||
echo " -r | --mdraidoptions MDRAID_OPTIONS Comma separated MD RAID specific options"
|
||||
+ echo " -o | --vdooptions VDO_OPTIONS Comma separated VDO specific options"
|
||||
echo " -u | --umount Unmount the device if mounted"
|
||||
echo " -v | --verbose Verbose mode (also implies -e)"
|
||||
echo
|
||||
@@ -138,6 +141,8 @@ usage() {
|
||||
echo " wait wait for resync, recovery or reshape to complete first"
|
||||
echo " MPATH_OPTIONS:"
|
||||
echo " disablequeueing disable queueing on all DM-multipath devices first"
|
||||
+ echo " VDO_OPTIONS:"
|
||||
+ echo " configfile=file use specified VDO configuration file"
|
||||
|
||||
exit
|
||||
}
|
||||
@@ -319,6 +324,23 @@ deactivate_md () {
|
||||
fi
|
||||
}
|
||||
|
||||
+deactivate_vdo() {
|
||||
+ local xname
|
||||
+ xname=$(printf "%s" "$name")
|
||||
+ test -b "$DEV_DIR/mapper/$xname" || return 0
|
||||
+ test -z "${SKIP_DEVICE_LIST["$kname"]}" || return 1
|
||||
+
|
||||
+ deactivate_holders "$DEV_DIR/mapper/$xname" || return 1
|
||||
+
|
||||
+ echo -n " [VDO]: deactivating VDO volume $xname... "
|
||||
+ if eval "$VDO" stop $VDO_OPTS --name="$xname" "$OUT" "$ERR"; then
|
||||
+ echo "done"
|
||||
+ else
|
||||
+ echo "skipping"
|
||||
+ add_device_to_skip_list
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
deactivate () {
|
||||
######################################################################
|
||||
# DEACTIVATION HOOKS FOR NEW DEVICE TYPES GO HERE! #
|
||||
@@ -335,6 +357,8 @@ deactivate () {
|
||||
######################################################################
|
||||
if test "$devtype" = "lvm"; then
|
||||
deactivate_lvm
|
||||
+ elif test "$devtype" = "vdo"; then
|
||||
+ deactivate_vdo
|
||||
elif test "${kname:0:3}" = "dm-"; then
|
||||
deactivate_dm
|
||||
elif test "${kname:0:2}" = "md"; then
|
||||
@@ -479,6 +503,20 @@ get_mpathopts() {
|
||||
IFS=$ORIG_IFS
|
||||
}
|
||||
|
||||
+get_vdoopts() {
|
||||
+ ORIG_IFS=$IFS; IFS=','
|
||||
+
|
||||
+ for opt in $1; do
|
||||
+ case "$opt" in
|
||||
+ "") ;;
|
||||
+ configfile=*) tmp=${opt#*=}; VDO_OPTS+="--confFile=${tmp%%,*} " ;;
|
||||
+ *) echo "$opt: unknown VDO option"
|
||||
+ esac
|
||||
+ done
|
||||
+
|
||||
+ IFS=$ORIG_IFS
|
||||
+}
|
||||
+
|
||||
set_env() {
|
||||
if test "$ERRORS" -eq "1"; then
|
||||
unset ERR
|
||||
@@ -493,6 +531,7 @@ set_env() {
|
||||
LVM_OPTS+="-vvvv"
|
||||
MDADM_OPTS+="-vv"
|
||||
MPATHD_OPTS+="-v 3"
|
||||
+ VDO_OPTS+="--verbose "
|
||||
else
|
||||
OUT="1>$DEV_DIR/null"
|
||||
fi
|
||||
@@ -509,6 +548,12 @@ set_env() {
|
||||
MDADM_AVAILABLE=0
|
||||
fi
|
||||
|
||||
+ if test -f $VDO; then
|
||||
+ VDO_AVAILABLE=1
|
||||
+ else
|
||||
+ VDO_AVAILABLE=0
|
||||
+ fi
|
||||
+
|
||||
MPATHD_RUNNING=0
|
||||
test "$MPATHD_DO_DISABLEQUEUEING" -eq 1 && {
|
||||
if test -f "$MPATHD"; then
|
||||
@@ -528,6 +573,7 @@ while test $# -ne 0; do
|
||||
"-l"|"--lvmoptions") get_lvmopts "$2" ; shift ;;
|
||||
"-m"|"--mpathoptions") get_mpathopts "$2" ; shift ;;
|
||||
"-r"|"--mdraidoptions") get_mdraidopts "$2"; shift ;;
|
||||
+ "-o"|"--vdooptions") get_vdoopts "$2"; shift ;;
|
||||
"-u"|"--umount") DO_UMOUNT=1 ;;
|
||||
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
|
||||
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
|
@ -1,180 +0,0 @@
|
||||
From 7def94164ae6c18d84e40f00db2e2b74a7662b35 Mon Sep 17 00:00:00 2001
|
||||
From: Marian Csontos <mcsontos@redhat.com>
|
||||
Date: Tue, 5 May 2020 10:20:18 +0200
|
||||
Subject: [PATCH] build: make generate
|
||||
|
||||
(cherry picked from commit bcc149048440dce5fc7962f88ed523469dd39a32)
|
||||
---
|
||||
man/lvconvert.8_pregen | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
man/lvcreate.8_pregen | 53 ++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 116 insertions(+)
|
||||
|
||||
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
|
||||
index b676e72..7440984 100644
|
||||
--- a/man/lvconvert.8_pregen
|
||||
+++ b/man/lvconvert.8_pregen
|
||||
@@ -163,6 +163,18 @@ lvconvert - Change logical volume layout
|
||||
.ad b
|
||||
.br
|
||||
.ad l
|
||||
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+ \fB--raidintegrityblocksize\fP \fINumber\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+ \fB--raidintegritymode\fP \fIString\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
|
||||
.ad b
|
||||
.br
|
||||
@@ -982,6 +994,28 @@ Poll LV to continue conversion.
|
||||
.br
|
||||
-
|
||||
|
||||
+Add or remove data integrity checksums to raid images.
|
||||
+.br
|
||||
+.P
|
||||
+\fBlvconvert\fP \fB--raidintegrity\fP \fBy\fP|\fBn\fP \fILV\fP\fI_raid\fP
|
||||
+.br
|
||||
+.RS 4
|
||||
+.ad l
|
||||
+[ \fB--raidintegritymode\fP \fIString\fP ]
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
|
||||
+.ad b
|
||||
+.br
|
||||
+[ COMMON_OPTIONS ]
|
||||
+.RE
|
||||
+.br
|
||||
+.RS 4
|
||||
+[ \fIPV\fP ... ]
|
||||
+.RE
|
||||
+-
|
||||
+
|
||||
Common options for command:
|
||||
.
|
||||
.RS 4
|
||||
@@ -1405,6 +1439,35 @@ Repeat once to also suppress any prompts with answer 'no'.
|
||||
.ad b
|
||||
.HP
|
||||
.ad l
|
||||
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
|
||||
+.br
|
||||
+Enable or disable data integrity checksums for raid images.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
+\fB--raidintegrityblocksize\fP \fINumber\fP
|
||||
+.br
|
||||
+The block size to use for dm-integrity on raid images.
|
||||
+The integrity block size should usually match the device
|
||||
+logical block size, or the file system block size.
|
||||
+It may be less than the file system block size, but not
|
||||
+less than the device logical block size.
|
||||
+Possible values: 512, 1024, 2048, 4096.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
+\fB--raidintegritymode\fP \fIString\fP
|
||||
+.br
|
||||
+Use a journal (default) or bitmap for keeping integrity checksums consistent
|
||||
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
|
||||
+in those areas would not be detected. A journal does not have this problem.
|
||||
+The journal mode doubles writes to storage, but can improve performance for
|
||||
+scattered writes packed into a single journal write.
|
||||
+bitmap mode can in theory achieve full write throughput of the device,
|
||||
+but would not benefit from the potential scattered write optimization.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
|
||||
.br
|
||||
Sets read ahead sector count of an LV.
|
||||
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
|
||||
index a80f9f5..be8e783 100644
|
||||
--- a/man/lvcreate.8_pregen
|
||||
+++ b/man/lvcreate.8_pregen
|
||||
@@ -187,6 +187,18 @@ lvcreate - Create a logical volume
|
||||
.ad b
|
||||
.br
|
||||
.ad l
|
||||
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+ \fB--raidintegrityblocksize\fP \fINumber\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+ \fB--raidintegritymode\fP \fIString\fP
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
|
||||
.ad b
|
||||
.br
|
||||
@@ -425,6 +437,18 @@ Create a raid LV (a specific raid level must be used, e.g. raid1).
|
||||
[ \fB--[raid]maxrecoveryrate\fP \fISize\fP[k|UNIT] ]
|
||||
.ad b
|
||||
.br
|
||||
+.ad l
|
||||
+[ \fB--raidintegrity\fP \fBy\fP|\fBn\fP ]
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+[ \fB--raidintegritymode\fP \fIString\fP ]
|
||||
+.ad b
|
||||
+.br
|
||||
+.ad l
|
||||
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
|
||||
+.ad b
|
||||
+.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.RE
|
||||
.br
|
||||
@@ -1420,6 +1444,35 @@ Repeat once to also suppress any prompts with answer 'no'.
|
||||
.ad b
|
||||
.HP
|
||||
.ad l
|
||||
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
|
||||
+.br
|
||||
+Enable or disable data integrity checksums for raid images.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
+\fB--raidintegrityblocksize\fP \fINumber\fP
|
||||
+.br
|
||||
+The block size to use for dm-integrity on raid images.
|
||||
+The integrity block size should usually match the device
|
||||
+logical block size, or the file system block size.
|
||||
+It may be less than the file system block size, but not
|
||||
+less than the device logical block size.
|
||||
+Possible values: 512, 1024, 2048, 4096.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
+\fB--raidintegritymode\fP \fIString\fP
|
||||
+.br
|
||||
+Use a journal (default) or bitmap for keeping integrity checksums consistent
|
||||
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
|
||||
+in those areas would not be detected. A journal does not have this problem.
|
||||
+The journal mode doubles writes to storage, but can improve performance for
|
||||
+scattered writes packed into a single journal write.
|
||||
+bitmap mode can in theory achieve full write throughput of the device,
|
||||
+but would not benefit from the potential scattered write optimization.
|
||||
+.ad b
|
||||
+.HP
|
||||
+.ad l
|
||||
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
|
||||
.br
|
||||
Sets read ahead sector count of an LV.
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,17 +0,0 @@
|
||||
tools/lvconvert.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
||||
index f6d9a29..bb40930 100644
|
||||
--- a/tools/lvconvert.c
|
||||
+++ b/tools/lvconvert.c
|
||||
@@ -2388,7 +2388,8 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
|
||||
goto deactivate_mlv;
|
||||
}
|
||||
|
||||
- if (thin_dump[0]) {
|
||||
+ /* Check matching transactionId when thin-pool is used by lvm2 (transactionId != 0) */
|
||||
+ if (first_seg(pool_lv)->transaction_id && thin_dump[0]) {
|
||||
argv[0] = thin_dump;
|
||||
argv[1] = pms_path;
|
||||
argv[2] = NULL;
|
@ -1,641 +0,0 @@
|
||||
From 945de675c47d891d1f181f15971d26ff959ac631 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Tue, 14 Jan 2020 14:12:20 -0600
|
||||
Subject: [PATCH 1/3] move pv_list code into lib
|
||||
|
||||
(cherry picked from commit b6b4ad8e28eff7476cb04c4cb93312b06605b82f)
|
||||
---
|
||||
lib/Makefile.in | 1 +
|
||||
lib/metadata/metadata-exported.h | 4 +
|
||||
lib/metadata/pv_list.c | 291 +++++++++++++++++++++++++++++++++++++++
|
||||
tools/toollib.c | 270 ------------------------------------
|
||||
tools/toollib.h | 9 --
|
||||
5 files changed, 296 insertions(+), 279 deletions(-)
|
||||
create mode 100644 lib/metadata/pv_list.c
|
||||
|
||||
diff --git a/lib/Makefile.in b/lib/Makefile.in
|
||||
index c037b41..2a064f3 100644
|
||||
--- a/lib/Makefile.in
|
||||
+++ b/lib/Makefile.in
|
||||
@@ -74,6 +74,7 @@ SOURCES =\
|
||||
metadata/mirror.c \
|
||||
metadata/pool_manip.c \
|
||||
metadata/pv.c \
|
||||
+ metadata/pv_list.c \
|
||||
metadata/pv_manip.c \
|
||||
metadata/pv_map.c \
|
||||
metadata/raid_manip.c \
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index c61c85c..35c1231 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -1385,4 +1385,8 @@ int vg_is_foreign(struct volume_group *vg);
|
||||
|
||||
void vg_write_commit_bad_mdas(struct cmd_context *cmd, struct volume_group *vg);
|
||||
|
||||
+struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
|
||||
+ char **argv, int allocatable_only);
|
||||
+struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl);
|
||||
+
|
||||
#endif
|
||||
diff --git a/lib/metadata/pv_list.c b/lib/metadata/pv_list.c
|
||||
new file mode 100644
|
||||
index 0000000..143b573
|
||||
--- /dev/null
|
||||
+++ b/lib/metadata/pv_list.c
|
||||
@@ -0,0 +1,291 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This file is part of LVM2.
|
||||
+ *
|
||||
+ * This copyrighted material is made available to anyone wishing to use,
|
||||
+ * modify, copy, or redistribute it subject to the terms and conditions
|
||||
+ * of the GNU Lesser General Public License v.2.1.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public License
|
||||
+ * along with this program; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "lib/misc/lib.h"
|
||||
+#include "lib/misc/lvm-string.h"
|
||||
+#include "lib/datastruct/str_list.h"
|
||||
+#include "lib/device/device.h"
|
||||
+#include "lib/metadata/metadata.h"
|
||||
+
|
||||
+/*
|
||||
+ * Process physical extent range specifiers
|
||||
+ */
|
||||
+static int _add_pe_range(struct dm_pool *mem, const char *pvname,
|
||||
+ struct dm_list *pe_ranges, uint32_t start, uint32_t count)
|
||||
+{
|
||||
+ struct pe_range *per;
|
||||
+
|
||||
+ log_debug("Adding PE range: start PE " FMTu32 " length " FMTu32 " on %s.",
|
||||
+ start, count, pvname);
|
||||
+
|
||||
+ /* Ensure no overlap with existing areas */
|
||||
+ dm_list_iterate_items(per, pe_ranges) {
|
||||
+ if (((start < per->start) && (start + count - 1 >= per->start)) ||
|
||||
+ ((start >= per->start) &&
|
||||
+ (per->start + per->count - 1) >= start)) {
|
||||
+ log_error("Overlapping PE ranges specified (" FMTu32
|
||||
+ "-" FMTu32 ", " FMTu32 "-" FMTu32 ") on %s.",
|
||||
+ start, start + count - 1, per->start,
|
||||
+ per->start + per->count - 1, pvname);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!(per = dm_pool_alloc(mem, sizeof(*per)))) {
|
||||
+ log_error("Allocation of list failed.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ per->start = start;
|
||||
+ per->count = count;
|
||||
+ dm_list_add(pe_ranges, &per->list);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int _xstrtouint32(const char *s, char **p, int base, uint32_t *result)
|
||||
+{
|
||||
+ unsigned long ul;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ ul = strtoul(s, p, base);
|
||||
+
|
||||
+ if (errno || *p == s || ul > UINT32_MAX)
|
||||
+ return 0;
|
||||
+
|
||||
+ *result = ul;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
|
||||
+ const char *pvname, uint32_t size)
|
||||
+{
|
||||
+ char *endptr;
|
||||
+ uint32_t start, end, len;
|
||||
+
|
||||
+ /* Default to whole PV */
|
||||
+ if (!c) {
|
||||
+ if (!_add_pe_range(mem, pvname, pe_ranges, UINT32_C(0), size))
|
||||
+ return_0;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ while (*c) {
|
||||
+ if (*c != ':')
|
||||
+ goto error;
|
||||
+
|
||||
+ c++;
|
||||
+
|
||||
+ /* Disallow :: and :\0 */
|
||||
+ if (*c == ':' || !*c)
|
||||
+ goto error;
|
||||
+
|
||||
+ /* Default to whole range */
|
||||
+ start = UINT32_C(0);
|
||||
+ end = size - 1;
|
||||
+
|
||||
+ /* Start extent given? */
|
||||
+ if (isdigit(*c)) {
|
||||
+ if (!_xstrtouint32(c, &endptr, 10, &start))
|
||||
+ goto error;
|
||||
+ c = endptr;
|
||||
+ /* Just one number given? */
|
||||
+ if (!*c || *c == ':')
|
||||
+ end = start;
|
||||
+ }
|
||||
+ /* Range? */
|
||||
+ if (*c == '-') {
|
||||
+ c++;
|
||||
+ if (isdigit(*c)) {
|
||||
+ if (!_xstrtouint32(c, &endptr, 10, &end))
|
||||
+ goto error;
|
||||
+ c = endptr;
|
||||
+ }
|
||||
+ } else if (*c == '+') { /* Length? */
|
||||
+ c++;
|
||||
+ if (isdigit(*c)) {
|
||||
+ if (!_xstrtouint32(c, &endptr, 10, &len))
|
||||
+ goto error;
|
||||
+ c = endptr;
|
||||
+ end = start + (len ? (len - 1) : 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (*c && *c != ':')
|
||||
+ goto error;
|
||||
+
|
||||
+ if ((start > end) || (end > size - 1)) {
|
||||
+ log_error("PE range error: start extent %" PRIu32 " to "
|
||||
+ "end extent %" PRIu32 ".", start, end);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!_add_pe_range(mem, pvname, pe_ranges, start, end - start + 1))
|
||||
+ return_0;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+
|
||||
+ error:
|
||||
+ log_error("Physical extent parsing error at %s.", c);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
|
||||
+ char *colon, int allocatable_only, struct dm_list *r)
|
||||
+{
|
||||
+ const char *pvname;
|
||||
+ struct pv_list *new_pvl = NULL, *pvl2;
|
||||
+ struct dm_list *pe_ranges;
|
||||
+
|
||||
+ pvname = pv_dev_name(pvl->pv);
|
||||
+ if (allocatable_only && !(pvl->pv->status & ALLOCATABLE_PV)) {
|
||||
+ log_warn("WARNING: Physical volume %s not allocatable.", pvname);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (allocatable_only && is_missing_pv(pvl->pv)) {
|
||||
+ log_warn("WARNING: Physical volume %s is missing.", pvname);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (allocatable_only &&
|
||||
+ (pvl->pv->pe_count == pvl->pv->pe_alloc_count)) {
|
||||
+ log_warn("WARNING: No free extents on physical volume \"%s\".", pvname);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ dm_list_iterate_items(pvl2, r)
|
||||
+ if (pvl->pv->dev == pvl2->pv->dev) {
|
||||
+ new_pvl = pvl2;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (!new_pvl) {
|
||||
+ if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
|
||||
+ log_error("Unable to allocate physical volume list.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(new_pvl, pvl, sizeof(*new_pvl));
|
||||
+
|
||||
+ if (!(pe_ranges = dm_pool_alloc(mem, sizeof(*pe_ranges)))) {
|
||||
+ log_error("Allocation of pe_ranges list failed.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ dm_list_init(pe_ranges);
|
||||
+ new_pvl->pe_ranges = pe_ranges;
|
||||
+ dm_list_add(r, &new_pvl->list);
|
||||
+ }
|
||||
+
|
||||
+ /* Determine selected physical extents */
|
||||
+ if (!_parse_pes(mem, colon, new_pvl->pe_ranges, pv_dev_name(pvl->pv),
|
||||
+ pvl->pv->pe_count))
|
||||
+ return_0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
|
||||
+ char **argv, int allocatable_only)
|
||||
+{
|
||||
+ struct dm_list *r;
|
||||
+ struct pv_list *pvl;
|
||||
+ struct dm_list tagsl, arg_pvnames;
|
||||
+ char *pvname = NULL;
|
||||
+ char *colon, *at_sign, *tagname;
|
||||
+ int i;
|
||||
+
|
||||
+ /* Build up list of PVs */
|
||||
+ if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
|
||||
+ log_error("Allocation of list failed.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ dm_list_init(r);
|
||||
+
|
||||
+ dm_list_init(&tagsl);
|
||||
+ dm_list_init(&arg_pvnames);
|
||||
+
|
||||
+ for (i = 0; i < argc; i++) {
|
||||
+ dm_unescape_colons_and_at_signs(argv[i], &colon, &at_sign);
|
||||
+
|
||||
+ if (at_sign && (at_sign == argv[i])) {
|
||||
+ tagname = at_sign + 1;
|
||||
+ if (!validate_tag(tagname)) {
|
||||
+ log_error("Skipping invalid tag %s.", tagname);
|
||||
+ continue;
|
||||
+ }
|
||||
+ dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
+ if (str_list_match_item(&pvl->pv->tags,
|
||||
+ tagname)) {
|
||||
+ if (!_create_pv_entry(mem, pvl, NULL,
|
||||
+ allocatable_only,
|
||||
+ r))
|
||||
+ return_NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ pvname = argv[i];
|
||||
+
|
||||
+ if (colon && !(pvname = dm_pool_strndup(mem, pvname,
|
||||
+ (unsigned) (colon - pvname)))) {
|
||||
+ log_error("Failed to clone PV name.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!(pvl = find_pv_in_vg(vg, pvname))) {
|
||||
+ log_error("Physical Volume \"%s\" not found in "
|
||||
+ "Volume Group \"%s\".", pvname, vg->name);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (!_create_pv_entry(mem, pvl, colon, allocatable_only, r))
|
||||
+ return_NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (dm_list_empty(r))
|
||||
+ log_error("No specified PVs have space available.");
|
||||
+
|
||||
+ return dm_list_empty(r) ? NULL : r;
|
||||
+}
|
||||
+
|
||||
+struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
|
||||
+{
|
||||
+ struct dm_list *r;
|
||||
+ struct pv_list *pvl, *new_pvl;
|
||||
+
|
||||
+ /* Build up list of PVs */
|
||||
+ if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
|
||||
+ log_error("Allocation of list failed.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ dm_list_init(r);
|
||||
+
|
||||
+ dm_list_iterate_items(pvl, pvsl) {
|
||||
+ if (!(new_pvl = dm_pool_zalloc(mem, sizeof(*new_pvl)))) {
|
||||
+ log_error("Unable to allocate physical volume list.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(new_pvl, pvl, sizeof(*new_pvl));
|
||||
+ dm_list_add(r, &new_pvl->list);
|
||||
+ }
|
||||
+
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index a5304bf..6386a69 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -457,276 +457,6 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name)
|
||||
return vg_name;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Process physical extent range specifiers
|
||||
- */
|
||||
-static int _add_pe_range(struct dm_pool *mem, const char *pvname,
|
||||
- struct dm_list *pe_ranges, uint32_t start, uint32_t count)
|
||||
-{
|
||||
- struct pe_range *per;
|
||||
-
|
||||
- log_debug("Adding PE range: start PE " FMTu32 " length " FMTu32 " on %s.",
|
||||
- start, count, pvname);
|
||||
-
|
||||
- /* Ensure no overlap with existing areas */
|
||||
- dm_list_iterate_items(per, pe_ranges) {
|
||||
- if (((start < per->start) && (start + count - 1 >= per->start)) ||
|
||||
- ((start >= per->start) &&
|
||||
- (per->start + per->count - 1) >= start)) {
|
||||
- log_error("Overlapping PE ranges specified (" FMTu32
|
||||
- "-" FMTu32 ", " FMTu32 "-" FMTu32 ") on %s.",
|
||||
- start, start + count - 1, per->start,
|
||||
- per->start + per->count - 1, pvname);
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!(per = dm_pool_alloc(mem, sizeof(*per)))) {
|
||||
- log_error("Allocation of list failed.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- per->start = start;
|
||||
- per->count = count;
|
||||
- dm_list_add(pe_ranges, &per->list);
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-static int _xstrtouint32(const char *s, char **p, int base, uint32_t *result)
|
||||
-{
|
||||
- unsigned long ul;
|
||||
-
|
||||
- errno = 0;
|
||||
- ul = strtoul(s, p, base);
|
||||
-
|
||||
- if (errno || *p == s || ul > UINT32_MAX)
|
||||
- return 0;
|
||||
-
|
||||
- *result = ul;
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
|
||||
- const char *pvname, uint32_t size)
|
||||
-{
|
||||
- char *endptr;
|
||||
- uint32_t start, end, len;
|
||||
-
|
||||
- /* Default to whole PV */
|
||||
- if (!c) {
|
||||
- if (!_add_pe_range(mem, pvname, pe_ranges, UINT32_C(0), size))
|
||||
- return_0;
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- while (*c) {
|
||||
- if (*c != ':')
|
||||
- goto error;
|
||||
-
|
||||
- c++;
|
||||
-
|
||||
- /* Disallow :: and :\0 */
|
||||
- if (*c == ':' || !*c)
|
||||
- goto error;
|
||||
-
|
||||
- /* Default to whole range */
|
||||
- start = UINT32_C(0);
|
||||
- end = size - 1;
|
||||
-
|
||||
- /* Start extent given? */
|
||||
- if (isdigit(*c)) {
|
||||
- if (!_xstrtouint32(c, &endptr, 10, &start))
|
||||
- goto error;
|
||||
- c = endptr;
|
||||
- /* Just one number given? */
|
||||
- if (!*c || *c == ':')
|
||||
- end = start;
|
||||
- }
|
||||
- /* Range? */
|
||||
- if (*c == '-') {
|
||||
- c++;
|
||||
- if (isdigit(*c)) {
|
||||
- if (!_xstrtouint32(c, &endptr, 10, &end))
|
||||
- goto error;
|
||||
- c = endptr;
|
||||
- }
|
||||
- } else if (*c == '+') { /* Length? */
|
||||
- c++;
|
||||
- if (isdigit(*c)) {
|
||||
- if (!_xstrtouint32(c, &endptr, 10, &len))
|
||||
- goto error;
|
||||
- c = endptr;
|
||||
- end = start + (len ? (len - 1) : 0);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (*c && *c != ':')
|
||||
- goto error;
|
||||
-
|
||||
- if ((start > end) || (end > size - 1)) {
|
||||
- log_error("PE range error: start extent %" PRIu32 " to "
|
||||
- "end extent %" PRIu32 ".", start, end);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (!_add_pe_range(mem, pvname, pe_ranges, start, end - start + 1))
|
||||
- return_0;
|
||||
-
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-
|
||||
- error:
|
||||
- log_error("Physical extent parsing error at %s.", c);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
|
||||
- char *colon, int allocatable_only, struct dm_list *r)
|
||||
-{
|
||||
- const char *pvname;
|
||||
- struct pv_list *new_pvl = NULL, *pvl2;
|
||||
- struct dm_list *pe_ranges;
|
||||
-
|
||||
- pvname = pv_dev_name(pvl->pv);
|
||||
- if (allocatable_only && !(pvl->pv->status & ALLOCATABLE_PV)) {
|
||||
- log_warn("WARNING: Physical volume %s not allocatable.", pvname);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- if (allocatable_only && is_missing_pv(pvl->pv)) {
|
||||
- log_warn("WARNING: Physical volume %s is missing.", pvname);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- if (allocatable_only &&
|
||||
- (pvl->pv->pe_count == pvl->pv->pe_alloc_count)) {
|
||||
- log_warn("WARNING: No free extents on physical volume \"%s\".", pvname);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- dm_list_iterate_items(pvl2, r)
|
||||
- if (pvl->pv->dev == pvl2->pv->dev) {
|
||||
- new_pvl = pvl2;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if (!new_pvl) {
|
||||
- if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
|
||||
- log_error("Unable to allocate physical volume list.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- memcpy(new_pvl, pvl, sizeof(*new_pvl));
|
||||
-
|
||||
- if (!(pe_ranges = dm_pool_alloc(mem, sizeof(*pe_ranges)))) {
|
||||
- log_error("Allocation of pe_ranges list failed.");
|
||||
- return 0;
|
||||
- }
|
||||
- dm_list_init(pe_ranges);
|
||||
- new_pvl->pe_ranges = pe_ranges;
|
||||
- dm_list_add(r, &new_pvl->list);
|
||||
- }
|
||||
-
|
||||
- /* Determine selected physical extents */
|
||||
- if (!_parse_pes(mem, colon, new_pvl->pe_ranges, pv_dev_name(pvl->pv),
|
||||
- pvl->pv->pe_count))
|
||||
- return_0;
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
|
||||
- char **argv, int allocatable_only)
|
||||
-{
|
||||
- struct dm_list *r;
|
||||
- struct pv_list *pvl;
|
||||
- struct dm_list tagsl, arg_pvnames;
|
||||
- char *pvname = NULL;
|
||||
- char *colon, *at_sign, *tagname;
|
||||
- int i;
|
||||
-
|
||||
- /* Build up list of PVs */
|
||||
- if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
|
||||
- log_error("Allocation of list failed.");
|
||||
- return NULL;
|
||||
- }
|
||||
- dm_list_init(r);
|
||||
-
|
||||
- dm_list_init(&tagsl);
|
||||
- dm_list_init(&arg_pvnames);
|
||||
-
|
||||
- for (i = 0; i < argc; i++) {
|
||||
- dm_unescape_colons_and_at_signs(argv[i], &colon, &at_sign);
|
||||
-
|
||||
- if (at_sign && (at_sign == argv[i])) {
|
||||
- tagname = at_sign + 1;
|
||||
- if (!validate_tag(tagname)) {
|
||||
- log_error("Skipping invalid tag %s.", tagname);
|
||||
- continue;
|
||||
- }
|
||||
- dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
- if (str_list_match_item(&pvl->pv->tags,
|
||||
- tagname)) {
|
||||
- if (!_create_pv_entry(mem, pvl, NULL,
|
||||
- allocatable_only,
|
||||
- r))
|
||||
- return_NULL;
|
||||
- }
|
||||
- }
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- pvname = argv[i];
|
||||
-
|
||||
- if (colon && !(pvname = dm_pool_strndup(mem, pvname,
|
||||
- (unsigned) (colon - pvname)))) {
|
||||
- log_error("Failed to clone PV name.");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (!(pvl = find_pv_in_vg(vg, pvname))) {
|
||||
- log_error("Physical Volume \"%s\" not found in "
|
||||
- "Volume Group \"%s\".", pvname, vg->name);
|
||||
- return NULL;
|
||||
- }
|
||||
- if (!_create_pv_entry(mem, pvl, colon, allocatable_only, r))
|
||||
- return_NULL;
|
||||
- }
|
||||
-
|
||||
- if (dm_list_empty(r))
|
||||
- log_error("No specified PVs have space available.");
|
||||
-
|
||||
- return dm_list_empty(r) ? NULL : r;
|
||||
-}
|
||||
-
|
||||
-struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
|
||||
-{
|
||||
- struct dm_list *r;
|
||||
- struct pv_list *pvl, *new_pvl;
|
||||
-
|
||||
- /* Build up list of PVs */
|
||||
- if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
|
||||
- log_error("Allocation of list failed.");
|
||||
- return NULL;
|
||||
- }
|
||||
- dm_list_init(r);
|
||||
-
|
||||
- dm_list_iterate_items(pvl, pvsl) {
|
||||
- if (!(new_pvl = dm_pool_zalloc(mem, sizeof(*new_pvl)))) {
|
||||
- log_error("Unable to allocate physical volume list.");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- memcpy(new_pvl, pvl, sizeof(*new_pvl));
|
||||
- dm_list_add(r, &new_pvl->list);
|
||||
- }
|
||||
-
|
||||
- return r;
|
||||
-}
|
||||
-
|
||||
const char _pe_size_may_not_be_negative_msg[] = "Physical extent size may not be negative.";
|
||||
|
||||
int vgcreate_params_set_defaults(struct cmd_context *cmd,
|
||||
diff --git a/tools/toollib.h b/tools/toollib.h
|
||||
index 9102f55..53a5e5b 100644
|
||||
--- a/tools/toollib.h
|
||||
+++ b/tools/toollib.h
|
||||
@@ -182,15 +182,6 @@ void opt_array_to_str(struct cmd_context *cmd, int *opts, int count,
|
||||
int pvcreate_params_from_args(struct cmd_context *cmd, struct pvcreate_params *pp);
|
||||
int pvcreate_each_device(struct cmd_context *cmd, struct processing_handle *handle, struct pvcreate_params *pp);
|
||||
|
||||
-/*
|
||||
- * Builds a list of pv's from the names in argv. Used in
|
||||
- * lvcreate/extend.
|
||||
- */
|
||||
-struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
|
||||
- char **argv, int allocatable_only);
|
||||
-
|
||||
-struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvs);
|
||||
-
|
||||
int vgcreate_params_set_defaults(struct cmd_context *cmd,
|
||||
struct vgcreate_params *vp_def,
|
||||
struct volume_group *vg);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,82 +0,0 @@
|
||||
test/shell/thin-foreign-repair.sh | 72 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 72 insertions(+)
|
||||
create mode 100644 test/shell/thin-foreign-repair.sh
|
||||
|
||||
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
|
||||
new file mode 100644
|
||||
index 0000000..147a9a0
|
||||
--- /dev/null
|
||||
+++ b/test/shell/thin-foreign-repair.sh
|
||||
@@ -0,0 +1,72 @@
|
||||
+#!/usr/bin/env bash
|
||||
+
|
||||
+# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||
+# of the GNU General Public License v.2.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software Foundation,
|
||||
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+
|
||||
+# test foreing user of thin-pool
|
||||
+
|
||||
+
|
||||
+SKIP_WITH_LVMPOLLD=1
|
||||
+
|
||||
+. lib/inittest
|
||||
+
|
||||
+cleanup_mounted_and_teardown()
|
||||
+{
|
||||
+ dmsetup remove $THIN || true
|
||||
+ vgremove -ff $vg
|
||||
+ aux teardown
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# Main
|
||||
+#
|
||||
+aux have_thin 1 0 0 || skip
|
||||
+which mkfs.ext4 || skip
|
||||
+
|
||||
+# Use our mkfs config file to get approximately same results
|
||||
+# TODO: maybe use it for all test via some 'prepare' function
|
||||
+export MKE2FS_CONFIG="$TESTOLDPWD/lib/mke2fs.conf"
|
||||
+
|
||||
+aux prepare_vg 2 64
|
||||
+
|
||||
+# Create named pool only
|
||||
+lvcreate -L2 -T $vg/pool
|
||||
+
|
||||
+POOL="$vg-pool"
|
||||
+THIN="${PREFIX}_thin"
|
||||
+
|
||||
+# Foreing user is using own ioctl command to create thin devices
|
||||
+dmsetup message $POOL 0 "create_thin 0"
|
||||
+dmsetup message $POOL 0 "set_transaction_id 0 2"
|
||||
+
|
||||
+# Once the transaction id has changed, lvm2 shall not be able to create thinLV
|
||||
+fail lvcreate -V10 $vg/pool
|
||||
+
|
||||
+trap 'cleanup_mounted_and_teardown' EXIT
|
||||
+
|
||||
+# 20M thin device
|
||||
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
|
||||
+
|
||||
+mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
|
||||
+
|
||||
+dmsetup remove "$THIN"
|
||||
+
|
||||
+lvchange -an $vg/pool
|
||||
+
|
||||
+# Repair thin-pool used by 'foreing' apps (setting their own tid)
|
||||
+lvconvert --repair $vg/pool 2>&1 | tee out
|
||||
+
|
||||
+not grep "Transaction id" out
|
||||
+
|
||||
+lvchange -ay $vg/pool
|
||||
+
|
||||
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
|
||||
+
|
||||
+fsck -n "$DM_DEV_DIR/mapper/$THIN"
|
15
SOURCES/lvm2-2_03_12-WHATS_NEW-update.patch
Normal file
15
SOURCES/lvm2-2_03_12-WHATS_NEW-update.patch
Normal file
@ -0,0 +1,15 @@
|
||||
WHATS_NEW | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index ffefc9d..3953c7e 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,7 @@
|
||||
Version 2.03.12 -
|
||||
===================================
|
||||
+ Fix problem with wiping of converted LVs.
|
||||
+ Fix memleak in scanning (2.03.11).
|
||||
Fix corner case allocation for thin-pools.
|
||||
|
||||
Version 2.03.11 - 08th January 2021
|
@ -0,0 +1,47 @@
|
||||
WHATS_NEW | 10 ++++++++--
|
||||
lib/metadata/lv_manip.c | 10 +++++++---
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 452a631..fe347f7 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,3 +1,7 @@
|
||||
+Version 2.03.12 -
|
||||
+===================================
|
||||
+ Fix corner case allocation for thin-pools.
|
||||
+
|
||||
Version 2.03.11 - 08th January 2021
|
||||
===================================
|
||||
Fix pvck handling MDA at offset different from 4096.
|
||||
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
|
||||
index 7046436..443d32c 100644
|
||||
--- a/lib/metadata/lv_manip.c
|
||||
+++ b/lib/metadata/lv_manip.c
|
||||
@@ -1850,11 +1850,13 @@ static uint32_t _mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint
|
||||
|
||||
/* Is there enough total space or should we give up immediately? */
|
||||
static int _sufficient_pes_free(struct alloc_handle *ah, struct dm_list *pvms,
|
||||
- uint32_t allocated, uint32_t extents_still_needed)
|
||||
+ uint32_t allocated, uint32_t log_still_needed,
|
||||
+ uint32_t extents_still_needed)
|
||||
{
|
||||
uint32_t area_extents_needed = (extents_still_needed - allocated) * ah->area_count / ah->area_multiple;
|
||||
uint32_t parity_extents_needed = (extents_still_needed - allocated) * ah->parity_count / ah->area_multiple;
|
||||
- uint32_t metadata_extents_needed = ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN + ah->log_len; /* One each */
|
||||
+ uint32_t metadata_extents_needed = (ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN) +
|
||||
+ (log_still_needed ? ah->log_len : 0); /* One each */
|
||||
uint64_t total_extents_needed = (uint64_t)area_extents_needed + parity_extents_needed + metadata_extents_needed;
|
||||
uint32_t free_pes = pv_maps_size(pvms);
|
||||
|
||||
@@ -3359,7 +3361,9 @@ static int _allocate(struct alloc_handle *ah,
|
||||
old_allocated = alloc_state.allocated;
|
||||
log_debug_alloc("Trying allocation using %s policy.", get_alloc_string(alloc));
|
||||
|
||||
- if (!ah->approx_alloc && !_sufficient_pes_free(ah, pvms, alloc_state.allocated, ah->new_extents))
|
||||
+ if (!ah->approx_alloc && !_sufficient_pes_free(ah, pvms, alloc_state.allocated,
|
||||
+ alloc_state.log_area_count_still_needed,
|
||||
+ ah->new_extents))
|
||||
goto_out;
|
||||
|
||||
_init_alloc_parms(ah, &alloc_parms, alloc, prev_lvseg,
|
107
SOURCES/lvm2-2_03_12-cache-reuse-code-for-metadata-min_max.patch
Normal file
107
SOURCES/lvm2-2_03_12-cache-reuse-code-for-metadata-min_max.patch
Normal file
@ -0,0 +1,107 @@
|
||||
lib/metadata/cache_manip.c | 40 ++++++++++++++--------------------------
|
||||
lib/metadata/metadata-exported.h | 1 +
|
||||
tools/lvconvert.c | 1 +
|
||||
tools/lvcreate.c | 1 +
|
||||
4 files changed, 17 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
|
||||
index 2c4cc92..90ebd94 100644
|
||||
--- a/lib/metadata/cache_manip.c
|
||||
+++ b/lib/metadata/cache_manip.c
|
||||
@@ -204,6 +204,7 @@ int update_cache_pool_params(struct cmd_context *cmd,
|
||||
unsigned attr,
|
||||
uint32_t pool_data_extents,
|
||||
uint32_t *pool_metadata_extents,
|
||||
+ struct logical_volume *metadata_lv,
|
||||
int *chunk_size_calc_method, uint32_t *chunk_size)
|
||||
{
|
||||
uint64_t min_meta_size;
|
||||
@@ -252,39 +253,26 @@ int update_cache_pool_params(struct cmd_context *cmd,
|
||||
if (!validate_cache_chunk_size(cmd, *chunk_size))
|
||||
return_0;
|
||||
|
||||
- min_meta_size = _cache_min_metadata_size((uint64_t) pool_data_extents * extent_size, *chunk_size);
|
||||
+ if ((uint64_t) *chunk_size > (uint64_t) pool_data_extents * extent_size) {
|
||||
+ log_error("Size of %s data volume cannot be smaller than chunk size %s.",
|
||||
+ segtype->name, display_size(cmd, *chunk_size));
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- /* Round up to extent size */
|
||||
- if (min_meta_size % extent_size)
|
||||
- min_meta_size += extent_size - min_meta_size % extent_size;
|
||||
+ min_meta_size = _cache_min_metadata_size((uint64_t) pool_data_extents * extent_size, *chunk_size);
|
||||
+ min_meta_size = dm_round_up(min_meta_size, extent_size);
|
||||
|
||||
if (!pool_metadata_size)
|
||||
pool_metadata_size = min_meta_size;
|
||||
|
||||
- if (pool_metadata_size > (2 * DEFAULT_CACHE_POOL_MAX_METADATA_SIZE)) {
|
||||
- pool_metadata_size = 2 * DEFAULT_CACHE_POOL_MAX_METADATA_SIZE;
|
||||
- if (*pool_metadata_extents)
|
||||
- log_warn("WARNING: Maximum supported pool metadata size is %s.",
|
||||
- display_size(cmd, pool_metadata_size));
|
||||
- } else if (pool_metadata_size < min_meta_size) {
|
||||
- if (*pool_metadata_extents)
|
||||
- log_warn("WARNING: Minimum required pool metadata size is %s "
|
||||
- "(needs extra %s).",
|
||||
- display_size(cmd, min_meta_size),
|
||||
- display_size(cmd, min_meta_size - pool_metadata_size));
|
||||
- pool_metadata_size = min_meta_size;
|
||||
- }
|
||||
-
|
||||
- if (!(*pool_metadata_extents =
|
||||
- extents_from_size(cmd, pool_metadata_size, extent_size)))
|
||||
+ if (!update_pool_metadata_min_max(cmd, extent_size,
|
||||
+ min_meta_size,
|
||||
+ (2 * DEFAULT_CACHE_POOL_MAX_METADATA_SIZE),
|
||||
+ &pool_metadata_size,
|
||||
+ metadata_lv,
|
||||
+ pool_metadata_extents))
|
||||
return_0;
|
||||
|
||||
- if ((uint64_t) *chunk_size > (uint64_t) pool_data_extents * extent_size) {
|
||||
- log_error("Size of %s data volume cannot be smaller than chunk size %s.",
|
||||
- segtype->name, display_size(cmd, *chunk_size));
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
log_verbose("Preferred pool metadata size %s.",
|
||||
display_size(cmd, (uint64_t)*pool_metadata_extents * extent_size));
|
||||
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index 0e57722..c0fa564 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -1319,6 +1319,7 @@ int update_cache_pool_params(struct cmd_context *cmd,
|
||||
unsigned attr,
|
||||
uint32_t pool_data_extents,
|
||||
uint32_t *pool_metadata_extents,
|
||||
+ struct logical_volume *metadata_lv,
|
||||
int *chunk_size_calc_method, uint32_t *chunk_size);
|
||||
int validate_lv_cache_chunk_size(struct logical_volume *pool_lv, uint32_t chunk_size);
|
||||
int validate_lv_cache_create_pool(const struct logical_volume *pool_lv);
|
||||
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
||||
index ce90279..416e8a7 100644
|
||||
--- a/tools/lvconvert.c
|
||||
+++ b/tools/lvconvert.c
|
||||
@@ -3189,6 +3189,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
pool_segtype, target_attr,
|
||||
lv->le_count,
|
||||
&meta_extents,
|
||||
+ metadata_lv,
|
||||
&chunk_calc,
|
||||
&chunk_size))
|
||||
goto_bad;
|
||||
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
|
||||
index 1ee9e14..1ce561f 100644
|
||||
--- a/tools/lvcreate.c
|
||||
+++ b/tools/lvcreate.c
|
||||
@@ -403,6 +403,7 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
lp->segtype, lp->target_attr,
|
||||
lp->extents,
|
||||
&lp->pool_metadata_extents,
|
||||
+ NULL,
|
||||
&lp->thin_chunk_size_calc_policy,
|
||||
&lp->chunk_size))
|
||||
return_0;
|
@ -0,0 +1,48 @@
|
||||
From b3719266bd5e3a9e6737d6bda60e543121ddf343 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Tue, 9 Feb 2021 09:47:08 -0600
|
||||
Subject: [PATCH] dev_get_primary_dev: fix invalid path check
|
||||
|
||||
Fix commit bee9f4efdd81 "filter-mpath: work with nvme devices"
|
||||
which removed setting the path for readlink.
|
||||
|
||||
(cherry picked from commit f74f94c2ddb1d33d75d325c959344a566a621fd5)
|
||||
|
||||
Conflicts:
|
||||
lib/device/dev-type.c
|
||||
---
|
||||
lib/device/dev-type.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
|
||||
index 379afa8..1342e97 100644
|
||||
--- a/lib/device/dev-type.c
|
||||
+++ b/lib/device/dev-type.c
|
||||
@@ -434,7 +434,7 @@ static int _has_sys_partition(struct device *dev)
|
||||
int minor = (int) MINOR(dev->dev);
|
||||
|
||||
/* check if dev is a partition */
|
||||
- if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d/partition",
|
||||
+ if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/partition",
|
||||
dm_sysfs_dir(), major, minor) < 0) {
|
||||
log_error("dm_snprintf partition failed");
|
||||
return 0;
|
||||
@@ -660,8 +660,13 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
* - basename ../../block/md0/md0 = md0
|
||||
* Parent's 'dev' sysfs attribute = /sys/block/md0/dev
|
||||
*/
|
||||
- if ((size = readlink(dirname(path), temp_path, sizeof(temp_path) - 1)) < 0) {
|
||||
- log_sys_error("readlink", path);
|
||||
+ if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d",
|
||||
+ dm_sysfs_dir(), major, minor) < 0) {
|
||||
+ log_warn("WARNING: %s: major:minor sysfs path is too long.", dev_name(dev));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if ((size = readlink(path, temp_path, sizeof(temp_path) - 1)) < 0) {
|
||||
+ log_warn("WARNING: Readlink of %s failed.", path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
255
SOURCES/lvm2-2_03_12-devs-remove-invalid-path-name-aliases.patch
Normal file
255
SOURCES/lvm2-2_03_12-devs-remove-invalid-path-name-aliases.patch
Normal file
@ -0,0 +1,255 @@
|
||||
lib/device/dev-cache.c | 161 ++++++++++++++++++++++++++++++++++++----------
|
||||
test/shell/dev-aliases.sh | 53 +++++++++++++++
|
||||
2 files changed, 179 insertions(+), 35 deletions(-)
|
||||
create mode 100644 test/shell/dev-aliases.sh
|
||||
|
||||
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
|
||||
index d5f18ff..8082efa 100644
|
||||
--- a/lib/device/dev-cache.c
|
||||
+++ b/lib/device/dev-cache.c
|
||||
@@ -1428,60 +1428,151 @@ struct device *dev_hash_get(const char *name)
|
||||
return (struct device *) dm_hash_lookup(_cache.names, name);
|
||||
}
|
||||
|
||||
+static void _remove_alias(struct device *dev, const char *name)
|
||||
+{
|
||||
+ struct dm_str_list *strl;
|
||||
+
|
||||
+ dm_list_iterate_items(strl, &dev->aliases) {
|
||||
+ if (!strcmp(strl->str, name)) {
|
||||
+ dm_list_del(&strl->list);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Check that paths for this dev still refer to the same dev_t. This is known
|
||||
+ * to drop invalid paths in the case where lvm deactivates an LV, which causes
|
||||
+ * that LV path to go away, but that LV path is not removed from dev-cache (it
|
||||
+ * probably should be). Later a new path to a different LV is added to
|
||||
+ * dev-cache, where the new LV has the same major:minor as the previously
|
||||
+ * deactivated LV. The new LV will find the existing struct dev, and that
|
||||
+ * struct dev will have dev->aliases entries that refer to the name of the old
|
||||
+ * deactivated LV. Those old paths are all invalid and are dropped here.
|
||||
+ */
|
||||
+
|
||||
+static void _verify_aliases(struct device *dev, const char *newname)
|
||||
+{
|
||||
+ struct dm_str_list *strl, *strl2;
|
||||
+ struct stat st;
|
||||
+
|
||||
+ dm_list_iterate_items_safe(strl, strl2, &dev->aliases) {
|
||||
+ /* newname was just stat'd and added by caller */
|
||||
+ if (newname && !strcmp(strl->str, newname))
|
||||
+ continue;
|
||||
+
|
||||
+ if (stat(strl->str, &st) || (st.st_rdev != dev->dev)) {
|
||||
+ log_debug("Drop invalid path %s for %d:%d (new path %s).",
|
||||
+ strl->str, (int)MAJOR(dev->dev), (int)MINOR(dev->dev), newname ?: "");
|
||||
+ dm_hash_remove(_cache.names, strl->str);
|
||||
+ dm_list_del(&strl->list);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct dev_filter *f)
|
||||
{
|
||||
- struct stat buf;
|
||||
- struct device *d = (struct device *) dm_hash_lookup(_cache.names, name);
|
||||
- int info_available = 0;
|
||||
- int ret = 1;
|
||||
+ struct device *dev = (struct device *) dm_hash_lookup(_cache.names, name);
|
||||
+ struct stat st;
|
||||
+ int ret;
|
||||
|
||||
- if (d && (d->flags & DEV_REGULAR))
|
||||