Sync from SUSE:ALP:Source:Standard:1.0 lvm2 revision c1fe59233555732fb21e7002bbe64eab

This commit is contained in:
Adrian Schröter 2023-11-24 16:10:55 +01:00
commit 139c21e721
45 changed files with 9361 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,96 @@
From ff0a8d7b6734c745e52652fc5e7dd3a0f2efb518 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 8 Aug 2023 16:57:22 -0500
Subject: [PATCH 01/24] lvconvert swapmetadata: fix lvmlockd locking
The lockd lock needs to be freed for the LV that is becoming
the new metadata LV, and a new lockd lock needs to be created
for the old metadata LV that is becoming an independent LV.
Fixes b3e45219c2f4
---
tools/lvconvert.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0004422f2..49047abb0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2818,6 +2818,9 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
struct lv_type *lvtype;
char meta_name[NAME_LEN];
const char *swap_name;
+ char *lockd_meta_args = NULL;
+ char *lockd_meta_name = NULL;
+ struct id lockd_meta_id;
uint32_t chunk_size;
int is_thinpool;
int is_cachepool;
@@ -2872,6 +2875,12 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
if (!lockd_lv(cmd, lv, "ex", 0))
return 0;
+ /* If new metadata LV is inactive here, ensure it's not active elsewhere */
+ if (!lockd_lv(cmd, metadata_lv, "ex", 0)) {
+ log_error("New pool metadata LV %s cannot be locked.", display_lvname(metadata_lv));
+ return 0;
+ }
+
if (!deactivate_lv(cmd, metadata_lv)) {
log_error("Aborting. Failed to deactivate %s.",
display_lvname(metadata_lv));
@@ -2883,8 +2892,22 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
return 0;
}
- metadata_lv->lock_args = NULL;
-
+ /*
+ * metadata_lv is currently an independent LV with its own lockd lock allocated.
+ * A pool metadata LV does not have its own lockd lock (only the pool LV does.)
+ * So, when metadata_lv is added to the thin pool, it's lock needs to be freed.
+ * Save info about the metadata_lv here that will be used to free the lock.
+ * The current pool metadata LV does not currently have its own lockd lock
+ * allocated, and once it becomes an independent LV it will need its own lock.
+ * (see setting prev_metadata_lv->lock_args below.)
+ */
+ if (vg_is_shared(vg) && metadata_lv->lock_args) {
+ lockd_meta_args = dm_pool_strdup(cmd->mem, metadata_lv->lock_args);
+ lockd_meta_name = dm_pool_strdup(cmd->mem, metadata_lv->name);
+ memcpy(&lockd_meta_id, &metadata_lv->lvid.id[1], sizeof(struct id));
+ /* Without lock_args, a lock will no longer be acquired for this LV. */
+ metadata_lv->lock_args = NULL;
+ }
seg = first_seg(lv);
@@ -2950,9 +2973,27 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
if (!attach_pool_metadata_lv(seg, metadata_lv))
return_0;
+ /*
+ * The previous metadata LV will now be an independent LV so it now
+ * requires a lockd lock. We could call lockd_init_lv_args() directly
+ * here, but reuse the existing code in vg_write() to be consistent
+ * with the way lvcreate allocates locks.
+ */
+ if (is_lockd_type(vg->lock_type)) {
+ if (!strcmp(vg->lock_type, "sanlock"))
+ prev_metadata_lv->lock_args = "pending";
+ else if (!strcmp(vg->lock_type, "dlm"))
+ prev_metadata_lv->lock_args = "dlm";
+ else if (!strcmp(vg->lock_type, "idm"))
+ prev_metadata_lv->lock_args = "idm";
+ }
+
if (!vg_write(vg) || !vg_commit(vg))
return_0;
+ if (lockd_meta_name)
+ lockd_free_lv(cmd, vg, lockd_meta_name, &lockd_meta_id, lockd_meta_args);
+
return 1;
}
--
2.35.3

View File

