From 0adbef3a9d04ddfca478bc1283394b63514290398a695c612a58345e86266fd3 Mon Sep 17 00:00:00 2001 From: heming zhao Date: Sun, 26 May 2024 14:49:54 +0000 Subject: [PATCH] Accepting request 1176955 from home:hmzhao:branches:Base:System Update lvm2 from LVM2.2.03.22 to LVM2.2.03.24 OBS-URL: https://build.opensuse.org/request/show/1176955 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=338 --- ...rt-swapmetadata-fix-lvmlockd-locking.patch | 96 --- ...-fix-ret-values-fro-integrity-remove.patch | 105 ---- ...t-fix-regresion-from-integrity-check.patch | 29 - 0004-gcc-cleanup-warnings.patch | 103 --- ...ockd-fix-thick-to-thin-lv-conversion.patch | 379 ----------- ...let-lockd_init_lv_args-set-lock_args.patch | 63 -- ...-lvmlockd-fix-lvconvert-to-thin-pool.patch | 97 --- ...n-error-path-code-only-for-shared-VG.patch | 34 - ...ire-an-exclusive-VG-lock-for-refresh.patch | 30 - 0010-lvmlockd-client-mutex-ordering.patch | 40 -- ...ilesystem-move-stat-after-open-check.patch | 57 -- 0012-tests-check-for-writecache.patch | 49 -- ...-32-bit-overflow-in-size-calculation.patch | 34 - ...cc-fix-warnings-for-x32-architecture.patch | 44 -- ...ng-missing-braces-around-initializer.patch | 26 - 0016-test-improve-aux-teardown.patch | 53 -- 0017-tests-aux-try-with-extra-sleep.patch | 26 - 0018-tests-aux-using-singl-lvmconf-call.patch | 27 - ...sing-to-check-for-writecache-support.patch | 49 -- 0020-tests-pvmove-large-disk-area.patch | 40 -- 0021-tests-enforce-full-fs-check.patch | 25 - ...ate-for-work-in-fake-dev-environment.patch | 588 ------------------ ...est-when-lvmdbusd-runs-on-the-system.patch | 27 - 0024-tests-better-slowdown.patch | 38 -- LVM2.2.03.22.tgz | 3 - LVM2.2.03.22.tgz.asc | 16 - LVM2.2.03.24.tgz | 3 + LVM2.2.03.24.tgz.asc | 16 + ...1184687_Add-nolvm-for-kernel-cmdline.patch | 9 +- lvm2.changes | 130 ++++ lvm2.spec | 59 +- 31 files changed, 160 insertions(+), 2135 deletions(-) delete mode 100644 0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch delete mode 100644 0002-lvconvert-fix-ret-values-fro-integrity-remove.patch delete mode 100644 0003-lvconvert-fix-regresion-from-integrity-check.patch delete mode 100644 0004-gcc-cleanup-warnings.patch delete mode 100644 0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch delete mode 100644 0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch delete mode 100644 0007-lvmlockd-fix-lvconvert-to-thin-pool.patch delete mode 100644 0008-lvconvert-run-error-path-code-only-for-shared-VG.patch delete mode 100644 0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch delete mode 100644 0010-lvmlockd-client-mutex-ordering.patch delete mode 100644 0011-filesystem-move-stat-after-open-check.patch delete mode 100644 0012-tests-check-for-writecache.patch delete mode 100644 0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch delete mode 100644 0014-gcc-fix-warnings-for-x32-architecture.patch delete mode 100644 0015-gcc-warning-missing-braces-around-initializer.patch delete mode 100644 0016-test-improve-aux-teardown.patch delete mode 100644 0017-tests-aux-try-with-extra-sleep.patch delete mode 100644 0018-tests-aux-using-singl-lvmconf-call.patch delete mode 100644 0019-tests-missing-to-check-for-writecache-support.patch delete mode 100644 0020-tests-pvmove-large-disk-area.patch delete mode 100644 0021-tests-enforce-full-fs-check.patch delete mode 100644 0022-tests-update-for-work-in-fake-dev-environment.patch delete mode 100644 0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch delete mode 100644 0024-tests-better-slowdown.patch delete mode 100644 LVM2.2.03.22.tgz delete mode 100644 LVM2.2.03.22.tgz.asc create mode 100644 LVM2.2.03.24.tgz create mode 100644 LVM2.2.03.24.tgz.asc diff --git a/0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch b/0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch deleted file mode 100644 index bff5b70..0000000 --- a/0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch +++ /dev/null @@ -1,96 +0,0 @@ -From ff0a8d7b6734c745e52652fc5e7dd3a0f2efb518 Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0002-lvconvert-fix-ret-values-fro-integrity-remove.patch b/0002-lvconvert-fix-ret-values-fro-integrity-remove.patch deleted file mode 100644 index d503ed7..0000000 --- a/0002-lvconvert-fix-ret-values-fro-integrity-remove.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b982d9ac56a709f1ffcdfb052029556bd8d56635 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0003-lvconvert-fix-regresion-from-integrity-check.patch b/0003-lvconvert-fix-regresion-from-integrity-check.patch deleted file mode 100644 index 6b8f2d6..0000000 --- a/0003-lvconvert-fix-regresion-from-integrity-check.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5829b341ea6826d70772af941859359475976b40 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0004-gcc-cleanup-warnings.patch b/0004-gcc-cleanup-warnings.patch deleted file mode 100644 index a7fc90e..0000000 --- a/0004-gcc-cleanup-warnings.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 2cd58bb4c9ef063c5283daf0e618c2ed0c77eb89 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch b/0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch deleted file mode 100644 index 812b0cb..0000000 --- a/0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch +++ /dev/null @@ -1,379 +0,0 @@ -From 76a4599500aef12442c8c24be8aacc89f6a27e68 Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch b/0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch deleted file mode 100644 index 0d713bf..0000000 --- a/0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch +++ /dev/null @@ -1,63 +0,0 @@ -From ae13074a0a6ea7997cdb370cdd2185801646b2c5 Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0007-lvmlockd-fix-lvconvert-to-thin-pool.patch b/0007-lvmlockd-fix-lvconvert-to-thin-pool.patch deleted file mode 100644 index 689a109..0000000 --- a/0007-lvmlockd-fix-lvconvert-to-thin-pool.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 3e92798473a04bec26a91632e1436aa415c2bb3c Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0008-lvconvert-run-error-path-code-only-for-shared-VG.patch b/0008-lvconvert-run-error-path-code-only-for-shared-VG.patch deleted file mode 100644 index d2f2ef0..0000000 --- a/0008-lvconvert-run-error-path-code-only-for-shared-VG.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 33b804a80e24d58e57936f7c5a6cbe7c77981483 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch b/0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch deleted file mode 100644 index 9ab2cf9..0000000 --- a/0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b6ab049c3184edcb4d56789d32991bbf8c97de77 Mon Sep 17 00:00:00 2001 -From: wangzhiqiang -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 ---- - 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 - diff --git a/0010-lvmlockd-client-mutex-ordering.patch b/0010-lvmlockd-client-mutex-ordering.patch deleted file mode 100644 index 4bfb20a..0000000 --- a/0010-lvmlockd-client-mutex-ordering.patch +++ /dev/null @@ -1,40 +0,0 @@ -From cd17ccbc684590e8655888af6d6b0452287fd47d Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0011-filesystem-move-stat-after-open-check.patch b/0011-filesystem-move-stat-after-open-check.patch deleted file mode 100644 index 95e4982..0000000 --- a/0011-filesystem-move-stat-after-open-check.patch +++ /dev/null @@ -1,57 +0,0 @@ -From b5b97c2b663565833218f68b196327ef63b1a114 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0012-tests-check-for-writecache.patch b/0012-tests-check-for-writecache.patch deleted file mode 100644 index 1670af2..0000000 --- a/0012-tests-check-for-writecache.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 950edf73781807b07d97717b460ae682edb38fdf Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch b/0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch deleted file mode 100644 index f026fab..0000000 --- a/0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 25618d71b57e380ab692b640419dc89a9c6fe20e Mon Sep 17 00:00:00 2001 -From: David Teigland -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 - diff --git a/0014-gcc-fix-warnings-for-x32-architecture.patch b/0014-gcc-fix-warnings-for-x32-architecture.patch deleted file mode 100644 index 7352089..0000000 --- a/0014-gcc-fix-warnings-for-x32-architecture.patch +++ /dev/null @@ -1,44 +0,0 @@ -From afb60167d6268a61d51b1a33efa741f46c7e73ee Mon Sep 17 00:00:00 2001 -From: Mikulas Patocka -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 - diff --git a/0015-gcc-warning-missing-braces-around-initializer.patch b/0015-gcc-warning-missing-braces-around-initializer.patch deleted file mode 100644 index e20b012..0000000 --- a/0015-gcc-warning-missing-braces-around-initializer.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ae65e71b3d519ed99f0bab6a595d6d255e0635bb Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0016-test-improve-aux-teardown.patch b/0016-test-improve-aux-teardown.patch deleted file mode 100644 index b473b10..0000000 --- a/0016-test-improve-aux-teardown.patch +++ /dev/null @@ -1,53 +0,0 @@ -From fbbf796dd89007fe57a3c7043f27aed2fbf0775c Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0017-tests-aux-try-with-extra-sleep.patch b/0017-tests-aux-try-with-extra-sleep.patch deleted file mode 100644 index cb1a91b..0000000 --- a/0017-tests-aux-try-with-extra-sleep.patch +++ /dev/null @@ -1,26 +0,0 @@ -From cf8a0c94fff754e4b6a504a430e53439d67b6ca0 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0018-tests-aux-using-singl-lvmconf-call.patch b/0018-tests-aux-using-singl-lvmconf-call.patch deleted file mode 100644 index 6f3a1bf..0000000 --- a/0018-tests-aux-using-singl-lvmconf-call.patch +++ /dev/null @@ -1,27 +0,0 @@ -From cb34be9ba90613cd49f4822fc118cecfc93ac897 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0019-tests-missing-to-check-for-writecache-support.patch b/0019-tests-missing-to-check-for-writecache-support.patch deleted file mode 100644 index d75f48e..0000000 --- a/0019-tests-missing-to-check-for-writecache-support.patch +++ /dev/null @@ -1,49 +0,0 @@ -From da95bb6883810863a394525c9a66196b7b0dda21 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0020-tests-pvmove-large-disk-area.patch b/0020-tests-pvmove-large-disk-area.patch deleted file mode 100644 index 8f315c4..0000000 --- a/0020-tests-pvmove-large-disk-area.patch +++ /dev/null @@ -1,40 +0,0 @@ -From befc30b610ed3a648f967e50cea752d0f5a09073 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0021-tests-enforce-full-fs-check.patch b/0021-tests-enforce-full-fs-check.patch deleted file mode 100644 index ec253af..0000000 --- a/0021-tests-enforce-full-fs-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8257181f9e4e54505de158a98d54c8a11b127553 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0022-tests-update-for-work-in-fake-dev-environment.patch b/0022-tests-update-for-work-in-fake-dev-environment.patch deleted file mode 100644 index 09354c0..0000000 --- a/0022-tests-update-for-work-in-fake-dev-environment.patch +++ /dev/null @@ -1,588 +0,0 @@ -From 9683478371c60e78920c22cb4f5ca14b39bb9fcb Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch b/0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch deleted file mode 100644 index 0ddd90f..0000000 --- a/0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a55bd2ddc1ca21ca6fb44df58d7287f619cb54f6 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/0024-tests-better-slowdown.patch b/0024-tests-better-slowdown.patch deleted file mode 100644 index a9344de..0000000 --- a/0024-tests-better-slowdown.patch +++ /dev/null @@ -1,38 +0,0 @@ -From dc31f8bdd8d6685c04802a023b769fe9310f1c91 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -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 - diff --git a/LVM2.2.03.22.tgz b/LVM2.2.03.22.tgz deleted file mode 100644 index 06666e8..0000000 --- a/LVM2.2.03.22.tgz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4c5a6923bd1ace7ce04474608a84937ce053ba91b1ace9f0b0017268e732dc7c -size 2755031 diff --git a/LVM2.2.03.22.tgz.asc b/LVM2.2.03.22.tgz.asc deleted file mode 100644 index 327535c..0000000 --- a/LVM2.2.03.22.tgz.asc +++ /dev/null @@ -1,16 +0,0 @@ ------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----- diff --git a/LVM2.2.03.24.tgz b/LVM2.2.03.24.tgz new file mode 100644 index 0000000..c9da9bb --- /dev/null +++ b/LVM2.2.03.24.tgz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:593c5503ba00faab1c6e0b4a597b9605ec7b5881845c04bf412ebf9d1bbfa13c +size 2826333 diff --git a/LVM2.2.03.24.tgz.asc b/LVM2.2.03.24.tgz.asc new file mode 100644 index 0000000..6e99354 --- /dev/null +++ b/LVM2.2.03.24.tgz.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEE1QGkeEQK4v0TChvouREkMeUJA58FAmZF3zYACgkQuREkMeUJ +A5+JxA/9HXxpPzrLKLo4+TmGHw53eVp/xrFCNt43AO+cywJ/iAyZNa/Moyz8xD1k +nBtEoGk/2yooJlHWnrtxKCXGVuNiUwuzRwwsU/EVB1+UA/x8GMUaQHelOzGwCFsd +YxmsoQ6rGE9+GMfz3AMd0noOPJkj5g8GXIy1Dv3wF8/xdaRcEEODbPYCBmVTVtv7 +vrNVAP9yXo4tibV05C0Arm8D9ymWK/pXjE3LHD1m7s66gLDziubYNuiOik4nb5y9 +DiECfO1B1fNXMF51FH3miRia/UgoDbrJhkVTTDrDO9ivjq4A7LZPpBmV93gNDOM9 +1aGymKFv0zgzveyOdr+As7GvH8ShQSbcXUAwerGXjvcjqx3VbPR0yZo1jY6cDY+F +58K1bGG0XmdfxasWW/ZZjpCPs2bfpaMadDcnOC9gs7h5jVF7D7rAS+twazGqI/Yg +Ak2IsBMVYV2WRuEyBHqCYKsQlhsybtYm+ptn7k9qc1QDJXXrjJbE1USmNtdC5Dyj +nvpkkxdehzxDgcCKg1xr2lKkKTXO40+uXlhaDRmmVvAkrXIJQGqizfbB6rk3LsM8 +tKfCOyQbp7nE0ZtOYmZIqeb0WZ1N/mHIOjzMefx7IfDKX4neJ7f1kB4F3ntjsIOK +hNjVH8CTjKqckMTJzwR/zpIXp3LfSvdNGVfVX/ghsSr8A7aiODU= +=T58+ +-----END PGP SIGNATURE----- diff --git a/bug-1184687_Add-nolvm-for-kernel-cmdline.patch b/bug-1184687_Add-nolvm-for-kernel-cmdline.patch index 8d476e8..cd84b11 100644 --- a/bug-1184687_Add-nolvm-for-kernel-cmdline.patch +++ b/bug-1184687_Add-nolvm-for-kernel-cmdline.patch @@ -34,13 +34,14 @@ diff -Nupr a/scripts/lvm2-pvscan.service.in b/scripts/lvm2-pvscan.service.in 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" +@@ -10,6 +10,9 @@ (LVM_EXEC_RULE) 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" + # Ignore PVs on LVs. + # This is usually a case of an LV being used for a guest VM + # image, where the guest is using lvm. The host should + # ignore lvm data from the guest and not attempt to scan or diff --git a/lvm2.changes b/lvm2.changes index ce67981..c99b069 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,133 @@ +------------------------------------------------------------------- +Sun May 26 13:14:00 UTC 2024 - Heming Zhao + +- Update lvm2 from LVM2.2.03.22 to LVM2.2.03.24 + + *** WHATS_NEW from 2.03.22 to 2.03.24 *** + + Version 2.03.24 - 16th May 2024 + =============================== + Lvconvert supports VDO options for thin-pool with vdo conversion. + Improve placement to .data.rel.ro and .rodata sections. + Fix support for -y and -W when creating thinpool with vdo. + Bettter support for runtime valgrind detection. + Allow command interruption when communicating with dmeventd. + Fix resize of VDO volume used for thin pool data volume. + Use -Wl,-z,now and -Wl,--as-needed for compilation by default. + Require 3.7 as minimal version for sanlock. + Share code for closing opened desriptors on program startup. + Fix memleak in lvmcache. + Add configure --with-default-event-activation=ON setting. + Fix return value from reporter function when hitting internal error. + Skip checking of pools for lvremove and vgremove commands. + VDO modprobes dm-vdo for 6.9 kernel and kvdo for older kernel version. + Fix lvs reporting for VDO volumes with new upstream kernel driver. + Don't import DM_UDEV_DISABLE_OTHER_RULES_FLAG in LVM rules, DM rules cover it. + Fix table line generation for cache snapshots using cachevol. + Enhance lvconvert support for external origins stacking. + When swapping LV names also swap properties like hostname, time and data. + Fix removal of stacked external origins. + Lock filesystem when converting volume to read-only external origin. + Support external origin between different thin-pool. + Improve validation of acceptable volumes for external origins. + Reduce amount of preloaded devices for complex device trees. + Avoid logging problems from monitoring snapshots with inactive origins. + Check for cache policy module presence in kernel's builtin modules file. + Add configure --with-modulesdir to select kernel modules directory. + Support creation of thin-pool with VDO use for its data volume. + + Version 2.03.23 - 21st November 2023 + ==================================== + Set the first lv_attr flag for raid integrity images to i or I. + Add -A option for pvs and pvscan to show PVs outside devices file. + Improve searched_devnames temp file usage to prevent redundant scanning. + Change default search_for_devnames from auto to all. + Add lvmdevices --refresh to search for missing PVIDs on all devices. + Add comparison between old and new entries in lvmdevices --check. + Fix device_id matching order - match non-devname first. + Fix "lvconvert -m 0" when there is other than first in-sync leg. + Use system.devices as default for dmeventd when dmeventd.devices is undefined. + Accept WWIDs containing QEMU HARDDISK for device_id. + Improve handling of non-standard WWID prefixes used for device_id. + Configure automatically enables cmdlib for dmeventd and notify-dbus for dbus. + Fix hint calculation for pools with zero or error segment. + Configure supports --disable-shared to build only static binaries. + Configure supports --without-{blkid|systemd|udev} for easier static build. + Refresh device ids if the system changes. + Fix pvmove when specifying raid components as moved LVs. + Enhance error detection for lvm_import_vdo. + Support PV lists with thin lvconvert. + Fix support for lvm_import_vdo with SCSI VDO volumes. + Fix locking issue leading to hanging concurrent vgchange --refresh. + Recognize lvm.conf report/headings=2 for full column names in report headings. + Add --headings none|abbrev|full cmd line option to set report headings type. + Fix conversion to thin pool using lvmlockd. + Fix conversion from thick into thin volume using lvmlockd. + Require writable LV for conversion to vdo pool. + Fix return value from lvconvert integrity remove. + Preserve UUID for pool metadata spare. + Preserve UUID for swapped pool metadata. + Rewrite validation of device name entries used as device_id. + + *** WHATS_NEW_DM from 1.02.196 to 1.02.198 *** + + Version 1.02.198 - 16th May 2024 + ================================ + Fix static only compilation of libdevmapper.a and dmsetup tool. + Use better code for closing opened descriptors when starting dmeventd. + Correct dmeventd -R for systemd environment. + Restart of dmeventd -R checks pid file to detect running dmeventd first. + Query with dmeventd -i quickly ends when there is no running dmeventd. + Enhance dm_get_status_raid to handle mismatching status or reported legs. + Create /dev/disk/by-label symlinks for DM devs that have crypto as next layer. + Persist udev db for DM devs on cleanup used in initrd to rootfs transition. + Process synthetic udev events other than 'add/change' as 'change' events. + Increase DM_UDEV_RULES_VSN to 3 to indicate changed udev rules. + Rename DM_NOSCAN to .DM_NOSCAN so it's not stored in udev db. + Rename DM_SUSPENDED to .DM_SUSPENDED so it's not stored in udev db. + Do not import DM_UDEV_DISABLE_OTHER_RULES_FLAG from db in 10-dm-disk.rules. + Test DISK_RO after importing properties from db in 10-dm.rules. + Also import ID_FS_TYPE in 13-dm-disk.rules from db if needed. + + Version 1.02.197 - 21st November 2023 + ===================================== + Fix invalid JSON report if using DM_REPORT_OUTPUT_MULTIPLE_TIMES and selection. + Propagate ioctl errno from dm_task_run when creating new table line. + Add support for group aliases in dmstats. + Add support for exit-on file for dmeventd to reduce shutdown delays. + Add configure option --with-dmeventd-exit-on-path to specify default path. + Add dmsetup --headings none|abbrev|full to set report headings type. + Add DM_REPORT_OUTPUT_FIELD_IDS_IN_HEADINGS to provide alternative headings. + +- Drop patches that have been merged into upstream + - 0001-lvconvert-swapmetadata-fix-lvmlockd-locking.patch + - 0002-lvconvert-fix-ret-values-fro-integrity-remove.patch + - 0003-lvconvert-fix-regresion-from-integrity-check.patch + - 0004-gcc-cleanup-warnings.patch + - 0005-lvmlockd-fix-thick-to-thin-lv-conversion.patch + - 0006-lvmlockd-let-lockd_init_lv_args-set-lock_args.patch + - 0007-lvmlockd-fix-lvconvert-to-thin-pool.patch + - 0008-lvconvert-run-error-path-code-only-for-shared-VG.patch + - 0009-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch + - 0010-lvmlockd-client-mutex-ordering.patch + - 0011-filesystem-move-stat-after-open-check.patch + - 0012-tests-check-for-writecache.patch + - 0013-lvresize-fix-32-bit-overflow-in-size-calculation.patch + - 0014-gcc-fix-warnings-for-x32-architecture.patch + - 0015-gcc-warning-missing-braces-around-initializer.patch + - 0016-test-improve-aux-teardown.patch + - 0017-tests-aux-try-with-extra-sleep.patch + - 0018-tests-aux-using-singl-lvmconf-call.patch + - 0019-tests-missing-to-check-for-writecache-support.patch + - 0020-tests-pvmove-large-disk-area.patch + - 0021-tests-enforce-full-fs-check.patch + - 0022-tests-update-for-work-in-fake-dev-environment.patch + - 0023-tests-skip-test-when-lvmdbusd-runs-on-the-system.patch + - 0024-tests-better-slowdown.patch + +- Update patch + - bug-1184687_Add-nolvm-for-kernel-cmdline.patch + ------------------------------------------------------------------- Tue May 21 11:30:07 UTC 2024 - Dominique Leuenberger diff --git a/lvm2.spec b/lvm2.spec index 067e656..b960954 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -1,5 +1,5 @@ # -# spec file for package lvm2 +# spec file # # Copyright (c) 2024 SUSE LLC # @@ -21,11 +21,11 @@ %define libname_event libdevmapper-event1_03 %define _udevdir %(pkg-config --variable=udevdir udev) %define cmdlib liblvm2cmd2_03 -%define lvm2_version 2.03.22 +%define lvm2_version 2.03.24 # 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 upstream_device_mapper_version 1.02.198 +%define device_mapper_version %{lvm2_version}_1.02.198 %define thin_provisioning_version 0.7.0 %define _supportsanlock 1 %define dlm_version 4.0.9 @@ -71,30 +71,7 @@ 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 +#Patch0001: n/a # SUSE patches: 1000+ for LVM # Never upstream Patch1001: cmirrord_remove_date_time_from_compilation.patch @@ -123,7 +100,7 @@ BuildRequires: pkgconfig(libudev) Requires: device-mapper >= %{device_mapper_version} Requires: modutils Requires(post): coreutils -Requires(postun): coreutils +Requires(postun):coreutils Provides: lvm = %{version} Obsoletes: lvm2-cmirrord <= %{lvm2_cmirrord_version} %{?systemd_requires} @@ -155,30 +132,6 @@ Volume Manager. %prep %setup -q -n LVM2.%{version} -%patch -P 0001 -p1 -%patch -P 0002 -p1 -%patch -P 0003 -p1 -%patch -P 0004 -p1 -%patch -P 0005 -p1 -%patch -P 0006 -p1 -%patch -P 0007 -p1 -%patch -P 0008 -p1 -%patch -P 0009 -p1 -%patch -P 0010 -p1 -%patch -P 0011 -p1 -%patch -P 0012 -p1 -%patch -P 0013 -p1 -%patch -P 0014 -p1 -%patch -P 0015 -p1 -%patch -P 0016 -p1 -%patch -P 0017 -p1 -%patch -P 0018 -p1 -%patch -P 0019 -p1 -%patch -P 0020 -p1 -%patch -P 0021 -p1 -%patch -P 0022 -p1 -%patch -P 0023 -p1 -%patch -P 0024 -p1 %patch -P 1001 -p1 %patch -P 1002 -p1 %patch -P 1003 -p1