Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8a07f57ba478c16ca5d5e…
Commit: 8a07f57ba478c16ca5d5eacf778ee2708109aa65
Parent: 8b75bbe47d2a2961b0fb029ad7a01dc37ee6a8e5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 29 13:05:55 2023 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 29 13:10:42 2023 +0200
lvm_import_vdo: spelling fixes
---
scripts/lvm_import_vdo.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index 319bcb33d..b5e1a9e16 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -52,7 +52,7 @@ DM_DEV_DIR="${DM_DEV_DIR:-/dev}"
DM_UUID_PREFIX="${DM_UUID_PREFIX:-}"
DM_VG_NAME=
DM_LV_NAME=
-VDO_CONFIG=${VDO_CONFIG:-} # can be overriden with --vdo-config
+VDO_CONFIG=${VDO_CONFIG:-} # can be overridden with --vdo-config
VDOCONF=
test -n "$VDO_CONFIG" && VDOCONF="-f $VDO_CONFIG"
@@ -150,7 +150,7 @@ snapshot_create_() {
snapshot_merge_() {
local status
- local inital_status
+ local initial_status
initial_status=( $("$DMSETUP" status "$VDO_DM_SNAPSHOT_NAME") )
"$DMSETUP" reload "$VDO_DM_SNAPSHOT_NAME" --table "$(snapshot_target_line_ "$1" "$VDO_SNAPSHOT_LOOP" -merge)"
@@ -165,7 +165,7 @@ snapshot_merge_() {
#du -h "$TEMPDIR/$VDO_DM_SNAPSHOT_NAME"
# Loop for a while, till the snapshot is merged.
- # Should be nearly instantenious.
+ # Should be nearly instantaneous.
# FIXME: Recovery when something prevents merging is hard
for i in $(seq 1 20) ; do
status=( $("$DMSETUP" status "$VDO_DM_SNAPSHOT_NAME") )
@@ -231,7 +231,7 @@ get_largest_extent_size_() {
}
# detect LV on the given device
-# dereference device name if it is symbolic link
+# deference device name if it is symbolic link
detect_lv_() {
local DEVICE=$1
local SYSVOLUME
@@ -315,7 +315,7 @@ parse_yaml_() {
# Currently this enforces a user to reduce the VG extent size to the smaller size (up to 4KiB).
#
# TODO: We may eventually relax this condition just like we are doing rounding for convert_non_lv_()
-# Let's if there would be any singly user requiring this feauture.
+# Let's if there would be any singly user requiring this feature.
# It may allow to better use larger VDO volume size (in TiB ranges).
#
convert_lv_() {
@@ -351,7 +351,7 @@ convert_lv_() {
# Convert VDO volume on a device to VG with VDOPool LV
#
# Convert device with the use of snapshot on top of original VDO volume (can be optionally disabled)
-# Once the whole conversion is finished, snapshot is merged (During the short periof time of merging
+# Once the whole conversion is finished, snapshot is merged (During the short period time of merging
# user must ensure there will be no power-off!)
#
# For best use the latest version of vdoprepareforlvm tool is required.
@@ -373,12 +373,12 @@ convert_non_lv_() {
output=$(dry "$VDO" convert $VDOCONF $VERB --force --name "$VDONAME")
if [ "$ABORT_AFTER_VDO_CONVERT" != "0" ] ; then
- verbose "Aborting VDO coversion after moving VDO, volume is useless!"
+ verbose "Aborting VDO conversion after moving VDO header, volume is useless!"
cleanup 0
fi
# Parse result from VDO preparation/conversion tool
- # New version of the tool provides output with alingment and offset
+ # New version of the tool provides output with alignment and offset
local vdo_length=0
local vdo_aligned=0
local vdo_offset=0
@@ -432,7 +432,7 @@ convert_non_lv_() {
verbose "Converting to VDO pool."
dry "$LVM" lvconvert $YES $VERB $FORCE --devices "$devices" --config "$VDO_ALLOCATION_PARAMS" -Zn -V "${vdo_logicalSizeRounded}k" -n "$LVNAME" --type vdo-pool "$VGNAME/${LVNAME}_vpool"
if [ "$vdo_logicalSizeRounded" -lt "$vdo_logicalSize" ] ; then
- # need to extend virtal size to be covering all the converted area
+ # need to extend virtual size to be covering all the converted area
# let lvm2 to round to the proper virtual size of VDO LV
dry "$LVM" lvextend $YES $VERB --fs ignore --devices "$devices" -L "$vdo_logicalSize"k "$VGNAME/$LVNAME"
fi
@@ -512,7 +512,7 @@ convert2lvm_() {
"$MKDIR" -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR."
- # TODO: might use directly /etc/vdoconf.yml (avoding need of 'vdo' manager)
+ # TODO: might use directly /etc/vdoconf.yml (avoiding need of 'vdo' manager)
verbose "Getting YAML VDO configuration."
"$VDO" printConfigFile $VDOCONF >"$TEMPDIR/vdoconf.yml"
test -s "$TEMPDIR/vdoconf.yml" || error "Cannot work without VDO configuration"
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9756824f6447fb8c60967…
Commit: 9756824f6447fb8c6096760e802d4f616929f710
Parent: 46fe47b8e0ad8069bb3736d2aa3e78befdccb38d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 23 11:39:46 2023 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 23 18:08:10 2023 +0200
make: generate
---
conf/example.conf.in | 28 +++++++++++++++++++++++++++-
man/lvcreate.8_pregen | 6 ++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 0b9b06a17..35837c013 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1201,7 +1201,7 @@ global {
# Configuration option global/thin_check_executable.
# The full path to the thin_check command.
- # LVM uses this command to check that a thin metadata device is in a
+ # LVM uses this command to check that a thin pool metadata device is in a
# usable state. When a thin pool is activated and after it is
# deactivated, this command is run. Activation will only proceed if
# the command has an exit status of 0. Set to "" to skip this check.
@@ -1225,6 +1225,14 @@ global {
# This configuration option has an automatic default value.
# thin_repair_executable = "@THIN_REPAIR_CMD@"
+ # Configuration option global/thin_restore_executable.
+ # The full path to the thin_restore command.
+ # LVM uses this command to restore generated data for a thin pool metadata device.
+ # Also see thin_restore_options.
+ # (See package device-mapper-persistent-data or thin-provisioning-tools)
+ # This configuration option has an automatic default value.
+ # thin_restore_executable = "@THIN_RESTORE_CMD@"
+
# Configuration option global/thin_check_options.
# List of options passed to the thin_check command.
# With thin_check version 2.1 or newer you can add the option
@@ -1239,6 +1247,11 @@ global {
# This configuration option has an automatic default value.
# thin_repair_options = [ "" ]
+ # Configuration option global/thin_restore_options.
+ # List of options passed to the thin_restore command.
+ # This configuration option has an automatic default value.
+ # thin_restore_options = [ "" ]
+
# Configuration option global/thin_disabled_features.
# Features to not use in the thin driver.
# This can be helpful for testing, or to avoid using a feature that is
@@ -1287,6 +1300,14 @@ global {
# This configuration option has an automatic default value.
# cache_repair_executable = "@CACHE_REPAIR_CMD@"
+ # Configuration option global/cache_restore_executable.
+ # The full path to the cache_restore command.
+ # LVM uses this command to restore generated data for a cache metadata device.
+ # Also see cache_restore_options.
+ # (See package device-mapper-persistent-data or thin-provisioning-tools)
+ # This configuration option has an automatic default value.
+ # cache_restore_executable = "@CACHE_RESTORE_CMD@"
+
# Configuration option global/cache_check_options.
# List of options passed to the cache_check command.
# With cache_check version 5.0 or newer you should include the option
@@ -1299,6 +1320,11 @@ global {
# This configuration option has an automatic default value.
# cache_repair_options = [ "" ]
+ # Configuration option global/cache_restore_options.
+ # List of options passed to the cache_restore command.
+ # This configuration option has an automatic default value.
+ # cache_restore_options = [ "" ]
+
# Configuration option global/vdo_format_executable.
# The full path to the vdoformat command.
# LVM uses this command to initial data volume for VDO type logical volume
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index 528a9db9c..27a93d890 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -491,6 +491,8 @@ Create a thin LV that is a snapshot of an existing thin LV.
[ \fB--type thin\fP ] (implied)
.br
.br
+[ \fB-T\fP|\fB--thin\fP ]
+.br
[ COMMON_OPTIONS ]
.ad b
.RE
@@ -1917,6 +1919,8 @@ Create a thin LV that is a snapshot of an existing thin LV.
.ad l
[ \fB-T\fP|\fB--thin\fP ]
.br
+[ \fB-s\fP|\fB--snapshot\fP ]
+.br
[ COMMON_OPTIONS ]
.ad b
.RE
@@ -1937,6 +1941,8 @@ Create a thin LV that is a snapshot of an existing thin LV.
[ \fB--type thin\fP ] (implied)
.br
.br
+[ \fB-s\fP|\fB--snapshot\fP ]
+.br
[ COMMON_OPTIONS ]
.ad b
.RE
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fec3087eefc752036a40d…
Commit: fec3087eefc752036a40d854c373132d25ffd30f
Parent: 8d09124c6204d49f6bda833229c96e8a76665127
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 23 14:39:44 2023 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 23 18:06:22 2023 +0200
thin: add cfg support for thin_restore and cache_restore
Add configurable paths for thin_restore and cache_restore.
---
lib/config/config_settings.h | 20 +++++++++++++++++++-
lib/config/defaults.h | 4 ++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 2d6d957af..51e11857e 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1177,7 +1177,7 @@ cfg(global_lvmlockctl_kill_command_CFG, "lvmlockctl_kill_command", global_CFG_SE
cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), "@THIN_CHECK_CMD@", 0, NULL,
"The full path to the thin_check command.\n"
- "LVM uses this command to check that a thin metadata device is in a\n"
+ "LVM uses this command to check that a thin pool metadata device is in a\n"
"usable state. When a thin pool is activated and after it is\n"
"deactivated, this command is run. Activation will only proceed if\n"
"the command has an exit status of 0. Set to \"\" to skip this check.\n"
@@ -1195,6 +1195,12 @@ cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECT
"an unusable state. Also see thin_repair_options.\n"
"(See package device-mapper-persistent-data or thin-provisioning-tools)\n")
+cfg(global_thin_restore_executable_CFG, "thin_restore_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, THIN_RESTORE_CMD, vsn(2, 3, 22), "@THIN_RESTORE_CMD@", 0, NULL,
+ "The full path to the thin_restore command.\n"
+ "LVM uses this command to restore generated data for a thin pool metadata device.\n"
+ "Also see thin_restore_options.\n"
+ "(See package device-mapper-persistent-data or thin-provisioning-tools)\n")
+
cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_THIN_CHECK_OPTIONS_CONFIG, vsn(2, 2, 96), NULL, 0, NULL,
"List of options passed to the thin_check command.\n"
"With thin_check version 2.1 or newer you can add the option\n"
@@ -1205,6 +1211,9 @@ cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTIO
cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_THIN_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 100), NULL, 0, NULL,
"List of options passed to the thin_repair command.\n")
+cfg_array(global_thin_restore_options_CFG, "thin_restore_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_THIN_RESTORE_OPTIONS_CONFIG, vsn(2, 3, 22), NULL, 0, NULL,
+ "List of options passed to the thin_restore command.\n")
+
cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL, 0, NULL,
"Features to not use in the thin driver.\n"
"This can be helpful for testing, or to avoid using a feature that is\n"
@@ -1245,6 +1254,12 @@ cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SE
"an unusable state. Also see cache_repair_options.\n"
"(See package device-mapper-persistent-data or thin-provisioning-tools)\n")
+cfg(global_cache_restore_executable_CFG, "cache_restore_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, CACHE_RESTORE_CMD, vsn(2, 3, 22), "@CACHE_RESTORE_CMD@", 0, NULL,
+ "The full path to the cache_restore command.\n"
+ "LVM uses this command to restore generated data for a cache metadata device.\n"
+ "Also see cache_restore_options.\n"
+ "(See package device-mapper-persistent-data or thin-provisioning-tools)\n")
+
cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_CHECK_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
"List of options passed to the cache_check command.\n"
"With cache_check version 5.0 or newer you should include the option\n"
@@ -1253,6 +1268,9 @@ cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECT
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
"List of options passed to the cache_repair command.\n")
+cfg_array(global_cache_restore_options_CFG, "cache_restore_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_RESTORE_OPTIONS_CONFIG, vsn(2, 3, 22), NULL, 0, NULL,
+ "List of options passed to the cache_restore command.\n")
+
cfg(global_vdo_format_executable_CFG, "vdo_format_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, VDO_FORMAT_CMD, VDO_1ST_VSN, "@VDO_FORMAT_CMD@", 0, NULL,
"The full path to the vdoformat command.\n"
"LVM uses this command to initial data volume for VDO type logical volume\n")
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 571054dc4..dd40ff3bf 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -117,6 +117,8 @@
#define DEFAULT_THIN_REPAIR_OPTION1 ""
#define DEFAULT_THIN_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_THIN_REPAIR_OPTION1
+#define DEFAULT_THIN_RESTORE_OPTION1 ""
+#define DEFAULT_THIN_RESTORE_OPTIONS_CONFIG "#S" DEFAULT_THIN_RESTORE_OPTION1
#define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_THIN_POOL_CROP_METADATA 0
#define DEFAULT_THIN_POOL_MAX_METADATA_SIZE_V1_KB (UINT64_C(255) * ((1 << 14) - 64) * 4) /* KB */ /* 0x3f8040 blocks */
@@ -145,6 +147,8 @@
#define DEFAULT_CACHE_REPAIR_OPTION1 ""
#define DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_CACHE_REPAIR_OPTION1
+#define DEFAULT_CACHE_RESTORE_OPTION1 ""
+#define DEFAULT_CACHE_RESTORE_OPTIONS_CONFIG "#S" DEFAULT_CACHE_RESTORE_OPTION1
#define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
#define DEFAULT_CACHE_POOL_MAX_CHUNKS 1000000
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=657dde6208ddc8172b7d0…
Commit: 657dde6208ddc8172b7d0e1466751046c8ddaeaa
Parent: ea6b5b694bf0886052b048b2e04b941ec65d90f9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 23 18:01:32 2023 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 23 18:05:03 2023 +0200
lvm_import_vdo: correct the converted virtual size
Ensure the volume after conversion has the properly aligned size to the
volume group extent size. This would be visible when using virtual size,
that cannot be divided by extent size.
Before the user had to manually adjust the size after conversion to get
access to all data stored on VDO volume.
---
scripts/lvm_import_vdo.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index bae4b52d1..13197c6fb 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -357,6 +357,7 @@ convert_lv_() {
# For best use the latest version of vdoprepareforlvm tool is required.
convert_non_lv_() {
local vdo_logicalSize=$1
+ local vdo_logicalSizeRounded
local extent_size
local output
local pvfree
@@ -417,7 +418,7 @@ convert_non_lv_() {
# Round virtual size to the LOWER size expressed in extent units.
# lvm is parsing VDO metadata and can read real full size and use it instead of this smaller value.
# To precisely byte-synchronize the size of VDO LV, user can lvresize such VDO LV later.
- vdo_logicalSize=$(( ( vdo_logicalSize / extent_size ) * extent_size ))
+ vdo_logicalSizeRounded=$(( ( vdo_logicalSize / extent_size ) * extent_size ))
verbose "Creating VG \"${NAME%/*}\" with extent size $extent_size KiB."
dry "$LVM" vgcreate $YES $VERB --devices "$devices" -s "${extent_size}k" "$VGNAME" "$devices" || {
@@ -428,7 +429,12 @@ convert_non_lv_() {
dry "$LVM" lvcreate -Zn -Wn -an $YES $VERB --devices "$devices" -l100%VG -n "${LVNAME}_vpool" "$VGNAME" "$devices"
verbose "Converting to VDO pool."
- dry "$LVM" lvconvert $YES $VERB $FORCE --devices "$devices" --config "$VDO_ALLOCATION_PARAMS" -Zn -V "${vdo_logicalSize}k" -n "$LVNAME" --type vdo-pool "$VGNAME/${LVNAME}_vpool"
+ dry "$LVM" lvconvert $YES $VERB $FORCE --devices "$devices" --config "$VDO_ALLOCATION_PARAMS" -Zn -V "${vdo_logicalSizeRounded}k" -n "$LVNAME" --type vdo-pool "$VGNAME/${LVNAME}_vpool"
+ if [ "$vdo_logicalSizeRounded" -lt "$vdo_logicalSize" ] ; then
+ # need to extend virtal size to be covering all the converted area
+ # let lvm2 to round to the proper virtual size of VDO LV
+ dry "$LVM" lvextend $YES $VERB --fs ignore --devices "$devices" -L "$vdo_logicalSize"k "$VGNAME/$LVNAME"
+ fi
dry "$LVM" vgchange -an $VERB $FORCE --devices "$devices" "$VGNAME"
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ea6b5b694bf0886052b04…
Commit: ea6b5b694bf0886052b048b2e04b941ec65d90f9
Parent: 1dbb86f8c7cd95cb484a5b3c465b847f35d2b760
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 20 15:41:24 2023 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 20 15:47:01 2023 -0500
lvcreate: allow thin snapshot syntax that broke
The command "lvcreate --type thin --snapshot ..." to create a thin
snapshot would fail.
commit d651b340e68d97ada25e558eb50aa40062bba936 removed the optional
"--type thin" from the command definition "lvcreate --snapshot LV_thin",
and added --type thin as AUTOTYPE. This was correct and should not have
changed anything if all the command defs were correct, but it broke
the "lvcreate --type thin --snapshot" case. It reveals a problem in a
different command definintion: "lvcreate --type thin LV_thin" that was
missing --snapshot in its OO list.
---
test/shell/lvcreate-thin-snap.sh | 20 ++++++++++++++++++++
tools/command-lines.in | 6 +++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvcreate-thin-snap.sh b/test/shell/lvcreate-thin-snap.sh
index 6e6410cc1..8f1987986 100644
--- a/test/shell/lvcreate-thin-snap.sh
+++ b/test/shell/lvcreate-thin-snap.sh
@@ -74,5 +74,25 @@ lvcreate -L10M --zero n -T $vg/pool -V10M --name $lv1
mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
lvcreate -K -s $vg/$lv1 --name snap
fsck -n "$DM_DEV_DIR/$vg/snap"
+vgchange -an $vg
+lvremove -y $vg
+
+# One thin pool and one thin LV
+lvcreate --type thin-pool -L 10M -n tp $vg
+lvcreate --type thin -n thin1 -V 20M --thinpool tp $vg
+# Different syntaxes for creating a thin snapshot
+lvcreate --type thin -n snap1 $vg/thin1
+lvcreate --type thin --snapshot -n snap2 $vg/thin1
+lvcreate --type thin --thin -n snap3 $vg/thin1
+lvcreate --type thin --snapshot --thin -n snap4 $vg/thin1
+lvcreate --snapshot -n snap5 $vg/thin1
+lvcreate --thin -n snap6 $vg/thin1
+# The command defs allow --snapshot --thin, but the internal
+# lvcreate option checks disallow it. It doesn't seem to make
+# sense to disallow this from a syntax point of view, but it's
+# possible that the lvcreate implementation would do the wrong
+# thing (that should probably be fixed.)
+not lvcreate --thin --snapshot -n snap7 $vg/thin1
+vgchange -an $vg
vgremove -ff $vg
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 3d311288f..bb6e09933 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1088,7 +1088,7 @@ AUTOTYPE: thin
---
lvcreate --type thin LV_thin
-OO: --thin, OO_LVCREATE
+OO: --thin, --snapshot, OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot
DESC: Create a thin LV that is a snapshot of an existing thin LV.
@@ -1096,7 +1096,7 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --thin LV_thin
-OO: OO_LVCREATE
+OO: --snapshot, OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot
DESC: Create a thin LV that is a snapshot of an existing thin LV.
@@ -1105,7 +1105,7 @@ AUTOTYPE: thin
# alternate form of lvcreate --type thin
lvcreate --snapshot LV_thin
-OO: OO_LVCREATE
+OO: --thin, OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot
DESC: Create a thin LV that is a snapshot of an existing thin LV.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7c3eca833ff7878d6d321…
Commit: 7c3eca833ff7878d6d32198ed76380c91fdc15fc
Parent: 228a8e8c1fd8e82a2e31a6060614dc3dd2f8bc51
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jun 16 12:06:40 2023 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Jun 16 12:11:51 2023 -0500
lvresize: fix multiple mounts
which was mistaken as a mounted LV that had been renamed.
---
lib/device/filesystem.c | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c
index 2572bca69..39e563117 100644
--- a/lib/device/filesystem.c
+++ b/lib/device/filesystem.c
@@ -243,8 +243,6 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
FILE *fme = NULL;
struct mntent *me;
int renamed = 0;
- int found_dir = 0;
- int found_dev = 0;
int dev_match, dir_match;
if (stat(lv_path, &st_lv) < 0) {
@@ -281,6 +279,9 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
}
endmntent(fme);
+ if (mtab_mntpath[0])
+ log_debug("%s mtab mntpath %s", display_lvname(lv), mtab_mntpath);
+
/*
* In mtab dir path, replace each ascii space character with the
* four characters \040 which is how /proc/mounts represents spaces.
@@ -319,15 +320,31 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
if (strcmp(fstype, proc_fstype))
continue;
+ /*
+ * When an LV is mounted on two dirs, it appears in /proc/mounts twice as
+ * /dev/mapper/vg-lvol0 on /foo type xfs ...
+ * /dev/mapper/vg-lvol0 on /bar type xfs ...
+ * All entries match dm_devpath, one entry matches mntpath,
+ * and other entries don't match mntpath.
+ *
+ * When an LV is mounted on one dir, and is renamed from lvol0 to lvol1,
+ * it appears in /proc/mounts once as
+ * /dev/mapper/vg-lvol0 on /foo type xfs ...
+ */
+
dir_match = !strcmp(mtab_mntpath, proc_mntpath);
dev_match = !strcmp(dm_devpath, proc_devpath);
- if (dir_match)
- found_dir++;
- if (dev_match)
- found_dev++;
+ if (!dir_match && !dev_match)
+ continue;
+
+ if (dev_match && !dir_match) {
+ log_debug("LV %s mounted at %s also mounted at %s.",
+ dm_devpath, mtab_mntpath, proc_mntpath);
+ continue;
+ }
- if (dir_match != dev_match) {
+ if (!dev_match && dir_match) {
log_error("LV %s mounted at %s may have been renamed (from %s).",
dm_devpath, proc_mntpath, proc_devpath);
renamed = 1;
@@ -337,26 +354,10 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
if (fclose(fp))
stack;
- /*
- * Don't try resizing if:
- * - different device names apppear for the mount point
- * (LVs probably renamed while mounted), or
- * - the mount point for the LV appears multiple times, or
- * - the LV device is listed for multiple mounts.
- */
if (renamed) {
log_error("File system resizing not supported: fs utilities do not support renamed devices.");
return 1;
}
- /* These two are likely detected as renamed, but include checks in case. */
- if (found_dir > 1) {
- log_error("File system resizing not supported: %s appears more than once in /proc/mounts.", mtab_mntpath);
- return 1;
- }
- if (found_dev > 1) {
- log_error("File system resizing not supported: %s appears more than once in /proc/mounts.", dm_devpath);
- return 1;
- }
return 0;
}