@ -0,0 +1,105 @@
From b982d9ac56a709f1ffcdfb052029556bd8d56635 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 9 Aug 2023 13:02:13 +0200
Subject: [PATCH 02/24] lvconvert: fix ret values fro integrity remove
Fix return value from _lvconvert_integrity_remove()
as it is expected to match _add() and be 0/1.
Also add some missing log_error() messages.
---
tools/lvconvert.c | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 49047abb0..c25c87db4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -6410,24 +6410,26 @@ int lvconvert_to_cache_with_cachevol_cmd(struct cmd_context *cmd, int argc, char
static int _lvconvert_integrity_remove(struct cmd_context *cmd, struct logical_volume *lv)
{
- int ret = 0;
-
- if (!lv_is_integrity(lv) && !lv_is_raid(lv)) {
+ if (!lv_is_integrity(lv)) {
log_error("LV does not have integrity.");
- return ECMD_FAILED;
+ return 0;
+ }
+
+ if (!lv_is_raid(lv)) {
+ log_error("Cannot remove integrity from non raid type LV %s.",
+ display_lvname(lv));
+ return 0;
}
/* ensure it's not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
- return_ECMD_FAILED;
+ return_0;
- if (lv_is_raid(lv))
- ret = lv_remove_integrity_from_raid(lv);
- if (!ret)
- return_ECMD_FAILED;
+ if (!lv_remove_integrity_from_raid(lv))
+ return_0;
log_print_unless_silent("Logical volume %s has removed integrity.", display_lvname(lv));
- return ECMD_PROCESSED;
+ return 1;
}
static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volume *lv,
@@ -6435,7 +6437,6 @@ static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volu
{
struct volume_group *vg = lv->vg;
struct dm_list *use_pvh;
- int ret = 0;
/* ensure it's not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
@@ -6453,9 +6454,13 @@ static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volu
return 0;
}
- if (lv_is_raid(lv))
- ret = lv_add_integrity_to_raid(lv, set, use_pvh, NULL);
- if (!ret)
+ if (!lv_is_raid(lv)) {
+ log_error("Cannot add integrity to non raid type LV %s.",
+ display_lvname(lv));
+ return 0;
+ }
+
+ if (!lv_add_integrity_to_raid(lv, set, use_pvh, NULL))
return_0;
log_print_unless_silent("Logical volume %s has added integrity.", display_lvname(lv));
@@ -6466,10 +6471,8 @@ static int _lvconvert_integrity_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
- struct integrity_settings settings;
- int ret = 0;
-
- memset(&settings, 0, sizeof(settings));
+ struct integrity_settings settings = { 0 };
+ int ret;
if (!integrity_mode_set(arg_str_value(cmd, raidintegritymode_ARG, NULL), &settings))
return_ECMD_FAILED;
@@ -6483,7 +6486,8 @@ static int _lvconvert_integrity_single(struct cmd_context *cmd,
ret = _lvconvert_integrity_remove(cmd, lv);
if (!ret)
- return ECMD_FAILED;
+ return_ECMD_FAILED;
+
return ECMD_PROCESSED;
}
--
2.35.3

View File

@ -0,0 +1,29 @@
From 5829b341ea6826d70772af941859359475976b40 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 15 Aug 2023 23:06:29 +0200
Subject: [PATCH 03/24] lvconvert: fix regresion from integrity check
Testing code sliped into commit and cause regression in testing for
a raid with integrity.
---
tools/lvconvert.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c25c87db4..6d2abb2e7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -6410,8 +6410,8 @@ int lvconvert_to_cache_with_cachevol_cmd(struct cmd_context *cmd, int argc, char
static int _lvconvert_integrity_remove(struct cmd_context *cmd, struct logical_volume *lv)
{
- if (!lv_is_integrity(lv)) {
- log_error("LV does not have integrity.");
+ if (!lv_is_integrity(lv) && !lv_is_raid(lv)) {
+ log_error("LV %s does not have integrity.", display_lvname(lv));
return 0;
}
--
2.35.3

View File

@ -0,0 +1,103 @@
From 2cd58bb4c9ef063c5283daf0e618c2ed0c77eb89 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 16 Aug 2023 15:12:36 +0200
Subject: [PATCH 04/24] gcc: cleanup warnings
Correcting signess comparation.
Also use standalone /* fall through */ comment as that's
the only one supported by gcc to quiet warning.
---
daemons/cmirrord/local.c | 2 +-
lib/metadata/metadata.c | 2 +-
libdm/datastruct/bitset.c | 3 ++-
tools/lvconvert.c | 2 +-
tools/lvmcmdline.c | 6 +++---
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/daemons/cmirrord/local.c b/daemons/cmirrord/local.c
index d0a25e105..27396ad98 100644
--- a/daemons/cmirrord/local.c
+++ b/daemons/cmirrord/local.c
@@ -266,7 +266,7 @@ static int do_local_work(void *data __attribute__((unused)))
RQ_TYPE(u_rq->request_type));
break;
}
- /* ELSE, fall through */
+ /* ELSE */ /* fall through */
case DM_ULOG_IS_CLEAN:
case DM_ULOG_FLUSH:
case DM_ULOG_MARK_REGION:
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 819c6fd9a..f56b5002d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1133,7 +1133,7 @@ uint32_t extents_from_percent_size(struct volume_group *vg, const struct dm_list
}
break;
}
- /* fall through to use all PVs in VG like %FREE */
+ /* fall through */ /* to use all PVs in VG like %FREE */
case PERCENT_FREE:
if (!(extents = vg->free_count)) {
log_error("No free extents in Volume group %s.", vg->name);
diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c
index 220ea2f26..25407f521 100644
--- a/libdm/datastruct/bitset.c
+++ b/libdm/datastruct/bitset.c
@@ -149,7 +149,8 @@ dm_bitset_t dm_bitset_parse_list(const char *str, struct dm_pool *mem,
size_t min_num_bits)
{
unsigned a, b;
- int c, old_c, totaldigits, ndigits, nmaskbits;
+ int c, old_c, totaldigits, ndigits;
+ size_t nmaskbits;
int at_start, in_range;
dm_bitset_t mask = NULL;
const char *start = str;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6d2abb2e7..d98d34ce0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1352,7 +1352,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
else
image_count = lp->mirrors + 1;
- images_reduced = (image_count < lv_raid_image_count(lv));
+ images_reduced = (image_count < (int) lv_raid_image_count(lv));
if (image_count < 1) {
log_error("Unable to %s images by specified amount.",
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 57f9f2651..87f829f19 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1456,7 +1456,7 @@ static int _command_optional_opt_matches(struct cmd_context *cmd, int ci, int oo
}
if (val_bit_is_set(commands[ci].optional_opt_args[oo].def.val_bits, constnum_VAL)) {
- if (commands[ci].optional_opt_args[oo].def.num == arg_int_value(cmd, opt_enum, 0))
+ if (commands[ci].optional_opt_args[oo].def.num == arg_uint64_value(cmd, opt_enum, 0))
return 1;
return 0;
}
@@ -1475,7 +1475,7 @@ static int _command_ignore_opt_matches(struct cmd_context *cmd, int ci, int io)
}
if (val_bit_is_set(commands[ci].ignore_opt_args[io].def.val_bits, constnum_VAL)) {
- if (commands[ci].ignore_opt_args[io].def.num == arg_int_value(cmd, opt_enum, 0))
+ if (commands[ci].ignore_opt_args[io].def.num == arg_uint64_value(cmd, opt_enum, 0))
return 1;
return 0;
}
@@ -1519,7 +1519,7 @@ check_val:
}
if (val_bit_is_set(commands[ci].required_opt_args[ro].def.val_bits, constnum_VAL)) {
- if (commands[ci].required_opt_args[ro].def.num == arg_int_value(cmd, opt_enum, 0))
+ if (commands[ci].required_opt_args[ro].def.num == arg_uint64_value(cmd, opt_enum, 0))
return 1;
return 0;
}
--
2.35.3

View File

@ -0,0 +1,379 @@
From 76a4599500aef12442c8c24be8aacc89f6a27e68 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 15 Aug 2023 09:53:39 -0500
Subject: [PATCH 05/24] lvmlockd: fix thick to thin lv conversion
---
lib/locking/lvmlockd.c | 2 +
lib/metadata/metadata.c | 2 +
tools/lvconvert.c | 231 ++++++++++++++++++++++++----------------
3 files changed, 143 insertions(+), 92 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index a8db25d7a..d44b7333a 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2908,6 +2908,8 @@ static int _free_lv(struct cmd_context *cmd, struct volume_group *vg,
if (!id_write_format(lv_id, lv_uuid, sizeof(lv_uuid)))
return_0;
+ log_debug("lockd free LV %s/%s %s lock_args %s", vg->name, lv_name, lv_uuid, lock_args ?: "none");
+
reply = _lockd_send("free_lv",
"pid = " FMTd64, (int64_t) getpid(),
"vg_name = %s", vg->name,
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index f56b5002d..f8a4f6279 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2924,6 +2924,8 @@ int vg_write(struct volume_group *vg)
vgid[ID_LEN] = 0;
memcpy(vgid, &vg->id.uuid, ID_LEN);
+ log_debug("Writing metadata for VG %s.", vg->name);
+
if (vg_is_shared(vg)) {
dm_list_iterate_items(lvl, &vg->lvs) {
if (lvl->lv->lock_args && !strcmp(lvl->lv->lock_args, "pending")) {
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d98d34ce0..7c9540712 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3007,9 +3007,22 @@ static struct logical_volume *_lvconvert_insert_thin_layer(struct logical_volume
if (!(thin_segtype = get_segtype_from_string(vg->cmd, SEG_TYPE_NAME_THIN)))
return_NULL;
+ /*
+ * input lv foo (often linear)
+ * creates new lv foo_tpoolN (no seg)
+ * segment from foo is moved to foo_tpoolN
+ * new linear segment is created for foo that maps to foo_tpoolN
+ * returns foo_tpoolN
+ *
+ * In spite of the "pool" variable naming, pool_lv foo_tpoolN is *not*
+ * yet a pool type, but rather is whatever type the input lv was.
+ */
if (!(pool_lv = insert_layer_for_lv(vg->cmd, lv, 0, "_tpool%d")))
return_NULL;
+ /*
+ * change lv foo to a thin LV using foo_tpoolN
+ */
lv->status |= THIN_VOLUME | VIRTUAL;
lv_set_visible(pool_lv);
@@ -3079,9 +3092,12 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
const char *pool_metadata_name; /* user-specified lv name */
char converted_names[3*NAME_LEN]; /* preserve names of converted lv */
struct segment_type *pool_segtype; /* thinpool or cachepool */
+ const char *str_seg_type = to_cachepool ? SEG_TYPE_NAME_CACHE_POOL : SEG_TYPE_NAME_THIN_POOL;
struct lv_segment *seg;
unsigned int target_attr = ~0;
unsigned int activate_pool;
+ unsigned int lock_active_pool;
+ unsigned int lock_active_pool_done = 0;
unsigned int zero_metadata;
uint64_t meta_size;
uint32_t meta_extents;
@@ -3096,16 +3112,18 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
thin_discards_t discards;
thin_zero_t zero_new_blocks;
int error_when_full;
- int r = 0;
+ int end_error = 0;
+ int is_active;
/* for handling lvmlockd cases */
char *lockd_data_args = NULL;
char *lockd_meta_args = NULL;
char *lockd_data_name = NULL;
char *lockd_meta_name = NULL;
+ uint32_t lockd_data_flags = 0;
+ uint32_t lockd_meta_flags = 0;
struct id lockd_data_id;
struct id lockd_meta_id;
- const char *str_seg_type = to_cachepool ? SEG_TYPE_NAME_CACHE_POOL : SEG_TYPE_NAME_THIN_POOL;
if (!_raid_split_image_conversion(lv))
return_0;
@@ -3124,8 +3142,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
- /* Allow to have only thinpool active and restore it's active state. */
- activate_pool = to_thinpool && lv_is_active(lv);
+ is_active = lv_is_active(lv);
+
+ activate_pool = to_thinpool && is_active;
+ lock_active_pool = (to_thinpool || to_thin) && is_active;
/* Wipe metadata_lv by default, but allow skipping this for cache pools. */
zero_metadata = (to_cachepool) ? arg_int_value(cmd, zero_ARG, 1) : 1;
@@ -3356,20 +3376,11 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
}
}
- /*
- * When the LV referenced by the original function arg "lv"
- * is layered
- *
- * pool_name pool name taken from lv arg
- * data_name sub lv name, generated
- * meta_name sub lv name, generated
- *
- * pool_lv new lv for pool object, created here
- * data_lv sub lv, was lv arg, now renamed
- * metadata_lv sub lv, existing or created here
- */
-
if (to_thin) {
+ /*
+ * pool_lv is not yet a pool, when returned, pool_lv contains
+ * the segment that belonged to "lv".
+ */
if (!(pool_lv = _lvconvert_insert_thin_layer(lv)))
goto_bad;
} else {
@@ -3383,6 +3394,17 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
pool_lv = lv;
}
+ /*
+ * starts with pool_lv foo (not a pool yet)
+ * creates new data_lv foo_tdata
+ * segment from pool_lv foo is moved to data_lv foo_tdata
+ * pool_lv foo linear segment is created that maps to foo_tdata
+ * returns data_lv foo_tdata
+ *
+ * (In the to_thin case, the segment from the original lv is first
+ * moved to pool_lv by _lvconvert_insert_thin_layer, and now is
+ * moved to data_lv.)
+ */
if (!(data_lv = insert_layer_for_lv(cmd, pool_lv, 0,
(to_cachepool ? "_cdata" : "_tdata"))))
goto_bad;
@@ -3390,33 +3412,15 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
data_lv->status |= (to_cachepool) ? CACHE_POOL_DATA : THIN_POOL_DATA;
data_lv->status |= LVM_WRITE; /* Pool data LV is writable */
+ /*
+ * pool_lv now becomes a pool type.
+ * FIXME: change variable naming to avoid this confusion.
+ */
pool_lv->status |= (to_cachepool) ? CACHE_POOL : THIN_POOL;
seg = first_seg(pool_lv);
seg->segtype = pool_segtype;
- /*
- * Create a new lock for a thin pool LV. A cache pool LV has no lock.
- * Locks are removed from existing LVs that are being converted to
- * data and meta LVs (they are unlocked and deleted below.)
- */
- if (vg_is_shared(vg)) {
- lv->lock_args = NULL;
- pool_lv->lock_args = NULL;
- data_lv->lock_args = NULL;
- metadata_lv->lock_args = NULL;
-
- if (!to_cachepool) {
- if (!strcmp(vg->lock_type, "sanlock"))
- pool_lv->lock_args = "pending";
- else if (!strcmp(vg->lock_type, "dlm"))
- pool_lv->lock_args = "dlm";
- else if (!strcmp(vg->lock_type, "idm"))
- pool_lv->lock_args = "idm";
- /* The lock_args will be set in vg_write(). */
- }
- }
-
/* Apply settings to the new pool seg */
if (to_cachepool) {
if (!cache_set_params(seg, chunk_size, cache_metadata_format, cache_mode, policy_name, policy_settings))
@@ -3453,87 +3457,130 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
if (!_lvconvert_attach_metadata_to_pool(seg, metadata_lv))
goto_bad;
- if (!handle_pool_metadata_spare(vg,
- metadata_lv->le_count,
- use_pvh, pool_metadata_spare))
- goto_bad;
+ /*
+ * Create a new lock for a thin pool LV. A cache pool LV has no lock.
+ * Locks are removed from existing LVs that are being converted to
+ * data and meta LVs (they are unlocked and deleted below.)
+ * Acquire the new thin pool lock if the pool will remain active at
+ * the end of the command.
+ */
+ if (vg_is_shared(vg)) {
+ lv->lock_args = NULL;
+ pool_lv->lock_args = NULL;
+ data_lv->lock_args = NULL;
+ metadata_lv->lock_args = NULL;
- if (to_thin) {
- if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
- log_error("Failed to lock pool LV %s.", display_lvname(pool_lv));
- goto out;
+ if (!to_cachepool) {
+ if (!strcmp(vg->lock_type, "sanlock")) {
+ if (!lockd_init_lv_args(cmd, vg, pool_lv,
+ vg->lock_type, &pool_lv->lock_args)) {
+ log_error("Cannot allocate lock for new pool LV.");
+ goto_bad;
+ }
+ pool_lv->new_lock_args = 1; /* tells vg_revert to lockd_free_lv */
+ } else if (!strcmp(vg->lock_type, "dlm")) {
+ pool_lv->lock_args = "dlm";
+ } else if (!strcmp(vg->lock_type, "idm")) {
+ pool_lv->lock_args = "idm";
+ }
+
+ if (lock_active_pool) {
+ if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
+ log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
+ goto_bad;
+ }
+ lock_active_pool_done = 1;
+ }
}
+ }
+
+ if (to_thin) {
if (!lv_update_and_reload(lv))
goto_bad;
} else {
if (!vg_write(vg) || !vg_commit(vg))
goto_bad;
+ }
- if (activate_pool) {
- if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
- log_error("Failed to lock pool LV %s.", display_lvname(pool_lv));
- goto out;
- }
+ /*
+ * The main conversion is successfully committed. If any subsequent
+ * steps fail (creating spare, activating, unlocking), we do not
+ * currently have the ability to undo the changes committed up to this
+ * point. Failures in the remaining steps can print an error and cause
+ * the command to exit with an error, but no partial revert of the
+ * completed steps is attempted.
+ */
+ log_print_unless_silent("Converted %s to %s %s.", converted_names,
+ (to_cachepool) ? "cache" : "thin",
+ (to_thin) ? "volume" : "pool");
- if (!activate_lv(cmd, pool_lv)) {
- log_error("Failed to activate pool logical volume %s.",
- display_lvname(pool_lv));
-
- /* Deactivate subvolumes */
- if (!deactivate_lv(cmd, seg_lv(seg, 0)))
- log_error("Failed to deactivate pool data logical volume %s.",
- display_lvname(seg_lv(seg, 0)));
- if (!deactivate_lv(cmd, seg->metadata_lv))
- log_error("Failed to deactivate pool metadata logical volume %s.",
- display_lvname(seg->metadata_lv));
- goto out;
- }
- }
+ /*
+ * FIXME handle_pool_metadata_spare() calls vg_write() vg_commit()
+ * after creating a new lvolN, but then lvolN is renamed and hidden as
+ * [lvolN_pmspare] without any further vg_write(). So, there's an extra
+ * vg_write and vg_commit required here to cover the renaming/hiding.
+ */
+ if (!handle_pool_metadata_spare(vg, metadata_lv->le_count, use_pvh, pool_metadata_spare) ||
+ !vg_write(vg) || !vg_commit(vg)) {
+ log_error("Failed to set up spare metadata LV for thin pool.");
+ end_error = 1;
}
- r = 1;
-
-out:
- if (r)
- log_print_unless_silent("Converted %s to %s %s.",
- converted_names, (to_cachepool) ? "cache" : "thin",
- (to_thin) ? "volume" : "pool");
+ if (activate_pool && !activate_lv(cmd, pool_lv)) {
+ log_error("Failed to activate pool logical volume %s.", display_lvname(pool_lv));
+ end_error = 1;
+ }
/*
* Unlock and free the locks from existing LVs that became pool data
* and meta LVs.
*/
if (lockd_data_name) {
- if (!lockd_lv_name(cmd, vg, lockd_data_name, &lockd_data_id, lockd_data_args, "un", LDLV_PERSISTENT))
+ if (!lockd_lv_name(cmd, vg, lockd_data_name, &lockd_data_id, lockd_data_args, "un", lockd_data_flags)) {
log_error("Failed to unlock pool data LV %s/%s", vg->name, lockd_data_name);
- lockd_free_lv(cmd, vg, lockd_data_name, &lockd_data_id, lockd_data_args);
+ end_error = 1;
+ }
+ if (!lockd_free_lv(cmd, vg, lockd_data_name, &lockd_data_id, lockd_data_args)) {
+ log_error("Failed to free lock for pool data LV %s/%s", vg->name, lockd_data_name);
+ end_error = 1;
+ }
}
-
if (lockd_meta_name) {
- if (!lockd_lv_name(cmd, vg, lockd_meta_name, &lockd_meta_id, lockd_meta_args, "un", LDLV_PERSISTENT))
+ if (!lockd_lv_name(cmd, vg, lockd_meta_name, &lockd_meta_id, lockd_meta_args, "un", lockd_meta_flags)) {
log_error("Failed to unlock pool metadata LV %s/%s", vg->name, lockd_meta_name);
- lockd_free_lv(cmd, vg, lockd_meta_name, &lockd_meta_id, lockd_meta_args);
+ end_error = 1;
+ }
+ if (!lockd_free_lv(cmd, vg, lockd_meta_name, &lockd_meta_id, lockd_meta_args)) {
+ log_error("Failed to free lock for pool metadata LV %s/%s", vg->name, lockd_meta_name);
+ end_error = 1;
+ }
}
-bad:
+
if (policy_settings)
dm_config_destroy(policy_settings);
- return r;
-#if 0
-revert_new_lv:
- /* TBD */
- if (!pool_metadata_lv_name) {
- if (!deactivate_lv(cmd, metadata_lv)) {
- log_error("Failed to deactivate metadata lv.");
- return 0;
- }
- if (!lv_remove(metadata_lv) || !vg_write(vg) || !vg_commit(vg))
- log_error("Manual intervention may be required to remove "
- "abandoned LV(s) before retrying.");
+ if (end_error) {
+ log_error("Manual intervention may be required to handle reported errors.");
+ return 0;
}
+ return 1;
+
+ /*
+ * Error exit path for failures that occur before the main conversion
+ * is committed. Failures that occur after the main conversion is
+ * committed should not exit here. There is some cleanup missing here.
+ */
+bad:
+ if (lock_active_pool_done)
+ lockd_lv(cmd, pool_lv, "un", LDLV_PERSISTENT);
+ if (pool_lv && pool_lv->lock_args && pool_lv->new_lock_args)
+ lockd_free_lv(cmd, vg, pool_lv->name, &pool_lv->lvid.id[1], pool_lv->lock_args);
+
+ if (policy_settings)
+ dm_config_destroy(policy_settings);
+
return 0;
-#endif
}
static int _cache_vol_attach(struct cmd_context *cmd,
--
2.35.3

View File

@ -0,0 +1,63 @@
From ae13074a0a6ea7997cdb370cdd2185801646b2c5 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 16 Aug 2023 13:24:36 -0500
Subject: [PATCH 06/24] lvmlockd: let lockd_init_lv_args set lock_args
Set the lock_args string in addition to doing initialization.
lvconvert calls lockd_init_lv_args() directly, skipping
the normal lockd_init_lv() which usually sets lock_args.
---
lib/locking/lvmlockd.c | 9 +++++++--
tools/lvconvert.c | 15 +++------------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index d44b7333a..627aa2625 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2938,8 +2938,13 @@ int lockd_init_lv_args(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv,
const char *lock_type, const char **lock_args)
{
- /* sanlock is the only lock type that sets per-LV lock_args. */
- if (!strcmp(lock_type, "sanlock"))
+ if (!lock_type)
+ return 1;
+ if (!strcmp(lock_type, "dlm"))
+ *lock_args = "dlm";
+ else if (!strcmp(lock_type, "idm"))
+ *lock_args = "idm";
+ else if (!strcmp(lock_type, "sanlock"))
return _init_lv_sanlock(cmd, vg, lv->name, &lv->lvid.id[1], lock_args);
return 1;
}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7c9540712..40e7a6871 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3471,19 +3471,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
metadata_lv->lock_args = NULL;
if (!to_cachepool) {
- if (!strcmp(vg->lock_type, "sanlock")) {
- if (!lockd_init_lv_args(cmd, vg, pool_lv,
- vg->lock_type, &pool_lv->lock_args)) {
- log_error("Cannot allocate lock for new pool LV.");
- goto_bad;
- }
- pool_lv->new_lock_args = 1; /* tells vg_revert to lockd_free_lv */
- } else if (!strcmp(vg->lock_type, "dlm")) {
- pool_lv->lock_args = "dlm";
- } else if (!strcmp(vg->lock_type, "idm")) {
- pool_lv->lock_args = "idm";
+ if (!lockd_init_lv_args(cmd, vg, pool_lv, vg->lock_type, &pool_lv->lock_args)) {
+ log_error("Cannot allocate lock for new pool LV.");
+ goto_bad;
}
-
if (lock_active_pool) {
if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
--
2.35.3

View File

@ -0,0 +1,97 @@
From 3e92798473a04bec26a91632e1436aa415c2bb3c Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 16 Aug 2023 15:00:47 -0500
Subject: [PATCH 07/24] lvmlockd: fix lvconvert to thin-pool
---
tools/lvconvert.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 40e7a6871..7d5057254 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3096,7 +3096,6 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
struct lv_segment *seg;
unsigned int target_attr = ~0;
unsigned int activate_pool;
- unsigned int lock_active_pool;
unsigned int lock_active_pool_done = 0;
unsigned int zero_metadata;
uint64_t meta_size;
@@ -3145,12 +3144,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
is_active = lv_is_active(lv);
activate_pool = to_thinpool && is_active;
- lock_active_pool = (to_thinpool || to_thin) && is_active;
/* Wipe metadata_lv by default, but allow skipping this for cache pools. */
zero_metadata = (to_cachepool) ? arg_int_value(cmd, zero_ARG, 1) : 1;
- /* An existing LV needs to have its lock freed once it becomes a data LV. */
if (vg_is_shared(vg) && lv->lock_args) {
lockd_data_args = dm_pool_strdup(cmd->mem, lv->lock_args);
lockd_data_name = dm_pool_strdup(cmd->mem, lv->name);
@@ -3458,11 +3455,11 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
goto_bad;
/*
- * Create a new lock for a thin pool LV. A cache pool LV has no lock.
- * Locks are removed from existing LVs that are being converted to
- * data and meta LVs (they are unlocked and deleted below.)
- * Acquire the new thin pool lock if the pool will remain active at
- * the end of the command.
+ * If the input LV is being converted to a thin pool, the input LV lock
+ * is used for the thin pool LV. If the input LV is being converted to
+ * a thin LV, a new lock is created for the thin pool and the lock from
+ * the input LV is freed. A cache pool LV has no lock, so the lock for
+ * the input LV is freed.
*/
if (vg_is_shared(vg)) {
lv->lock_args = NULL;
@@ -3470,18 +3467,25 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
data_lv->lock_args = NULL;
metadata_lv->lock_args = NULL;
- if (!to_cachepool) {
+ if (to_thin) {
if (!lockd_init_lv_args(cmd, vg, pool_lv, vg->lock_type, &pool_lv->lock_args)) {
log_error("Cannot allocate lock for new pool LV.");
goto_bad;
}
- if (lock_active_pool) {
- if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
- log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
- goto_bad;
- }
- lock_active_pool_done = 1;
+ } else if (to_thinpool) {
+ pool_lv->lock_args = lockd_data_args;
+ /* Don't free this lock below. */
+ lockd_data_args = NULL;
+ lockd_data_name = NULL;
+ }
+
+ /* Acquire the thin pool lock if the pool will remain active. */
+ if ((to_thin || to_thinpool) && is_active) {
+ if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
+ log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
+ goto_bad;
}
+ lock_active_pool_done = 1;
}
}
@@ -3523,8 +3527,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
}
/*
- * Unlock and free the locks from existing LVs that became pool data
- * and meta LVs.
+ * Unlock and free locks that are no longer used.
*/
if (lockd_data_name) {
if (!lockd_lv_name(cmd, vg, lockd_data_name, &lockd_data_id, lockd_data_args, "un", lockd_data_flags)) {
--
2.35.3

View File

@ -0,0 +1,34 @@
From 33b804a80e24d58e57936f7c5a6cbe7c77981483 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 17 Aug 2023 21:50:03 +0200
Subject: [PATCH 08/24] lvconvert: run error path code only for shared VG
Error path for locking only for share VG.
---
tools/lvconvert.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7d5057254..49e9248a6 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3566,10 +3566,12 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
* committed should not exit here. There is some cleanup missing here.
*/
bad:
- if (lock_active_pool_done)
- lockd_lv(cmd, pool_lv, "un", LDLV_PERSISTENT);
- if (pool_lv && pool_lv->lock_args && pool_lv->new_lock_args)
- lockd_free_lv(cmd, vg, pool_lv->name, &pool_lv->lvid.id[1], pool_lv->lock_args);
+ if (vg_is_shared(vg)) {
+ if (lock_active_pool_done)
+ lockd_lv(cmd, pool_lv, "un", LDLV_PERSISTENT);
+ if (pool_lv && pool_lv->lock_args && pool_lv->new_lock_args)
+ lockd_free_lv(cmd, vg, pool_lv->name, &pool_lv->lvid.id[1], pool_lv->lock_args);
+ }
if (policy_settings)
dm_config_destroy(policy_settings);
--
2.35.3

View File

@ -0,0 +1,30 @@
From b6ab049c3184edcb4d56789d32991bbf8c97de77 Mon Sep 17 00:00:00 2001
From: wangzhiqiang <wangzhiqiang95@huawei.com>
Date: Wed, 30 Aug 2023 15:47:42 -0500
Subject: [PATCH 09/24] vgchange: acquire an exclusive VG lock for refresh
Concurrent vgchange --refresh commands can lead to hung
tasks in dm code.
Signed-off-by: wangzhiqiang <wangzhiqiang95@huawei.com>
---
tools/vgchange.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index e2d3dad02..8c1d605c6 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -1008,7 +1008,8 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
if (update)
flags |= READ_FOR_UPDATE;
- else if (arg_is_set(cmd, activate_ARG))
+ else if (arg_is_set(cmd, activate_ARG) ||
+ arg_is_set(cmd, refresh_ARG))
flags |= READ_FOR_ACTIVATE;
if (!(handle = init_processing_handle(cmd, NULL))) {
--
2.35.3

View File

@ -0,0 +1,40 @@
From cd17ccbc684590e8655888af6d6b0452287fd47d Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 31 Aug 2023 13:15:07 -0500
Subject: [PATCH 10/24] lvmlockd: client mutex ordering
Avoid deadlock between threads on mutexes (in theory.)
---
daemons/lvmlockd/lvmlockd-core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 887226f1a..1261f6482 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -4690,9 +4690,12 @@ static int dump_info(int *dump_len)
/*
* clients
+ * Proper lock order is client_mutex then cl->mutex,
+ * but cl->mutex is already held so skip client info
+ * if it would block.
*/
-
- pthread_mutex_lock(&client_mutex);
+ if (pthread_mutex_trylock(&client_mutex))
+ goto print_ls;
list_for_each_entry(cl, &client_list, list) {
ret = print_client(cl, "client", pos, len);
if (ret >= len - pos) {
@@ -4706,6 +4709,7 @@ static int dump_info(int *dump_len)
if (rv < 0)
return rv;
+ print_ls:
/*
* lockspaces with their action/resource/lock info
*/
--
2.35.3

View File

@ -0,0 +1,57 @@
From b5b97c2b663565833218f68b196327ef63b1a114 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 31 Aug 2023 18:50:33 +0200
Subject: [PATCH 11/24] filesystem: move stat after open check
To avoid time-of-check-time-of-use clash, take the stat()
after successful open with fstat().
Also add some debugs for failing sys calls.
---
lib/device/filesystem.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c
index 53cbc2d02..29b57d0c9 100644
--- a/lib/device/filesystem.c
+++ b/lib/device/filesystem.c
@@ -155,26 +155,26 @@ int fs_get_info(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
- if (stat(crypt_path, &st_crypt) < 0) {
- log_error("Failed to get crypt path %s", crypt_path);
- return 0;
- }
-
memset(&info, 0, sizeof(info));
log_print_unless_silent("Checking crypt device %s on LV %s.",
crypt_path, display_lvname(lv));
if ((fd = open(crypt_path, O_RDONLY)) < 0) {
- log_error("Failed to open crypt path %s", crypt_path);
+ log_error("Failed to open crypt path %s.", crypt_path);
return 0;
}
- if (ioctl(fd, BLKGETSIZE64, &info.crypt_dev_size_bytes) < 0) {
- log_error("Failed to get crypt device size %s", crypt_path);
- close(fd);
+
+ if ((ret = fstat(fd, &st_crypt)) < 0)
+ log_sys_error("fstat", crypt_path);
+ else if ((ret = ioctl(fd, BLKGETSIZE64, &info.crypt_dev_size_bytes)) < 0)
+ log_error("Failed to get crypt device size %s.", crypt_path);
+
+ if (close(fd))
+ log_sys_debug("close", crypt_path);
+
+ if (ret < 0)
return 0;
- }
- close(fd);
if (!fs_get_blkid(crypt_path, &info)) {
log_error("No file system info from blkid for dm-crypt device %s on LV %s.",
--
2.35.3

View File

@ -0,0 +1,49 @@
From 950edf73781807b07d97717b460ae682edb38fdf Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 4 Sep 2023 17:32:26 +0200
Subject: [PATCH 12/24] tests: check for writecache
Writecache needs writecache kernel target to be present.
---
test/shell/caching-snapshot.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/test/shell/caching-snapshot.sh b/test/shell/caching-snapshot.sh
index d73f4ad06..854d8bad7 100644
--- a/test/shell/caching-snapshot.sh
+++ b/test/shell/caching-snapshot.sh
@@ -22,6 +22,9 @@ lvm segtypes 2>/dev/null | grep writecache$ >/dev/null || {
aux have_cache 1 10 0 || skip
which mkfs.ext4 || skip
+HAVE_WRITECACHE=1
+aux have_writecache 1 0 0 || HAVE_WRITECACHE=0
+
mount_dir="mnt"
mkdir -p "$mount_dir"
@@ -105,7 +108,10 @@ test_snap_remove() {
test_snap_remove cache --cachepool
test_snap_remove cache --cachevol
+
+if [ "$HAVE_WRITECACHE" = "1" ]; then
test_snap_remove writecache --cachevol
+fi
# adding cache|writecache to an LV that has a snapshot
@@ -143,7 +149,10 @@ test_caching_with_snap() {
test_caching_with_snap cache --cachepool
test_caching_with_snap cache --cachevol
+
+if [ "$HAVE_WRITECACHE" = "1" ]; then
test_caching_with_snap writecache --cachevol
+fi
# adding cache|writecache to a snapshot is not allowed
--
2.35.3

View File

@ -0,0 +1,34 @@
From 25618d71b57e380ab692b640419dc89a9c6fe20e Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 11 Sep 2023 12:18:12 -0500
Subject: [PATCH 13/24] lvresize: fix 32 bit overflow in size calculation
---
lib/metadata/lv_manip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9bec8b54d..23e04c3a8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6445,7 +6445,7 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv,
}
/* extent_size units is SECTOR_SIZE (512) */
- newsize_bytes_lv = lp->extents * lv->vg->extent_size * SECTOR_SIZE;
+ newsize_bytes_lv = (uint64_t) lp->extents * lv->vg->extent_size * SECTOR_SIZE;
newsize_bytes_fs = newsize_bytes_lv;
/*
@@ -6591,7 +6591,7 @@ static int _fs_extend(struct cmd_context *cmd, struct logical_volume *lv,
*/
/* extent_size units is SECTOR_SIZE (512) */
- newsize_bytes_lv = lp->extents * lv->vg->extent_size * SECTOR_SIZE;
+ newsize_bytes_lv = (uint64_t) lp->extents * lv->vg->extent_size * SECTOR_SIZE;
newsize_bytes_fs = newsize_bytes_lv;
if (fsinfo.needs_crypt) {
newsize_bytes_fs -= fsinfo.crypt_offset_bytes;
--
2.35.3

View File

@ -0,0 +1,44 @@
From afb60167d6268a61d51b1a33efa741f46c7e73ee Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Wed, 6 Sep 2023 15:28:29 +0200
Subject: [PATCH 14/24] gcc: fix warnings for x32 architecture
Warning from x32 ABI compilation.
---
lib/log/log.c | 2 +-
lib/metadata/vdo_manip.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/log/log.c b/lib/log/log.c
index 6dc269675..b654737f1 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -515,7 +515,7 @@ static void _set_time_prefix(char *prefix, int buflen)
if (!len)
goto fail;
- len = dm_snprintf(prefix + len, buflen - len, ".%06ld ", ts.tv_nsec/1000);
+ len = dm_snprintf(prefix + len, buflen - len, ".%06d ", (int)ts.tv_nsec/1000);
if (len < 0)
goto fail;
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index d51ef2dbf..516d42d8b 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -522,9 +522,9 @@ static int _get_sysinfo_memory(uint64_t *total_mb, uint64_t *available_mb)
if (sysinfo(&si) != 0)
return 0;
- log_debug("Sysinfo free:%lu bufferram:%lu sharedram:%lu freehigh:%lu unit:%u.",
- si.freeram >> 20, si.bufferram >> 20, si.sharedram >> 20,
- si.freehigh >> 20, si.mem_unit);
+ log_debug("Sysinfo free:%llu bufferram:%llu sharedram:%llu freehigh:%llu unit:%u.",
+ (unsigned long long)si.freeram >> 20, (unsigned long long)si.bufferram >> 20, (unsigned long long)si.sharedram >> 20,
+ (unsigned long long)si.freehigh >> 20, si.mem_unit);
*available_mb = ((uint64_t)(si.freeram + si.bufferram) * si.mem_unit) >> 30;
*total_mb = si.totalram >> 30;
--
2.35.3

View File

@ -0,0 +1,26 @@
From ae65e71b3d519ed99f0bab6a595d6d255e0635bb Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 12 Sep 2023 16:40:26 +0200
Subject: [PATCH 15/24] gcc: warning: missing braces around initializer
Fix warning emitted by some older gcc...
---
tools/lvconvert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 49e9248a6..aa601d4ca 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -6514,7 +6514,7 @@ static int _lvconvert_integrity_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
- struct integrity_settings settings = { 0 };
+ struct integrity_settings settings = { .tag_size = 0 };
int ret;
if (!integrity_mode_set(arg_str_value(cmd, raidintegritymode_ARG, NULL), &settings))
--
2.35.3

View File

@ -0,0 +1,53 @@
From fbbf796dd89007fe57a3c7043f27aed2fbf0775c Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Sep 2023 00:39:33 +0200
Subject: [PATCH 16/24] test: improve aux teardown
Handle the case of device teardown where the first pass
could have only a single, but opened device, for removal.
In such case we want to at least once go through
the udev_wait and retry removal again.
TODO: maybe a sleep .1 might be usable as well with udev_wait
---
test/lib/aux.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 3f66e9290..4474dc72c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -239,8 +239,8 @@ prepare_lvmpolld() {
echo $! > LOCAL_LVMPOLLD
for i in {200..0} ; do
test -e "$TESTDIR/lvmpolld.socket" && break
- echo -n .;
- sleep .1;
+ echo -n .
+ sleep .1
done # wait for the socket
test "$i" -gt 0 || die "Startup of lvmpolld is too slow."
echo ok
@@ -395,10 +395,10 @@ teardown_devs_prefixed() {
# 2nd. loop is trying --force removal which can possibly 'unstuck' some bloked operations
for i in 0 1; do
test "$i" = 1 && test "$stray" = 0 && break # no stray device removal
+ local progress=1
while :; do
local sortby="name"
- local progress=0
# HACK: sort also by minors - so we try to close 'possibly later' created device first
test "$i" = 0 || sortby="-minor"
@@ -426,6 +426,7 @@ teardown_devs_prefixed() {
udev_wait
wait
+ progress=0
done # looping till there are some removed devices
done
}
--
2.35.3

View File

@ -0,0 +1,26 @@
From cf8a0c94fff754e4b6a504a430e53439d67b6ca0 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Sep 2023 23:27:55 +0200
Subject: [PATCH 17/24] tests: aux try with extra sleep
Since udev_wait is not really adding any major delay to wait
for any udev worker processing - add extra sleep .1.
---
test/lib/aux.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 4474dc72c..816a13223 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -424,6 +424,7 @@ teardown_devs_prefixed() {
test "$progress" = 1 || break
+ sleep .1
udev_wait
wait
progress=0
--
2.35.3

View File

@ -0,0 +1,27 @@
From cb34be9ba90613cd49f4822fc118cecfc93ac897 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 14 Sep 2023 01:41:45 +0200
Subject: [PATCH 18/24] tests: aux using singl lvmconf call
lvmconf can handle multiple options in a single pass.
---
test/lib/aux.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 816a13223..20dbecec2 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1444,8 +1444,7 @@ extend_filter_md() {
for rx in "$@"; do
filter=$(echo "$filter" | sed -e "s:\\[:[ \"$rx\", :")
done
- lvmconf "$filter"
- lvmconf "devices/scan = [ \"$DM_DEV_DIR\", \"/dev\" ]"
+ lvmconf "$filter" "devices/scan = [ \"$DM_DEV_DIR\", \"/dev\" ]"
}
extend_filter_LVMTEST() {
--
2.35.3

View File

@ -0,0 +1,49 @@
From da95bb6883810863a394525c9a66196b7b0dda21 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Sep 2023 23:23:47 +0200
Subject: [PATCH 19/24] tests: missing to check for writecache support
Ono more case requires writecache presence.
---
test/shell/caching-snapshot.sh | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/test/shell/caching-snapshot.sh b/test/shell/caching-snapshot.sh
index 854d8bad7..b31cb520f 100644
--- a/test/shell/caching-snapshot.sh
+++ b/test/shell/caching-snapshot.sh
@@ -72,7 +72,8 @@ test_snap_create() {
test_snap_create cache --cachepool
test_snap_create cache --cachevol
-test_snap_create writecache --cachevol
+
+[ "$HAVE_WRITECACHE" = "1" ] && test_snap_create writecache --cachevol
# removing cache|writecache while snapshot exists
@@ -109,9 +110,7 @@ test_snap_remove() {
test_snap_remove cache --cachepool
test_snap_remove cache --cachevol
-if [ "$HAVE_WRITECACHE" = "1" ]; then
-test_snap_remove writecache --cachevol
-fi
+[ "$HAVE_WRITECACHE" = "1" ] && test_snap_remove writecache --cachevol
# adding cache|writecache to an LV that has a snapshot
@@ -150,9 +149,7 @@ test_caching_with_snap() {
test_caching_with_snap cache --cachepool
test_caching_with_snap cache --cachevol
-if [ "$HAVE_WRITECACHE" = "1" ]; then
-test_caching_with_snap writecache --cachevol
-fi
+[ "$HAVE_WRITECACHE" = "1" ] && test_caching_with_snap writecache --cachevol
# adding cache|writecache to a snapshot is not allowed
--
2.35.3

View File

@ -0,0 +1,40 @@
From befc30b610ed3a648f967e50cea752d0f5a09073 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Sep 2023 23:39:08 +0200
Subject: [PATCH 20/24] tests: pvmove large disk area
With some faster test hw machine we need to make this test
a bit more resource consuming.
---
test/shell/pvmove-abort-all.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
index 872db041e..081c02911 100644
--- a/test/shell/pvmove-abort-all.sh
+++ b/test/shell/pvmove-abort-all.sh
@@ -26,7 +26,7 @@ aux target_at_least dm-mirror 1 10 0 || skip
# Throttle mirroring
aux throttle_dm_mirror || skip
-aux prepare_pvs 6 60
+aux prepare_pvs 6 90
vgcreate -s 512k $vg "$dev1" "$dev2"
pvcreate --metadatacopies 0 "$dev3"
@@ -41,9 +41,9 @@ for backgroundarg in "-b" "" ;
do
# Create multisegment LV
-lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
-lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
-lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
+lvcreate -an -Zn -l60 -n $lv1 $vg "$dev1"
+lvcreate -an -Zn -l60 -n $lv2 $vg "$dev2"
+lvcreate -an -Zn -l60 -n $lv1 $vg1 "$dev4"
lvextend -l+30 -n $vg1/$lv1 "$dev5"
cmd1=(pvmove -i1 $backgroundarg $mode "$dev1" "$dev3")
--
2.35.3

View File

@ -0,0 +1,25 @@
From 8257181f9e4e54505de158a98d54c8a11b127553 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Sep 2023 23:40:16 +0200
Subject: [PATCH 21/24] tests: enforce full fs check
---
test/shell/lvresize-fs-crypt.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/shell/lvresize-fs-crypt.sh b/test/shell/lvresize-fs-crypt.sh
index 966870d5d..302fd5fc9 100644
--- a/test/shell/lvresize-fs-crypt.sh
+++ b/test/shell/lvresize-fs-crypt.sh
@@ -139,7 +139,7 @@ dd if=/dev/zero of="$mount_dir/zeros1" bs=1M count=10 oflag=direct
df --output=size "$mount_dir" |tee df1
# resize only the fs (to 256M), not the crypt dev or LV
umount "$mount_dir"
-fsck -n /dev/mapper/$cr
+fsck -fn /dev/mapper/$cr
resize2fs /dev/mapper/$cr 262144k
mount /dev/mapper/$cr "$mount_dir"
# this lvresize will not resize the fs (which is already reduced
--
2.35.3

View File

@ -0,0 +1,588 @@
From 9683478371c60e78920c22cb4f5ca14b39bb9fcb Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 14 Sep 2023 00:51:58 +0200
Subject: [PATCH 22/24] tests: update for work in fake dev environment
No write outside of $LVM_TEST_DIR (removed /test access).
Use 'aux prepare_scsi_debug_dev' for automated scsi_debug handling
Properly use "" around shell vars.
Smarter read of PVS values.
Relax requirement to only work with real /dev dir.
---
test/shell/devicesfile-vpd-ids.sh | 328 +++++++++++++++---------------
1 file changed, 164 insertions(+), 164 deletions(-)
diff --git a/test/shell/devicesfile-vpd-ids.sh b/test/shell/devicesfile-vpd-ids.sh
index 9a12f49f9..37fb6b79f 100644
--- a/test/shell/devicesfile-vpd-ids.sh
+++ b/test/shell/devicesfile-vpd-ids.sh
@@ -16,12 +16,10 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
-test "$DM_DEV_DIR" = "/dev" || skip "Only works with /dev access -> make check LVM_TEST_DEVDIR=/dev"
-
-aux lvmconf 'devices/use_devicesfile = 1'
+SYS_DIR="sys"
# requires trailing / to match dm
-aux lvmconf 'devices/device_id_sysfs_dir = "/test/sys/"'
-SYS_DIR="/test/sys"
+aux lvmconf "devices/device_id_sysfs_dir = \"$PWD/$SYS_DIR/\"" \
+ "devices/use_devicesfile = 1"
# These values match the values encoded in the binary blob
# written to dev1_vpd_pg83
@@ -34,7 +32,7 @@ DEV1_NAA2=naa.600a098000000002ac18542400000dbd
DEV1_NAA3=naa.553b13644430344b4e3f486d32647962
create_base() {
- mkdir -p $SYS_DIR/dev/block
+ mkdir -p "$SYS_DIR/dev/block"
echo -n "0083 009c 0201 0020 4c56 4d54 5354 2020 \
204c 554e 2038 3039 7741 4c56 4d54 5354 \
@@ -45,39 +43,36 @@ create_base() {
0000 0dbd 0114 0004 0101 0005 0115 0004 \
0000 03ec 0328 0028 6e61 612e 3535 3342 \
3133 3634 3434 3330 3334 3442 3445 3346 \
- 3438 3644 3332 3634 3739 3632 0000 0000" | xxd -r -p > $SYS_DIR/dev1_vpd_pg83
+ 3438 3644 3332 3634 3739 3632 0000 0000" | xxd -r -p > "$SYS_DIR/dev1_vpd_pg83"
}
remove_base() {
- rm $SYS_DIR/dev1_vpd_pg83
- rmdir $SYS_DIR/dev/block
- rmdir $SYS_DIR/dev
- rmdir $SYS_DIR
+ rm "$SYS_DIR/dev1_vpd_pg83"
+ rmdir "$SYS_DIR/dev/block"
+ rmdir "$SYS_DIR/dev"
+ rmdir "$SYS_DIR"
}
setup_sysfs() {
- mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
- echo $1 > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
- cp $SYS_DIR/dev1_vpd_pg83 $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/vpd_pg83
+ mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
+ echo "$1" > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+ cp "$SYS_DIR/dev1_vpd_pg83" "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/vpd_pg83"
}
cleanup_sysfs() {
- rm -f $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
- rm -f $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/vpd_pg83
- rmdir $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device || true
- rmdir $SYS_DIR/dev/block/$MAJOR1:$MINOR1 || true
+ rm -f "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+ rm -f "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/vpd_pg83"
+ rmdir "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device" || true
+ rmdir "$SYS_DIR/dev/block/$MAJOR1:$MINOR1" || true
}
+aux prepare_scsi_debug_dev 16 || skip
-modprobe scsi_debug dev_size_mb=16 num_tgts=1
-sleep 2
# Get scsi device name created by scsi_debug.
# SD = sdh
# DEV1 = /dev/sdh
-SD=$(grep -H scsi_debug /sys/block/sd*/device/model | cut -f4 -d /);
-echo $SD
-DEV1=/dev/$SD
-echo $DEV1
+DEV1=$(< SCSI_DEBUG_DEV)
+echo "Using scsi_debug device: $DEV1"
DFDIR="$LVM_SYSTEM_DIR/devices"
mkdir -p "$DFDIR" || true
@@ -87,22 +82,23 @@ touch $DF
pvcreate "$DEV1"
vgcreate $vg "$DEV1"
-MAJOR1=`pvs "$DEV1" --noheading -o major | tr -d - | awk '{print $1}'`
-MINOR1=`pvs "$DEV1" --noheading -o minor | tr -d - | awk '{print $1}'`
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
+eval "$(pvs --noheading --nameprefixes -o major,minor,uuid "$DEV1")"
+MAJOR1=$LVM2_PV_MAJOR
+MINOR1=$LVM2_PV_MINOR
+PVID1=${LVM2_PV_UUID//-/}
create_base
# No sys/wwid, lvm uses wwid from sys/vpd
-setup_sysfs $DEV1_NAA
+setup_sysfs "$DEV1_NAA"
# no sys/wwid is reported
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
-rm $DF
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
pvs "$DEV1"
-grep $DEV1_NAA $DF
+grep "$DEV1_NAA" "$DF"
cleanup_sysfs
# Kernel changes the type printed from sys/wwid from t10 to naa
@@ -113,15 +109,15 @@ cleanup_sysfs
# reporting pvs should still find the dev based on using vpd data
# and find the t10 value there
-setup_sysfs $DEV1_T10
-rm $DF
+setup_sysfs "$DEV1_T10"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-grep sys_wwid $DF
-grep $DEV1_T10 $DF
+cat "$DF"
+grep sys_wwid "$DF"
+grep "$DEV1_T10" "$DF"
pvs "$DEV1"
# kernel changes what it reports from sys/wwid
-echo $DEV1_NAA > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+echo "$DEV1_NAA" > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
# lvm finds the original t10 id in vpd
pvs "$DEV1"
cleanup_sysfs
@@ -132,229 +128,231 @@ cleanup_sysfs
# df entry uses the specified type
# reporting pvs should show the pv
-setup_sysfs $DEV1_T10
-rm $DF
+setup_sysfs "$DEV1_T10"
+rm "$DF"
lvmdevices --adddev "$DEV1" --deviceidtype wwid_naa
-cat $DF
-grep wwid_naa $DF
-grep $DEV1_NAA $DF
+cat "$DF"
+grep wwid_naa "$DF"
+grep "$DEV1_NAA" "$DF"
pvs "$DEV1"
lvmdevices --deldev "$DEV1"
lvmdevices --addpvid "$PVID1" --deviceidtype wwid_naa
-cat $DF
-grep $DEV1_NAA $DF
+cat "$DF"
+grep "$DEV1_NAA" "$DF"
pvs "$DEV1"
lvmdevices --deldev "$DEV1"
lvmdevices --adddev "$DEV1" --deviceidtype wwid_eui
-cat $DF
-grep wwid_eui $DF
-grep $DEV1_EUI $DF
+cat "$DF"
+grep wwid_eui "$DF"
+grep "$DEV1_EUI" "$DF"
pvs "$DEV1"
cleanup_sysfs
-# Any of the vpd wwids can be used in the devices file
+# Any of the vpd wwids can be used in the devices file
# with type sys_wwid and the device will be matched to
# it by finding that wwid in the vpd data.
-setup_sysfs $DEV1_NAA
-rm $DF
+setup_sysfs "$DEV1_NAA"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+cat "$DF"
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
pvs "$DEV1"
cleanup_sysfs
-setup_sysfs $DEV1_NAA2
-rm $DF
+setup_sysfs "$DEV1_NAA2"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+cat "$DF"
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
pvs "$DEV1"
cleanup_sysfs
-setup_sysfs $DEV1_NAA3
-rm $DF
+setup_sysfs "$DEV1_NAA3"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+cat "$DF"
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
pvs "$DEV1"
cleanup_sysfs
-setup_sysfs $DEV1_EUI
-rm $DF
+setup_sysfs "$DEV1_EUI"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+cat "$DF"
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
pvs "$DEV1"
cleanup_sysfs
-setup_sysfs $DEV1_T10
-rm $DF
+setup_sysfs "$DEV1_T10"
+rm "$DF"
lvmdevices --adddev "$DEV1"
-cat $DF
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+cat "$DF"
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
pvs "$DEV1"
cleanup_sysfs
# Test nvme wwid that starts with "nvme" instead of naa/eui/t10
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/
-echo "nvme.111111111111111111122222222222333333333333333-44444444444444444445555555555556666666666666666662-00000001" > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/wwid
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1"
+echo "nvme.111111111111111111122222222222333333333333333-44444444444444444445555555555556666666666666666662-00000001" > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
vgcreate $vg "$DEV1"
lvcreate -l1 -an $vg
-cat $DF
+cat "$DF"
pvs -o+deviceidtype,deviceid "$DEV1" |tee out
grep sys_wwid out
grep nvme.111 out
-grep sys_wwid $DF
-grep nvme.111 $DF
+grep sys_wwid "$DF"
+grep nvme.111 "$DF"
lvmdevices --deldev "$DEV1"
not lvmdevices --adddev "$DEV1" --deviceidtype wwid_eui
lvmdevices --adddev "$DEV1" --deviceidtype sys_wwid
lvmdevices | grep nvme.111
lvremove -y $vg
-sleep 1
+sleep .1
lvs $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/wwid"
cleanup_sysfs
# Test t10 wwid containing quote
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
-echo "t10.ATA_2.5\"_SATA_SSD_1112-A___111111111111" > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
+echo "t10.ATA_2.5\"_SATA_SSD_1112-A___111111111111" > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
vgcreate $vg "$DEV1"
lvcreate -l1 -an $vg
-cat $DF
+cat "$DF"
# check wwid string in metadata output
pvs -o+deviceidtype,deviceid "$DEV1" |tee out
grep sys_wwid out
# the quote is removed after the 5
grep 2.5_SATA_SSD out
# check wwid string in system.devices
-grep sys_wwid $DF
+grep sys_wwid "$DF"
# the quote is removed after the 5
-grep 2.5_SATA_SSD $DF
+grep 2.5_SATA_SSD "$DF"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
# Test t10 wwid with trailing space and line feed at the end
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
echo -n "7431 302e 4154 4120 2020 2020 5642 4f58 \
2048 4152 4444 4953 4b20 2020 2020 2020 \
2020 2020 2020 2020 2020 2020 2020 2020 \
2020 2020 5642 3963 3130 6433 3138 2d31 \
-3838 6439 6562 6320 0a" | xxd -r -p > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
-cat $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+3838 6439 6562 6320 0a" | xxd -r -p > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+cat "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
vgcreate $vg "$DEV1"
lvcreate -l1 -an $vg
-cat $DF
+cat "$DF"
# check wwid string in metadata output
pvs -o+deviceidtype,deviceid "$DEV1" |tee out
grep sys_wwid out
# check wwid string in system.devices
-grep sys_wwid $DF
+grep sys_wwid "$DF"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
# Test t10 wwid with trailing space at the end that was created by 9.0/9.1
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
echo -n "7431 302e 4154 4120 2020 2020 5642 4f58 \
2048 4152 4444 4953 4b20 2020 2020 2020 \
2020 2020 2020 2020 2020 2020 2020 2020 \
2020 2020 5642 3963 3130 6433 3138 2d31 \
-3838 6439 6562 6320 0a" | xxd -r -p > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
-cat $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+3838 6439 6562 6320 0a" | xxd -r -p > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+cat "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
vgcreate $vg "$DEV1"
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
+eval "$(pvs --noheading --nameprefixes -o uuid "$DEV1")"
+PVID1=${LVM2_PV_UUID//-/}
T10_WWID_RHEL91="t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9ebc_"
lvcreate -l1 -an $vg
-cat $DF
+cat "$DF"
# check wwid string in metadata output
pvs -o+deviceidtype,deviceid "$DEV1" |tee out
grep sys_wwid out
# check wwid string in system.devices
-grep sys_wwid $DF
+grep sys_wwid "$DF"
# Replace IDNAME with the IDNAME that 9.0/9.1 created from this wwid
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_wwid IDNAME=t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9ebc_ DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_wwid IDNAME=t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9ebc_ DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs
pvs -o+deviceidtype,deviceid "$DEV1"
# Removing the trailing _ which should then work
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_wwid IDNAME=t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9ebc DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_wwid IDNAME=t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9ebc DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs
pvs -o+deviceidtype,deviceid "$DEV1"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
# test a t10 wwid that has actual trailing underscore which
# is followed by a trailing space.
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
echo -n "7431 302e 4154 4120 2020 2020 5642 4f58 \
2048 4152 4444 4953 4b20 2020 2020 2020 \
2020 2020 2020 2020 2020 2020 2020 2020 \
2020 2020 5642 3963 3130 6433 3138 2d31 \
-3838 6439 6562 5f20 0a" | xxd -r -p > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
-cat $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+3838 6439 6562 5f20 0a" | xxd -r -p > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
+cat "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
# The wwid has an actual underscore char (5f) followed by a space char (20)
# 9.1 converts the trailing space to an underscore
T10_WWID_RHEL91="t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9eb__"
# 9.2 ignores the trailing space
T10_WWID_RHEL92="t10.ATA_____VBOX_HARDDISK___________________________VB9c10d318-188d9eb_"
lvmdevices --adddev "$DEV1"
-cat $DF
+cat "$DF"
vgcreate $vg "$DEV1"
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
+eval "$(pvs --noheading --nameprefixes -o uuid "$DEV1")"
+PVID1=${LVM2_PV_UUID//-/}
lvcreate -l1 -an $vg
-cat $DF
+cat "$DF"
# check wwid string in metadata output
pvs -o+deviceidtype,deviceid "$DEV1" |tee out
grep sys_wwid out
# check wwid string in system.devices
-grep sys_wwid $DF
+grep sys_wwid "$DF"
# Replace IDNAME with the IDNAME that 9.0/9.1 created from this wwid
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_wwid IDNAME=${T10_WWID_RHEL91} DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_wwid IDNAME=${T10_WWID_RHEL91} DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs
pvs -o+deviceidtype,deviceid "$DEV1"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
#
@@ -363,67 +361,70 @@ cleanup_sysfs
# underscores are understood.
#
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
-echo -n " s123 456 " > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/serial
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
+echo -n " s123 456 " > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/serial"
lvmdevices --adddev "$DEV1"
-cat $DF
-grep "IDNAME=s123__456 DEVNAME" $DF
+cat "$DF"
+grep "IDNAME=s123__456 DEVNAME" "$DF"
vgcreate $vg "$DEV1"
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_serial IDNAME=__s123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+eval "$(pvs --noheading --nameprefixes -o uuid "$DEV1")"
+PVID1=${LVM2_PV_UUID//-/}
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_serial IDNAME=__s123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs -o+deviceidtype,deviceid "$DEV1"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/serial
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/serial"
cleanup_sysfs
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
-echo -n " t10.123 456 " > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
+echo -n " t10.123 456 " > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
-grep "IDNAME=t10.123_456 DEVNAME" $DF
+cat "$DF"
+grep "IDNAME=t10.123_456 DEVNAME" "$DF"
vgcreate $vg "$DEV1"
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_wwid IDNAME=__t10.123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+eval "$(pvs --noheading --nameprefixes -o uuid "$DEV1")"
+PVID1=${LVM2_PV_UUID//-/}
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_wwid IDNAME=__t10.123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs -o+deviceidtype,deviceid "$DEV1"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
-rm $DF
+rm "$DF"
aux wipefs_a "$DEV1"
-mkdir -p $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device
-echo -n " naa.123 456 " > $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
+echo -n " naa.123 456 " > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
lvmdevices --adddev "$DEV1"
-cat $DF
-grep "IDNAME=naa.123__456 DEVNAME" $DF
+cat "$DF"
+grep "IDNAME=naa.123__456 DEVNAME" "$DF"
vgcreate $vg "$DEV1"
-PVID1=`pvs "$DEV1" --noheading -o uuid | tr -d - | awk '{print $1}'`
-cat $DF | grep -v IDNAME > $DFTMP
-cat $DFTMP
-echo "IDTYPE=sys_wwid IDNAME=__naa.123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> $DFTMP
-cp $DFTMP $DF
-cat $DF
+eval "$(pvs --noheading --nameprefixes -o uuid "$DEV1")"
+PVID1=${LVM2_PV_UUID//-/}
+cat "$DF" | grep -v IDNAME > "$DFTMP"
+cat "$DFTMP"
+echo "IDTYPE=sys_wwid IDNAME=__naa.123__456__ DEVNAME=${DEV1} PVID=${PVID1}" >> "$DFTMP"
+cp "$DFTMP" "$DF"
+cat "$DF"
vgs
pvs -o+deviceidtype,deviceid "$DEV1"
lvremove -y $vg
vgremove $vg
-rm $SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid
+rm "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
cleanup_sysfs
@@ -433,4 +434,3 @@ cleanup_sysfs
# This would let the user specify the second naa wwid.
remove_base
-rmmod scsi_debug || true
--
2.35.3

View File

@ -0,0 +1,27 @@
From a55bd2ddc1ca21ca6fb44df58d7287f619cb54f6 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 14 Sep 2023 01:42:29 +0200
Subject: [PATCH 23/24] tests: skip test when lvmdbusd runs on the system
lvmdbusd changes $RUNDIR results.
---
test/shell/duplicate-pvs-md0.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/shell/duplicate-pvs-md0.sh b/test/shell/duplicate-pvs-md0.sh
index ea800cf5a..9c1005b0b 100644
--- a/test/shell/duplicate-pvs-md0.sh
+++ b/test/shell/duplicate-pvs-md0.sh
@@ -27,6 +27,9 @@ _clear_online_files() {
. lib/inittest
+# Running lvmdbusd with its fullreport scannnig changes $RUNDIR results
+pgrep lvmdbusd && skip "Test cannot work, while there is running lvmdbusd."
+
MD_LEVEL=${MD_LEVEL-0}
aux prepare_devs 4 10
--
2.35.3

View File

@ -0,0 +1,38 @@
From dc31f8bdd8d6685c04802a023b769fe9310f1c91 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 23 Aug 2023 13:47:06 +0200
Subject: [PATCH 24/24] tests: better slowdown
---
test/shell/lvconvert-mirror.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 17ed033b2..461d14748 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -323,10 +323,10 @@ SHOULD=
aux throttle_dm_mirror || SHOULD=should
# Use large enough mirror that takes time to sychronize with small regionsize
-lvcreate -aey -L30 -Zn -Wn --type mirror --regionsize 16k -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE"
+lvcreate -aey -L20 -Zn -Wn --type mirror --regionsize 4k -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE"
$SHOULD not lvconvert -m-1 $vg/$lv1 "$dev1" 2>&1 | tee out
aux restore_dm_mirror
-grep "not in-sync" out
+$SHOULD grep "not in-sync" out
lvconvert $vg/$lv1 # wait
@@ -341,7 +341,7 @@ lvremove -ff $vg
aux throttle_dm_mirror || :
# No parallel lvconverts on a single LV please
# Use big enough mirror size and small regionsize to run on all test machines succesfully
-lvcreate -aey -Zn -Wn -L30 --type mirror --regionsize 16k -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0-8"
+lvcreate -aey -Zn -Wn -L20 --type mirror --regionsize 4k -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0-8"
check mirror $vg $lv1
check mirror_legs $vg $lv1 2
--
2.35.3

BIN
LVM2.2.03.22.tgz (Stored with Git LFS) Normal file

Binary file not shown.

16
LVM2.2.03.22.tgz.asc Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1QGkeEQK4v0TChvouREkMeUJA58FAmTKUZsACgkQuREkMeUJ
A5+Z1A//eTi65tos1se3+iivR+K1soXQLagU3WdwgOUbPu5amjipNZ6iMWCuGLOH
XleuHRGQb0ytnkRwlUeYgUkcaFqbofH9FmY5Hugp20BE+8P3bfeAX5a5ApsoU0wF
fY+XlSyuq3waFAM7XadxTgiOqWNT4Y+CnO3IUfAlkupOZi2h+00U8FlroIZdLqKR
919CpIyh9obPxvvQeE30vNQVA8jUazG7pkq9J/bVFf4ZYqJ1AieDFQ05dqAvdO4e
I8A/0Hc6n5OZBgbK1eX8EvpYuQOd5YYVFtsLoYzCl6Q1AZ5hviddifqxwnSHyPX7
iXt82ppRBIEO500QK/R+6ZAu1qF7S5ZVQMvWuSQM4hYwxJfipFaWDljpS2Gc8x8h
YIB7BSbNJMFu1Qf1iE/I8yqTt7x+Q/zL8paat5P5ZpsD//tG/CAWyfcml7ieTGDY
yoMuIY8GzAFYYzSWtubQEJx75E757cexOeZu5oiDfjSU6JxYFzoNWoF79NUVzTgU
bscvzWnibIjGpDoSD6aCjjmmNbbpnSALjUdKnUlt+KDR72u66KDssTQOpbg/W17T
Ghxe+I0kF8FObSD9T7CockCx81dqS7lrq8jLkMmAk9TKzr4OPi8mMjCMqGha+swg
Z/Sy/z/V7BAdknyRvg4ZQKxrA+9rRizt/xMlgpnRY8nvk+8VgYw=
=yBW6
-----END PGP SIGNATURE-----

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>devicemapper</package>
<package>lockd</package>
</multibuild>

7
baselibs.conf Normal file
View File

@ -0,0 +1,7 @@
libdevmapper1_03
conflicts "device-mapper-<targettype> < <version>"
libdevmapper-event1_03
conflicts "device-mapper-<targettype> < <version>"
device-mapper-devel
requires "libdevmapper1_03-<targettype> = <version>"
requires "libdevmapper-event1_03-<targettype> = <version>"

View File

@ -0,0 +1,66 @@
From 5633a8ad6522f0f1340ef35c2f3943a3b20cc200 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 4 Jan 2017 14:20:53 +1100
Subject: [PATCH] Simplify special-case for md in 69-dm-lvm.rules.in
This special casing brings little value. It appears to attempt to
determine if the array is active yet or not, and to skip
processing if the array has not yet been started.
However, if the array hasn't been started, then "blkid" will
not have been able to read a signature, so:
ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member", GOTO="lvm_end"
will have caused all this code to be skipped.
Further, this code causes incorrect behaviour in at least one case.
It assumes that the first "add" event should be ignored, as it will be
followed by a "change" event which indicates the array coming on line.
This is consistent with how the kernel sends events, but not always
consistent with how this script sees event.
Specifically: if the initrd has "mdadm" support installed, but not
"lvm2" support, then the initial "add" and "change" events will
happen while the initrd is in charge and this file is not available.
Once the root filesystem is mountd, this file will be available
and "udevadm trigger --action=add" will be run.
So the first and only event seen by this script for an md device will be
"add", and it will incorrectly ignore it.
So replace the special handling with code that simply jumps to lvm_scan
on any 'add' or 'change' event.
Signed-off-by: NeilBrown <neilb@suse.com>
2023-09-18:
udev/69-dm-lvm-metadata.rules was removed in v2_03_09 and 69-dm-lvm.rules.in
should be modified instead. The subject of this patch should be modified too.
NOTE: the updated patch may let shell/duplicate-pvs-md0.sh fail because
we change timing of lvm_scan in the rule file.
Signed-off-by: Glass Su <glass.su@suse.com>
---
udev/69-dm-lvm.rules.in | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 3ec50a5cb878..45fdad444562 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -35,12 +35,11 @@ ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
GOTO="lvm_end"
# MD device:
+# Need to scan on both 'add' and 'change'
LABEL="next"
KERNEL!="md[0-9]*", GOTO="next"
-IMPORT{db}="LVM_MD_PV_ACTIVATED"
-ACTION=="add", ENV{LVM_MD_PV_ACTIVATED}=="1", GOTO="lvm_scan"
-ACTION=="change", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1", GOTO="lvm_scan"
-ACTION=="add", KERNEL=="md[0-9]*p[0-9]*", GOTO="lvm_scan"
+ACTION=="add", GOTO="lvm_scan"
+ACTION=="change", GOTO="lvm_scan"
GOTO="lvm_end"
# Loop device:
--
2.42.0

View File

@ -0,0 +1,47 @@
From 6cfd57627c7c8b1aee4cf8164d88e206660bf753 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Tue, 4 Jul 2017 20:11:17 +0800
Subject: [PATCH] build: skip compliling daemons/lvmlockd directory
bsc#1037309
Signed-off-by: Eric Ren <zren@suse.com>
---
configure | 3 ++-
daemons/Makefile.in | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 0bb5b3dbc6ca..ea657178076b 100755
--- a/configure
+++ b/configure
@@ -12023,7 +12023,8 @@ fi
printf "%s\n" "$BUILD_LVMPOLLD" >&6; }
################################################################################
-BUILD_LVMLOCKD=no
+#BUILD_LVMLOCKD=no
+BUILD_LVMLOCKD=yes
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build lvmlockdsanlock" >&5
printf %s "checking whether to build lvmlockdsanlock... " >&6; }
diff --git a/daemons/Makefile.in b/daemons/Makefile.in
index e548b1556478..642d839c046f 100644
--- a/daemons/Makefile.in
+++ b/daemons/Makefile.in
@@ -32,9 +32,9 @@ ifeq ("@BUILD_LVMPOLLD@", "yes")
SUBDIRS += lvmpolld
endif
-ifeq ("@BUILD_LVMLOCKD@", "yes")
- SUBDIRS += lvmlockd
-endif
+#ifeq ("@BUILD_LVMLOCKD@", "yes")
+# SUBDIRS += lvmlockd
+#endif
ifeq ("@BUILD_LVMDBUSD@", "yes")
SUBDIRS += lvmdbusd
--
2.42.0

View File

@ -0,0 +1,12 @@
diff --git a/test/Makefile.in b/test/Makefile.in
index 20e97ebd0f4d..d4d3ce9f6dc7 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -31,6 +31,7 @@ LVM_TEST_RESULTS ?= results
SOURCES := lib/not.c lib/harness.c lib/dmsecuretest.c
CXXSOURCES := lib/runner.cpp
CXXFLAGS += $(EXTRA_EXEC_CFLAGS)
+LDFLAGS += -pie
CLEAN_DIRS += dbus/__pycache__ $(LVM_TEST_RESULTS)
ifneq (.,$(firstword $(srcdir)))

View File

@ -0,0 +1,46 @@
From 6ebef9ad80ee156285a61d413b5265de9c0aa2ae Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 21 Apr 2021 11:17:36 +0800
Subject: [PATCH] Add "nolvm" for kernel cmdline
This patch is inspried by multipath patch cd3184e107c8 ("Add
support for "multipath=off" and "nompath" on kernel cmdline")
This new item for disabling lvm2 startup from kernel command
line. One of usecases is in rescue mode, disabling lvm2 will
allow user to enable lvm2 devices by manual.
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
2023-09-07:
The file udev/69-dm-lvm-metad.rules.in has been removed since v2_03_19.
So remove the change of above file.
Signed-off-by: Glass Su <glass.su@suse.com>
---
diff -Nupr a/scripts/lvm2-pvscan.service.in b/scripts/lvm2-pvscan.service.in
--- a/scripts/lvm2-pvscan.service.in 2022-09-02 14:05:03.706825230 +0800
+++ b/scripts/lvm2-pvscan.service.in 2022-09-02 14:04:09.115063287 +0800
@@ -7,6 +7,7 @@ BindsTo=dev-block-%i.device
After=multipathd.service
Before=shutdown.target
Conflicts=shutdown.target
+ConditionKernelCommandLine=!nolvm
[Service]
Type=oneshot
diff -Nupr a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
--- a/udev/69-dm-lvm.rules.in 2022-09-02 14:04:51.074880312 +0800
+++ b/udev/69-dm-lvm.rules.in 2022-09-02 14:07:19.978230990 +0800
@@ -10,6 +10,9 @@ SUBSYSTEM!="block", GOTO="lvm_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
+IMPORT{cmdline}="nolvm"
+ENV{nolvm}=="?*", GOTO="lvm_end"
+
# Only process devices already marked as a PV - this requires blkid to be called before.
ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"

View File

@ -0,0 +1,20 @@
From: Heming Zhao <heming.zhao@suse.com>
Date: Sun, 20 Aug 2023 11:41:00 +0800
This patch is for 'bsc#1214071 - blkdeactivate calls wrong mountpoint cmd'.
Current 12sp5, 15sp2, 15sp3, 15sp4 & 15sp5 need to fix.
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
diff -Nupr a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
--- a/scripts/blkdeactivate.sh.in 2023-08-20 10:23:36.744082346 +0800
+++ b/scripts/blkdeactivate.sh.in 2023-08-20 10:23:59.544161133 +0800
@@ -35,7 +35,7 @@ DEV_DIR="/dev"
SYS_BLK_DIR="/sys/block"
MDADM="/sbin/mdadm"
-MOUNTPOINT="/bin/mountpoint"
+MOUNTPOINT="/usr/bin/mountpoint"
MPATHD="/sbin/multipathd"
UMOUNT="/bin/umount"
VDO="/bin/vdo"

View File

@ -0,0 +1,36 @@
From d5246ee0d534677439cf4af780422fbb2c9068b2 Mon Sep 17 00:00:00 2001
From: Liuhua Wang <lwang@suse.com>
Date: Thu, 9 Jul 2015 15:44:20 +0800
Subject: [PATCH] dmeventd: fix dso name wrong compare
dso_name is thought as not empty and doesn't create monitor thread,
because lvm sets empty dso_name with "-".
Signed-off-by: Liuhua Wang <lwang@suse.com>
References: bnc#935623
---
daemons/dmeventd/dmeventd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git LVM2.2.02.120.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.120/daemons/dmeventd/dmeventd.c
index e8d1e3b..3b1952c 100644
--- LVM2.2.02.120.orig/daemons/dmeventd/dmeventd.c
+++ LVM2.2.02.120/daemons/dmeventd/dmeventd.c
@@ -1218,12 +1218,12 @@ static int _want_registered_device(char *dso_name, char *device_uuid,
struct thread_status *thread)
{
/* If DSO names and device paths are equal. */
- if (dso_name && device_uuid)
+ if (dso_name && strcmp(dso_name, "-") && device_uuid)
return !strcmp(dso_name, thread->dso_data->dso_name) &&
!strcmp(device_uuid, thread->device.uuid);
/* If DSO names are equal. */
- if (dso_name)
+ if (dso_name && strcmp(dso_name, "-"))
return !strcmp(dso_name, thread->dso_data->dso_name);
/* If device paths are equal. */
--
1.8.4.5

View File

@ -0,0 +1,23 @@
From 0da043466ace27eb483114c87ce81feaf00ed682 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Thu, 6 Apr 2017 11:22:30 +0800
Subject: [PATCH] systemd service: make pvscan service after multipathd
bsc#998893
Signed-off-by: Eric Ren <zren@suse.com>
2020-05-13:
lvm2-lvmetad had been removed, so this patch was modified too.
Signed-off-by: Heming zhao <heming.zhao@suse.com>
---
diff -Nupr a/scripts/lvm2-pvscan.service.in b/scripts/lvm2-pvscan.service.in
--- a/scripts/lvm2-pvscan.service.in 2020-05-13 11:28:58.290210992 +0800
+++ b/scripts/lvm2-pvscan.service.in 2020-05-13 11:29:42.997788967 +0800
@@ -4,6 +4,7 @@ Documentation=man:pvscan(8)
DefaultDependencies=no
StartLimitIntervalSec=0
BindsTo=dev-block-%i.device
+After=multipathd.service
Before=shutdown.target
Conflicts=shutdown.target

View File

@ -0,0 +1,16 @@
cmirrord: Do not compile in Data and Time to avoid build retriggering in obs
Signed-off-by: Thomas Renninger <trenn@suse.de>
Index: LVM2.2.02.139/daemons/cmirrord/clogd.c
===================================================================
--- LVM2.2.02.139.orig/daemons/cmirrord/clogd.c
+++ LVM2.2.02.139/daemons/cmirrord/clogd.c
@@ -78,7 +78,6 @@ int main(int argc, char *argv[])
kill(getppid(), SIGTERM);
LOG_PRINT("Starting cmirrord:");
- LOG_PRINT(" Built: "__DATE__" "__TIME__"\n");
LOG_DBG(" Compiled with debugging.");
while (!exit_now) {

View File

@ -0,0 +1,56 @@
---
lib/config/config_settings.h | 3 +++
lib/config/defaults.h | 1 +
lib/display/display.c | 13 +++++++++----
3 files changed, 13 insertions(+), 4 deletions(-)
Index: LVM2.2.02.170/lib/config/config_settings.h
===================================================================
--- LVM2.2.02.170.orig/lib/config/config_settings.h
+++ LVM2.2.02.170/lib/config/config_settings.h
@@ -1039,6 +1039,9 @@ cfg(global_fsadm_executable_CFG, "fsadm_
"The full path to the fsadm command.\n"
"LVM uses this command to help with lvresize -r operations.\n")
+cfg(global_display_dm_name_for_lv_name_CFG, "display_dm_name_for_lv_name", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME, vsn(2, 2, 98), NULL, 0, NULL,
+ "Display dm name for lv name.\n")
+
cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL, 0, NULL,
"The method LVM uses to set the local system ID.\n"
"Volume Groups can also be given a system ID (by vgcreate, vgchange,\n"
Index: LVM2.2.02.170/lib/config/defaults.h
===================================================================
--- LVM2.2.02.170.orig/lib/config/defaults.h
+++ LVM2.2.02.170/lib/config/defaults.h
@@ -33,6 +33,7 @@
#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 0
#define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none"
#define DEFAULT_SYSFS_SCAN 1
+#define DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME 0
#define DEFAULT_MD_COMPONENT_DETECTION 1
#define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
Index: LVM2.2.02.170/lib/display/display.c
===================================================================
--- LVM2.2.02.170.orig/lib/display/display.c
+++ LVM2.2.02.170/lib/display/display.c
@@ -413,10 +413,15 @@ int lvdisplay_full(struct cmd_context *c
lv->vg->cmd->dev_dir, lv->vg->name, lv->name);
else if (lv_is_visible(lv)) {
/* Thin pool does not have /dev/vg/name link */
- if (!lv_is_thin_pool(lv))
- log_print("LV Path %s%s/%s",
- lv->vg->cmd->dev_dir,
- lv->vg->name, lv->name);
+ if (!lv_is_thin_pool(lv)) {
+ if (find_config_tree_bool(cmd, global_display_dm_name_for_lv_name_CFG, NULL)) {
+ log_print("LV Path %smapper/%s-%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ } else {
+ log_print("LV Path %s%s/%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ }
+ }
log_print("LV Name %s", lv->name);
} else
log_print("Internal LV Name %s", lv->name);

View File

@ -0,0 +1,191 @@
From 29562a0f53dad77d5d62f5d8b3bf29401d619867 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:34:27 +0800
Subject: [PATCH 1/3] fsadm: add support to resize & check btrfs filesystem
To: lvm-devel@redhat.com,
zkabelac@redhat.com,
teigland@redhat.com
resize:
btrfs volume may spanning across multiple block devices. resize action should
specific subvolume to not to break the filesystem on LV about to get resized
with lvresize.
this patch finds the mount point first and resizes the filesystem after
getting the device id since there are maybe several devices underneath btrfs
filesystem
check:
check the data integrity.
this patch mounts the device first and then runs `btrfs filesystem scrub
start -B` command
refer legacy patches:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00052.html
- Lidong Zhong <lzhong@suse.com>
https://listman.redhat.com/archives/lvm-devel/2015-March/msg00053.html
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
scripts/fsadm.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 86 insertions(+), 2 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 9ae422f55edf..a7345c503f77 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -22,6 +22,7 @@
# ext2/ext3/ext4: resize2fs, tune2fs
# reiserfs: resize_reiserfs, reiserfstune
# xfs: xfs_growfs, xfs_info
+# btrfs: btrfs
#
# Return values:
# 0 success
@@ -59,6 +60,7 @@ XFS_CHECK="xfs_check"
# XFS_REPAIR -n is used when XFS_CHECK is not found
XFS_REPAIR="xfs_repair"
CRYPTSETUP="cryptsetup"
+BTRFS="btrfs"
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY:-lvm}
@@ -78,6 +80,9 @@ BLOCKCOUNT=
MOUNTPOINT=
MOUNTED=
REMOUNT=
+FINDMNT=
+UUID=
+BTRFS_DEVID=
PROCDIR="/proc"
PROCMOUNTS="$PROCDIR/mounts"
PROCSELFMOUNTINFO="$PROCDIR/self/mountinfo"
@@ -237,6 +242,33 @@ detect_fs() {
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\"."
}
+check_findmnt() {
+ FINDMNT=$(which findmnt 2>$NULL)
+ test -n "$FINDMNT"
+}
+
+detect_fs_uuid() {
+ UUID=$($BLKID -o value -c $NULL -s UUID "$VOLUME" 2>$NULL)
+ test -n "$UUID"
+}
+
+#find the mountpoint of this device
+detect_mounted_findmnt() {
+ local TMP
+ local STR_IFS=$IFS
+ IFS=" $(echo -n -e '\t')"
+
+ read -r TMP<<EOF
+$($FINDMNT -nuP -o TARGET,UUID 2>$NULL | $GREP "$UUID")
+EOF
+
+ TMP=${TMP##*TARGET=\"}
+ TMP=${TMP%%\"*}
+ MOUNTED=$TMP
+ test -n "$MOUNTED"
+
+ IFS=$STR_IFS
+}
# Check that passed mounted MAJOR:MINOR is not matching $MAJOR:MINOR of resized $VOLUME
validate_mounted_major_minor() {
@@ -365,7 +397,11 @@ detect_mounted_with_proc_mounts() {
# check if the given device is already mounted and where
# FIXME: resolve swap usage and device stacking
detect_mounted() {
- if test -e "$PROCSELFMOUNTINFO"; then
+ if test "$FSTYPE" = "btrfs" ; then
+ check_findmnt || error "Need 'findmnt' utility to work with btrfs filesystem"
+ detect_fs_uuid || verbose "Can't get fs UUID from \"$VOLUME\" volume"
+ detect_mounted_findmnt
+ elif test -e "$PROCSELFMOUNTINFO"; then
detect_mounted_with_proc_self_mountinfo
elif test -e "$PROCMOUNTS"; then
detect_mounted_with_proc_mounts
@@ -662,6 +698,47 @@ resize_crypt() {
dry "$CRYPTSETUP" resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
}
+########################
+# Resize btrfs filesystem
+# - mounted for upsize/downsize
+# - cannot resize when unmounted
+########################
+resize_btrfs() {
+ detect_mounted
+ MOUNTPOINT=$MOUNTED
+ if [ -z "$MOUNTED" ]; then
+ MOUNTPOINT=$TEMPDIR
+ temp_mount || error "Cannot mount Btrfs filesystem"
+ fi
+
+ verbose "Parsing $BTRFS filesystem show \"$MOUNTPOINT\""
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
+ case "$i" in
+ *"$VOLUME") BTRFS_DEVID=${i##*devid};;
+ esac
+ done
+
+ # If dev doesn't locate in "/dev", 'btrfs filesystem show' will mistakely
+ # report path. Below is a work around to get correct lvm dev path.
+ if [ -z "$BTRFS_DEVID" ];then
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
+ case "$i" in
+ *" path "*)
+ path_str=${i##*path}
+ path_str=$(echo $path_str|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
+ result=$(echo $VOLUME | grep -E "${path_str}$")
+ test -n "$result" && BTRFS_DEVID=${i##*devid}
+ ;;
+ esac
+ done
+ fi
+ BTRFS_DEVID=${BTRFS_DEVID%%size*}
+ BTRFS_DEVID=$(echo $BTRFS_DEVID|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
+ decode_size $1 1
+ verbose "Resizing filesystem on device \"$VOLUME\" to $NEWSIZE bytes(btrfs devid: $BTRFS_DEVID) "
+ dry "$BTRFS" filesystem resize "$BTRFS_DEVID":"$NEWSIZE" "$MOUNTPOINT"
+}
+
####################
# Resize filesystem
####################
@@ -685,6 +762,7 @@ resize() {
"crypto_LUKS")
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
CMD=resize_luks ;;
+ "btrfs") CMD=resize_btrfs ;;
*) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
esac
@@ -762,6 +840,12 @@ check() {
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required."
check_luks || error "Crypto luks check failed."
;;
+ "btrfs") #mount the device first and then run scrub
+ MOUNTPOINT=$TEMPDIR
+ temp_mount || error "Cannot mount btrfs filesystem"
+ dry "$BTRFS" scrub start -B "$VOLUME"
+ test "$MOUNTPOINT" = "$TEMPDIR" && MOUNTPOINT="" temp_umount
+ ;;
*)
error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
esac
@@ -780,7 +864,7 @@ test -n "${FSADM_RUNNING-}" && exit 0
for i in "$TUNE_EXT" "$RESIZE_EXT" "$TUNE_REISER" "$RESIZE_REISER" \
"$TUNE_XFS" "$RESIZE_XFS" "$MOUNT" "$UMOUNT" "$MKDIR" \
"$RMDIR" "$BLOCKDEV" "$BLKID" "$GREP" "$READLINK" \
- "$DATE" "$FSCK" "$XFS_CHECK" "$XFS_REPAIR" "$LVM" ; do
+ "$DATE" "$FSCK" "$XFS_CHECK" "$XFS_REPAIR" "$LVM" "$BTRFS" ; do
test -n "$i" || error "Required command definitions in the script are missing!"
done
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 34c04711e6c2a926b335c746643da7d4b5bba33e Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:39:10 +0800
Subject: [PATCH 2/3] man: add support for btrfs
To: lvm-devel@redhat.com,
zkabelac@redhat.com,
teigland@redhat.com
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
man/fsadm.8_main | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/man/fsadm.8_main b/man/fsadm.8_main
index dfff5bb97021..ad924ac3a304 100644
--- a/man/fsadm.8_main
+++ b/man/fsadm.8_main
@@ -31,6 +31,7 @@ It tries to use the same API for
.BR ext2 ,
.BR ext3 ,
.BR ext4 ,
+.BR btrfs ,
.BR ReiserFS
and
.BR XFS
@@ -119,6 +120,9 @@ Defaults to "\fI/dev\fP" and must be an absolute path.
.BR tune2fs (8),
.BR resize2fs (8),
.P
+.BR btrfs (8),
+.BR btrfs-scrub (8),
+.P
.BR reiserfstune (8),
.BR resize_reiserfs (8),
.P
--
1.8.3.1

View File

@ -0,0 +1,205 @@
From 24ec9af4513890b2ab1a6f3683e8aba007a3c983 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:41:42 +0800
Subject: [PATCH] tests: new test suite of fsadm for btrfs
refer legacy patche:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00055.html
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
2023-09-08:
LVs should be resized to 64M after each test.
Signed-off-by: Su Yue <glass.su@suse.com>
---
test/shell/fsadm-btrfs.sh | 176 ++++++++++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 test/shell/fsadm-btrfs.sh
diff --git a/test/shell/fsadm-btrfs.sh b/test/shell/fsadm-btrfs.sh
new file mode 100644
index 000000000000..c1b65036efb2
--- /dev/null
+++ b/test/shell/fsadm-btrfs.sh
@@ -0,0 +1,176 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+test_description='Exercise fsadm btrfs resize'
+
+. lib/inittest
+
+aux prepare_vg 1 1024
+
+# set to "skip" to avoid testing given fs and test warning result
+# i.e. check_btrfs=skip
+check_btrfs=
+
+which mkfs.btrfs || check_btrfs=${check_btrfs:-mkfs.btrfs}
+which btrfs || check_btrfs=${check_btrfs:-btrfs}
+
+vg_lv=$vg/$lv1
+vg_lv2=$vg/${lv1}bar
+vg_lv3=$vg/${lv1}bar2
+dev_vg_lv="$DM_DEV_DIR/$vg_lv"
+dev_vg_lv2="$DM_DEV_DIR/$vg_lv2"
+dev_vg_lv3="$DM_DEV_DIR/$vg_lv3"
+mount_dir="mnt"
+mount_space_dir="mnt space dir"
+# for recursive call
+export LVM_BINARY=$(which lvm)
+
+test ! -d "$mount_dir" && mkdir "$mount_dir"
+test ! -d "$mount_space_dir" && mkdir "$mount_space_dir"
+
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ umount "$mount_space_dir" || true
+ aux teardown
+}
+
+reset_lvs()
+{
+ # Since we call mkfs.btrfs with '-f', lvreduce to 64M is enough
+ lvreduce -L64M -nf $vg_lv || true
+ lvreduce -L64M -nf $vg_lv2 || true
+ lvreduce -L64M -nf $vg_lv3 || true
+}
+
+check_missing_btrfs()
+{
+ eval local t=$check_btrfs
+ test -z "$t" && return 0
+ test "$t" = skip && return 1
+ # trick for warning test
+ echo "WARNING: fsadm test skipped btrfs tests, $t tool is missing"
+ return 1
+}
+
+fscheck_btrfs() {
+ btrfsck "$1"
+}
+scrub_btrfs() {
+ btrfs scrub start -B "$1"
+}
+
+# btrfs minimal size calculation is complex, we use 64M here.
+lvcreate -n $lv1 -L64M $vg
+lvcreate -n ${lv1}bar -L64M $vg
+lvcreate -n ${lv1}bar2 -L64M $vg
+trap 'cleanup_mounted_and_teardown' EXIT
+
+single_device_test() {
+ mkfs.btrfs -m single "$dev_vg_lv"
+ mkfs.btrfs -m single "$dev_vg_lv2"
+
+ # kernel limits 256 MB as minimal btrfs resizable size
+ # you can grow fs from 30MB->256MB
+ # but you can't grow from 30MB->180MB
+ fsadm --lvresize resize $vg_lv 256M
+ fsadm --lvresize resize $vg_lv2 256M
+
+ not fsadm -y --lvresize resize $vg_lv 200M
+ lvresize -L+10M -r $vg_lv
+ lvreduce -L256M -r $vg_lv
+ fscheck_btrfs $dev_vg_lv
+
+ mount "$dev_vg_lv" "$mount_dir"
+ mount "$dev_vg_lv2" "$mount_space_dir"
+
+ not fsadm -y --lvresize resize $vg_lv 200M
+ lvresize -L+10M -r $vg_lv
+ lvreduce -L256M -r $vg_lv
+ scrub_btrfs $dev_vg_lv
+ umount "$mount_dir"
+
+ not fsadm -y --lvresize resize $vg_lv2 200M
+ lvresize -L+10M -r $vg_lv2
+ lvreduce -L256M -r $vg_lv2
+ scrub_btrfs $dev_vg_lv2
+ umount "$mount_space_dir"
+}
+
+multiple_devices_test() {
+ mkfs.btrfs -m single -d single -f "$dev_vg_lv" "$dev_vg_lv2" "$dev_vg_lv3"
+
+ fsadm -y --lvresize resize $vg_lv 256M
+ fsadm -y --lvresize resize $vg_lv2 256M
+ fsadm -y --lvresize resize $vg_lv3 256M
+
+ # check if fsadm is able to get/resize btrfs on
+ # the right device
+ lvresize -L+150M $vg_lv
+ fsadm -y resize $vg_lv 300M
+ # no space to extend, so failed
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ lvreduce -y -L256M -r $vg_lv
+
+ lvresize -L+150M $vg_lv2
+ fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv2
+
+ lvresize -L+150M $vg_lv3
+ fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv3
+ fscheck_btrfs $dev_vg_lv
+
+ # repeat with mounted fs
+ mount "$dev_vg_lv" "$mount_dir"
+ mount "$dev_vg_lv2" "$mount_space_dir"
+
+ lvresize -L300M $vg_lv
+ fsadm -y resize $vg_lv 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ lvreduce -y -L256M -r $vg_lv
+
+ lvresize -L300M $vg_lv2
+ fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv2
+
+ lvresize -L300M $vg_lv3
+ fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv3
+
+ scrub_btrfs $dev_vg_lv
+ umount "$mount_dir"
+ umount "$mount_space_dir"
+
+ lvresize -nf -L300M $vg_lv
+ lvresize -nf -L300M $vg_lv2
+}
+
+if check_missing_btrfs; then
+
+ single_device_test
+ # after each test, reset_lv_size should be called to make sure
+ # all lvs are in same state/size.
+ reset_lvs
+ multiple_devices_test
+fi
+
+vgremove -ff $vg
--
2.35.3

2465
lvm.conf Normal file

File diff suppressed because it is too large Load Diff

1
lvm2-rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter(r'^lvm2-testsuite')

3208
lvm2.changes Normal file

File diff suppressed because it is too large Load Diff

819
lvm2.spec Normal file
View File

@ -0,0 +1,819 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _unpackaged_files_terminate_build 0
%define libname libdevmapper1_03
%define libname_event libdevmapper-event1_03
%define _udevdir %(pkg-config --variable=udevdir udev)
%define cmdlib liblvm2cmd2_03
%define lvm2_version 2.03.22
# For device_mapper_version, it's package version, see bsc#1199074.
# Also note there is another dm version on below "sed -ie ... VERSION_DM".
%define upstream_device_mapper_version 1.02.196
%define device_mapper_version %{lvm2_version}_1.02.196
%define thin_provisioning_version 0.7.0
%define _supportsanlock 1
%define dlm_version 4.0.9
# from lvm2 version 2.03, suse obsoleted clvm, cmirrord, liblvm2app & liblvm2cmd.
# so the obseletes version is 2.03
%define lvm2_clvm_version 2.03
%define lvm2_cmirrord_version 2.03
%define liblvm2app2_2_version 2.03
%define liblvm2cmd2_02_version 2.03
%if 0%{_supportsanlock} == 1
%define sanlock_version 3.3.0
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%define psuffix %{nil}
%if "%{flavor}" == "devicemapper"
%define psuffix -device-mapper
%bcond_without devicemapper
%else
%bcond_with devicemapper
%endif
%if "%{flavor}" == "lockd"
%define psuffix -lvmlockd
%bcond_without lockd
%else
%bcond_with lockd
%endif
Name: lvm2%{psuffix}
Version: %{lvm2_version}
Release: 0
Summary: Logical Volume Manager Tools
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Base
URL: https://www.sourceware.org/lvm2/
Source: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz
Source1: lvm.conf
Source2: lvm2-rpmlintrc
Source42: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz.asc
Source99: baselibs.conf
# Upstream patches
Patch0001: 0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch
Patch0002: 0002-lvconvert-fix-ret-values-fro-integrity-remove.patch
Patch0003: 0003-lvconvert-fix-regresion-from-integrity-check.patch
Patch0004: 0004-gcc-cleanup-warnings.patch
Patch0005: 0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch
Patch0006: 0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch
Patch0007: 0007-lvmlockd-fix-lvconvert-to-thin-pool.patch
Patch0008: 0008-lvconvert-run-error-path-code-only-for-shared-VG.patch
Patch0009: 0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch
Patch0010: 0010-lvmlockd-client-mutex-ordering.patch
Patch0011: 0011-filesystem-move-stat-after-open-check.patch
Patch0012: 0012-tests-check-for-writecache.patch
Patch0013: 0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch
Patch0014: 0014-gcc-fix-warnings-for-x32-architecture.patch
Patch0015: 0015-gcc-warning-missing-braces-around-initializer.patch
Patch0016: 0016-test-improve-aux-teardown.patch
Patch0017: 0017-tests-aux-try-with-extra-sleep.patch
Patch0018: 0018-tests-aux-using-singl-lvmconf-call.patch
Patch0019: 0019-tests-missing-to-check-for-writecache-support.patch
Patch0020: 0020-tests-pvmove-large-disk-area.patch
Patch0021: 0021-tests-enforce-full-fs-check.patch
Patch0022: 0022-tests-update-for-work-in-fake-dev-environment.patch
Patch0023: 0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch
Patch0024: 0024-tests-better-slowdown.patch
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1004: bug-998893_make_pvscan_service_after_multipathd.patch
Patch1005: bug-1184687_Add-nolvm-for-kernel-cmdline.patch
Patch1006: fate-31841-01_fsadm-add-support-to-resize-check-btrfs-filesystem.patch
Patch1007: fate-31841-02_man-add-support-for-btrfs.patch
Patch1008: fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
Patch1009: bug-1214071-blkdeactivate_calls_wrong_mountpoint.patch
# SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-rules.patch
# SUSE patches 3000+ for test code
Patch3001: bug-1184124-link-tests-as-PIE.patch
# SUSE patches 4000+ for lvm2.spec
Patch4001: bug-1037309_Makefile-skip-compliling-daemons-lvmlockd-directory.patch
# To detect modprobe during build
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: pkgconfig
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libudev)
Requires: device-mapper >= %{device_mapper_version}
Requires: modutils
Requires(post): coreutils
Requires(postun):coreutils
Provides: lvm = %{version}
Obsoletes: lvm2-cmirrord <= %{lvm2_cmirrord_version}
%{?systemd_requires}
%if %{with devicemapper}
BuildRequires: gcc-c++
BuildRequires: suse-module-tools
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(libsepol)
%else
BuildRequires: libcorosync-devel
BuildRequires: pkgconfig(blkid)
%if %{with lockd}
BuildRequires: libdlm-devel >= %{dlm_version}
%if 0%{_supportsanlock} == 1
BuildRequires: sanlock-devel >= %{sanlock_version}
%endif
%else
BuildRequires: gcc-c++
BuildRequires: libselinux-devel
BuildRequires: readline-devel
BuildRequires: pkgconfig(udev)
%endif
%endif
%description
Programs and man pages for configuring and using the LVM2 Logical
Volume Manager.
%prep
%setup -q -n LVM2.%{version}
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch0011 -p1
%patch0012 -p1
%patch0013 -p1
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%patch0017 -p1
%patch0018 -p1
%patch0019 -p1
%patch0020 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch2001 -p1
%patch3001 -p1
%if !%{with lockd}
%patch4001 -p1
%endif
%build
%if !%{with devicemapper} && !%{with lockd}
extra_opts="
--enable-blkid_wiping
--with-cache=internal
--with-writecache=internal
--with-integrity=internal
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--enable-fsadm
--enable-write_install
--with-vdo=internal
--with-vdo-format=%{_bindir}/vdoformat
"
%endif
%if %{with lockd}
extra_opts="
--enable-blkid_wiping
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--with-cluster=internal
--enable-lvmlockd-dlm
--enable-lvmlockd-dlmcontrol
%if 0%{_supportsanlock} == 1
--enable-lvmlockd-sanlock
%endif
"
%endif
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_sbindir}
# Why this messy fix here? someone released a wrong version...
# There will change library version to 1.03.01, see output "dmsetup --version".
sed -ie "s/%{upstream_device_mapper_version}/1.03.01/g" VERSION_DM
%configure \
--enable-dmeventd \
--enable-dmfilemapd \
--enable-lvmpolld \
--enable-cmdlib \
--enable-udev_rules \
--enable-udev_sync \
--with-udev-prefix="%{_prefix}/" \
--enable-selinux \
--enable-pkgconfig \
--with-usrlibdir=%{_libdir} \
--with-usrsbindir=%{_sbindir} \
--with-libexecdir=%{_libexecdir} \
--with-default-dm-run-dir=/run \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-thin=internal \
--with-device-gid=6 \
--with-device-mode=0640 \
--with-device-uid=0 \
--with-dmeventd-path=%{_sbindir}/dmeventd \
--with-thin-check=%{_sbindir}/thin_check \
--with-thin-dump=%{_sbindir}/thin_dump \
--with-thin-repair=%{_sbindir}/thin_repair \
--disable-silent-rules \
$extra_opts
### COMMON-CONFIG-END ###
%if %{with devicemapper}
%make_build device-mapper
%else
%make_build
%endif
%install
%if %{with devicemapper}
make DESTDIR=%{buildroot} \
install_device-mapper \
install_systemd_units
ln -s service %{buildroot}/%{_sbindir}/rcdm-event
# provide 1.02 compat links for the shared libraries
# this is needed for various binary packages
ln -s libdevmapper.so.1.03 %{buildroot}/%{_libdir}/libdevmapper.so.1.02
ln -s libdevmapper-event.so.1.03 %{buildroot}/%{_libdir}/libdevmapper-event.so.1.02
# remove blkd, will be in lvm2 proper
# without force on purpose to detect changes and fail if it happens
rm %{buildroot}%{_sbindir}/blkdeactivate
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/blkdeactivate.8
# remove files, which will be in lvm2 & lockd packages
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
rm %{buildroot}%{_unitdir}/lvmlockd.service
rm %{buildroot}%{_unitdir}/lvmlocks.service
# compat symlinks in /sbin remove with Leap 43
%if 0%{?suse_version} < 1550
mkdir -p %{buildroot}/sbin
ln -s %{_sbindir}/dmsetup %{buildroot}/sbin/dmsetup
%endif
%else
%if %{with lockd}
make DESTDIR=%{buildroot} \
install_systemd_units install_systemd_generators
make DESTDIR=%{buildroot} install -C daemons/lvmlockd
# lvmlockd does not have separate target install the mans by hand for now
install -m0644 -D man/lvmlockd.8 %{buildroot}%{_mandir}/man8/lvmlockd.8
install -m0644 -D man/lvmlockctl.8 %{buildroot}%{_mandir}/man8/lvmlockctl.8
# rc services symlinks
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlockd
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlocking
# remove files from lvm2 split due to systemd_generators picking them up
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/dm-event.service
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
%else
%make_install
make install_system_dirs DESTDIR=%{buildroot}
make install_systemd_units DESTDIR=%{buildroot}
make install_systemd_generators DESTDIR=%{buildroot}
make install_tmpfiles_configuration DESTDIR=%{buildroot}
# Install configuration file
install -m 644 %{SOURCE1} "%{buildroot}/%{_sysconfdir}/lvm/"
# Install testsuite
make -C test install DESTDIR=%{buildroot}
pushd "%{buildroot}/%{_libdir}"
ln -sf liblvm2cmd.so.2.03 liblvm2cmd.so
for i in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
ln -sf "device-mapper/$i.so" "$i.so"
ln -sf "device-mapper/$i.so" "$i.so.2.03"
done
popd
#rc compat symlinks
ln -s service %{buildroot}%{_sbindir}/rcblk-availability
ln -s service %{buildroot}%{_sbindir}/rclvm2-monitor
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmpolld
# Remove devicemapper binaries, plain rm so we fail if something change
rm %{buildroot}%{_sbindir}/dmsetup
rm %{buildroot}%{_sbindir}/dmeventd
rm %{buildroot}%{_sbindir}/dmstats
rm %{buildroot}%{_sbindir}/dmfilemapd
rm %{buildroot}%{_udevrulesdir}/10-dm.rules
rm %{buildroot}%{_udevrulesdir}/13-dm-disk.rules
rm %{buildroot}%{_udevrulesdir}/95-dm-notify.rules
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/dm-event.service
# See bsc#1037309 for more info
rm %{buildroot}%{_unitdir}/lvmlockd.service
rm %{buildroot}%{_unitdir}/lvmlocks.service
rm %{buildroot}%{_includedir}/libdevmapper*.h
rm %{buildroot}%{_libdir}/libdevmapper.so.*
rm %{buildroot}%{_libdir}/libdevmapper-event.so.*
rm %{buildroot}%{_libdir}/libdevmapper.so
rm %{buildroot}%{_libdir}/libdevmapper-event.so
rm %{buildroot}%{_libdir}/pkgconfig/devmapper*.pc
rm %{buildroot}%{_mandir}/man8/lvmlockctl.8
rm %{buildroot}%{_mandir}/man8/lvmlockd.8
rm %{buildroot}%{_mandir}/man8/dmstats.8
rm %{buildroot}%{_mandir}/man8/dmsetup.8
rm %{buildroot}%{_mandir}/man8/dmeventd.8
rm %{buildroot}%{_mandir}/man8/dmfilemapd.8
%if 0%{?suse_version} < 1550
# compat symlinks in /sbin remove with Leap 43
mkdir -p %{buildroot}/sbin
pushd %{buildroot}/%{_sbindir}
for i in {vg,pv,lv}*; do
ln -s %{_sbindir}/$i %{buildroot}/sbin/$i
done
popd
%endif
%endif
%endif
%if %{with devicemapper}
%package -n device-mapper
Version: %{device_mapper_version}
Release: 0
Summary: Device Mapper Tools
Group: System/Base
Requires: thin-provisioning-tools >= %{thin_provisioning_version}
Requires(post): coreutils
%description -n device-mapper
Programs and man pages for configuring and using the device mapper.
%pre -n device-mapper
%service_add_pre dm-event.service dm-event.socket
%post -n device-mapper
%service_add_post dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%posttrans -n device-mapper
%{?regenerate_initrd_posttrans}
%preun -n device-mapper
%service_del_preun dm-event.service dm-event.socket
%postun -n device-mapper
%service_del_postun dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%files -n device-mapper
%license COPYING COPYING.LIB
%doc README
%doc udev/12-dm-permissions.rules
%if 0%{?suse_version} < 1550
/sbin/dmsetup
%endif
%{_sbindir}/dmsetup
%{_sbindir}/dmeventd
%{_sbindir}/dmstats
%{_sbindir}/dmfilemapd
%{_mandir}/man8/dmstats.8%{?ext_man}
%{_mandir}/man8/dmsetup.8%{?ext_man}
%{_mandir}/man8/dmeventd.8%{?ext_man}
%{_mandir}/man8/dmfilemapd.8%{?ext_man}
%{_udevrulesdir}/10-dm.rules
%{_udevrulesdir}/13-dm-disk.rules
%{_udevrulesdir}/95-dm-notify.rules
%{_unitdir}/dm-event.socket
%{_sbindir}/rcdm-event
%{_unitdir}/dm-event.service
%package -n %{libname}
Version: %{device_mapper_version}
Release: 0
Summary: Library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname}
Device mapper main shared library
%files -n %{libname}
%{_libdir}/libdevmapper.so.1.03
%{_libdir}/libdevmapper.so.1.02
%post -n %{libname}
%if 0%{?suse_version} < 1550
# in usrmerged scenario we better don't remove ourselves :-)
if [ -f /%{_lib}/libdevmapper.so.1.03 ]; then
# Special migration - the library is now in %{_libdir}, but up to the point where
# zypp removes the 'old' device-mapper package, the old library 'wins' the ldloader race
# resulting in binaries asking for the newer version still getting the old one.
# This in turn results in funny bugs like boo#1045396
# Remove /%{_lib}/libdevmapper.so.1.02 - and the run ldconfig
rm /%{_lib}/libdevmapper.so.1.03
fi
%endif
/sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%package -n %{libname_event}
Version: %{device_mapper_version}
Release: 0
Summary: Event library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname_event}
Device mapper event daemon shared library
%files -n %{libname_event}
%{_libdir}/libdevmapper-event.so.1.03
%{_libdir}/libdevmapper-event.so.1.02
%post -n %{libname_event} -p /sbin/ldconfig
%postun -n %{libname_event} -p /sbin/ldconfig
%package -n device-mapper-devel
Version: %{device_mapper_version}
Release: 0
Summary: Development package for the device mapper
Group: Development/Libraries/C and C++
Requires: %{libname_event} = %{device_mapper_version}
Requires: %{libname} = %{device_mapper_version}
Requires: device-mapper = %{device_mapper_version}
%description -n device-mapper-devel
Files needed for software development using the device mapper
%files -n device-mapper-devel
%{_libdir}/libdevmapper.so
%{_libdir}/libdevmapper-event.so
%{_includedir}/libdevmapper.h
%{_includedir}/libdevmapper-event.h
%{_libdir}/pkgconfig/devmapper.pc
%{_libdir}/pkgconfig/devmapper-event.pc
%else
%if %{with lockd}
%package -n lvm2-lockd
Summary: LVM locking daemon
Group: System/Base
Requires: corosync
Requires: device-mapper >= %{device_mapper_version}
Requires: libdlm >= %{dlm_version}
Requires: lvm2 = %{version}
Obsoletes: lvm2-clvm <= %{lvm2_clvm_version}
%{?systemd_requires}
%if 0%{_supportsanlock} == 1
Requires: sanlock >= %{sanlock_version}
%endif
%description -n lvm2-lockd
LVM commands use lvmlockd to coordinate access to shared storage.
%pre -n lvm2-lockd
%service_add_pre lvmlockd.service lvmlocks.service
%post -n lvm2-lockd
%service_add_post lvmlockd.service lvmlocks.service
%preun -n lvm2-lockd
%service_del_preun lvmlockd.service lvmlocks.service
%postun -n lvm2-lockd
%service_del_postun lvmlockd.service lvmlocks.service
%files -n lvm2-lockd
%defattr(-,root,root,)
%{_sbindir}/lvmlockd
%{_sbindir}/lvmlockctl
%{_mandir}/man8/lvmlockd.8%{?ext_man}
%{_mandir}/man8/lvmlockctl.8%{?ext_man}
%{_unitdir}/lvmlockd.service
%{_unitdir}/lvmlocks.service
%{_sbindir}/rclvm2-lvmlockd
%{_sbindir}/rclvm2-lvmlocking
%else
%pre
%service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%post
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
# Use %%tmpfiles_create when 13.2 is oldest in support scope
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/lvm2.conf || :
%posttrans
%{?regenerate_initrd_posttrans}
%preun
%service_del_preun blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%postun
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_del_postun lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_del_postun_without_restart blk-availability.service lvm2-monitor.service
%files
%license COPYING COPYING.LIB
%doc README VERSION WHATS_NEW
%doc doc/lvm_fault_handling.txt
# Main binaries
%{_sbindir}/blkdeactivate
%{_sbindir}/fsadm
%{_libexecdir}/lvresize_fs_helper
%{_sbindir}/lvm
%{_sbindir}/lvmconfig
%{_sbindir}/lvmdevices
%{_sbindir}/lvmdump
%{_sbindir}/lvmpolld
%{_sbindir}/lvm_import_vdo
%{_sbindir}/lvchange
%{_sbindir}/lvconvert
%{_sbindir}/lvcreate
%{_sbindir}/lvdisplay
%{_sbindir}/lvextend
%{_sbindir}/lvmdiskscan
%{_sbindir}/lvmsadc
%{_sbindir}/lvmsar
%{_sbindir}/lvreduce
%{_sbindir}/lvremove
%{_sbindir}/lvrename
%{_sbindir}/lvresize
%{_sbindir}/lvs
%{_sbindir}/lvscan
%{_sbindir}/pvchange
%{_sbindir}/pvck
%{_sbindir}/pvcreate
%{_sbindir}/pvdisplay
%{_sbindir}/pvmove
%{_sbindir}/pvremove
%{_sbindir}/pvresize
%{_sbindir}/pvs
%{_sbindir}/pvscan
%{_sbindir}/vgcfgbackup
%{_sbindir}/vgcfgrestore
%{_sbindir}/vgchange
%{_sbindir}/vgck
%{_sbindir}/vgconvert
%{_sbindir}/vgcreate
%{_sbindir}/vgdisplay
%{_sbindir}/vgexport
%{_sbindir}/vgextend
%{_sbindir}/vgimport
%{_sbindir}/vgimportclone
%{_sbindir}/vgimportdevices
%{_sbindir}/vgmerge
%{_sbindir}/vgmknodes
%{_sbindir}/vgreduce
%{_sbindir}/vgremove
%{_sbindir}/vgrename
%{_sbindir}/vgs
%{_sbindir}/vgscan
%{_sbindir}/vgsplit
%{_sbindir}/rcblk-availability
%{_sbindir}/rclvm2-lvmpolld
%{_sbindir}/rclvm2-monitor
# compat symlinks in /sbin
%if 0%{?suse_version} < 1550
/sbin/lvm
/sbin/lvmconfig
/sbin/lvmdevices
/sbin/lvmdump
/sbin/lvmpolld
/sbin/lvm_import_vdo
/sbin/lvchange
/sbin/lvconvert
/sbin/lvcreate
/sbin/lvdisplay
/sbin/lvextend
/sbin/lvmdiskscan
/sbin/lvmsadc
/sbin/lvmsar
/sbin/lvreduce
/sbin/lvremove
/sbin/lvrename
/sbin/lvresize
/sbin/lvs
/sbin/lvscan
/sbin/pvchange
/sbin/pvck
/sbin/pvcreate
/sbin/pvdisplay
/sbin/pvmove
/sbin/pvremove
/sbin/pvresize
/sbin/pvs
/sbin/pvscan
/sbin/vgcfgbackup
/sbin/vgcfgrestore
/sbin/vgchange
/sbin/vgck
/sbin/vgconvert
/sbin/vgcreate
/sbin/vgdisplay
/sbin/vgexport
/sbin/vgextend
/sbin/vgimport
/sbin/vgimportclone
/sbin/vgimportdevices
/sbin/vgmerge
/sbin/vgmknodes
/sbin/vgreduce
/sbin/vgremove
/sbin/vgrename
/sbin/vgs
/sbin/vgscan
/sbin/vgsplit
%endif
%{_mandir}/man5/lvm.conf.5%{?ext_man}
%{_mandir}/man7/lvmautoactivation.7%{?ext_man}
%{_mandir}/man7/lvmcache.7%{?ext_man}
%{_mandir}/man7/lvmraid.7%{?ext_man}
%{_mandir}/man7/lvmreport.7%{?ext_man}
%{_mandir}/man7/lvmthin.7%{?ext_man}
%{_mandir}/man7/lvmsystemid.7%{?ext_man}
%{_mandir}/man7/lvmvdo.7%{?ext_man}
%{_mandir}/man8/fsadm.8%{?ext_man}
%{_mandir}/man8/lvchange.8%{?ext_man}
%{_mandir}/man8/lvconvert.8%{?ext_man}
%{_mandir}/man8/lvcreate.8%{?ext_man}
%{_mandir}/man8/lvdisplay.8%{?ext_man}
%{_mandir}/man8/lvextend.8%{?ext_man}
%{_mandir}/man8/lvm.8%{?ext_man}
%{_mandir}/man8/lvm-config.8%{?ext_man}
%{_mandir}/man8/lvmconfig.8%{?ext_man}
%{_mandir}/man8/lvmdevices.8%{?ext_man}
%{_mandir}/man8/lvm-dumpconfig.8%{?ext_man}
%{_mandir}/man8/lvmdiskscan.8%{?ext_man}
%{_mandir}/man8/lvmdump.8%{?ext_man}
%{_mandir}/man8/lvm-fullreport.8%{?ext_man}
%{_mandir}/man8/lvmsadc.8%{?ext_man}
%{_mandir}/man8/lvmsar.8%{?ext_man}
%{_mandir}/man8/lvreduce.8%{?ext_man}
%{_mandir}/man8/lvremove.8%{?ext_man}
%{_mandir}/man8/lvrename.8%{?ext_man}
%{_mandir}/man8/lvresize.8%{?ext_man}
%{_mandir}/man8/lvs.8%{?ext_man}
%{_mandir}/man8/lvscan.8%{?ext_man}
%{_mandir}/man8/pvchange.8%{?ext_man}
%{_mandir}/man8/pvck.8%{?ext_man}
%{_mandir}/man8/pvcreate.8%{?ext_man}
%{_mandir}/man8/pvdisplay.8%{?ext_man}
%{_mandir}/man8/pvmove.8%{?ext_man}
%{_mandir}/man8/pvremove.8%{?ext_man}
%{_mandir}/man8/pvresize.8%{?ext_man}
%{_mandir}/man8/pvs.8%{?ext_man}
%{_mandir}/man8/pvscan.8%{?ext_man}
%{_mandir}/man8/vgcfgbackup.8%{?ext_man}
%{_mandir}/man8/vgcfgrestore.8%{?ext_man}
%{_mandir}/man8/vgchange.8%{?ext_man}
%{_mandir}/man8/vgck.8%{?ext_man}
%{_mandir}/man8/vgconvert.8%{?ext_man}
%{_mandir}/man8/vgcreate.8%{?ext_man}
%{_mandir}/man8/vgdisplay.8%{?ext_man}
%{_mandir}/man8/vgexport.8%{?ext_man}
%{_mandir}/man8/vgextend.8%{?ext_man}
%{_mandir}/man8/vgimport.8%{?ext_man}
%{_mandir}/man8/vgimportclone.8%{?ext_man}
%{_mandir}/man8/vgimportdevices.8%{?ext_man}
%{_mandir}/man8/vgmerge.8%{?ext_man}
%{_mandir}/man8/vgmknodes.8%{?ext_man}
%{_mandir}/man8/vgreduce.8%{?ext_man}
%{_mandir}/man8/vgremove.8%{?ext_man}
%{_mandir}/man8/vgrename.8%{?ext_man}
%{_mandir}/man8/vgs.8%{?ext_man}
%{_mandir}/man8/vgscan.8%{?ext_man}
%{_mandir}/man8/vgsplit.8%{?ext_man}
%{_mandir}/man8/blkdeactivate.8%{?ext_man}
%{_mandir}/man8/lvmpolld.8%{?ext_man}
%{_mandir}/man8/lvm-lvpoll.8%{?ext_man}
%{_mandir}/man8/lvm_import_vdo.8%{?ext_man}
%{_udevdir}/rules.d/11-dm-lvm.rules
%{_udevdir}/rules.d/69-dm-lvm.rules
%dir %{_sysconfdir}/lvm
%config(noreplace) %{_sysconfdir}/lvm/lvm.conf
%config(noreplace) %{_sysconfdir}/lvm/lvmlocal.conf
%dir %{_sysconfdir}/lvm/profile
%{_sysconfdir}/lvm/profile/command_profile_template.profile
%{_sysconfdir}/lvm/profile/metadata_profile_template.profile
%{_sysconfdir}/lvm/profile/thin-generic.profile
%{_sysconfdir}/lvm/profile/thin-performance.profile
%{_sysconfdir}/lvm/profile/cache-mq.profile
%{_sysconfdir}/lvm/profile/cache-smq.profile
%{_sysconfdir}/lvm/profile/lvmdbusd.profile
%{_sysconfdir}/lvm/profile/vdo-small.profile
%dir %{_sysconfdir}/lvm/cache
%ghost %{_sysconfdir}/lvm/cache/.cache
%dir %{_sysconfdir}/lvm/archive
%dir %{_sysconfdir}/lvm/backup
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
%{_unitdir}/lvm2-lvmpolld.socket
%{_unitdir}/lvm2-lvmpolld.service
%dir %{_libdir}/device-mapper
%{_libdir}/device-mapper/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so.2.03
%package -n %{cmdlib}
Summary: LVM2 command line library
Group: System/Libraries
Conflicts: %{name} < %{version}
Obsoletes: liblvm2app2_2 <= %{liblvm2app2_2_version}
Obsoletes: liblvm2cmd2_02 <= %{liblvm2cmd2_02_version}
%description -n %{cmdlib}
The lvm2 command line library allows building programs that manage
lvm devices without invoking a separate program.
%post -n %{cmdlib} -p /sbin/ldconfig
%postun -n %{cmdlib} -p /sbin/ldconfig
%files -n %{cmdlib}
%{_libdir}/liblvm2cmd.so.*
%package devel
Summary: Development files for LVM2
Group: Development/Libraries/C and C++
Requires: %{cmdlib} = %{version}
Requires: device-mapper-devel
Requires: lvm2 = %{version}
%description devel
This package provides development files for the LVM2 Logical Volume Manager.
%files devel
%{_includedir}/lvm2cmd.h
%{_libdir}/liblvm2cmd.so
%package testsuite
Summary: LVM2 Testsuite
Group: Development/Libraries/C and C++
Requires: %{cmdlib} = %{version}
Requires: lvm2 = %{version}
%description testsuite
An extensive functional testsuite for the LVM2 Logical Volume Manager.
%files testsuite
%{_datarootdir}/lvm2-testsuite/
%{_libexecdir}/lvm2-testsuite/
%{_bindir}/lvm2-testsuite
%endif
%endif
%changelog