main - device_id: check return value of label_read_pvid
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a74468116ea51542e40...
Commit: a74468116ea51542e409e4bc393c63dc7ddb20b6
Parent: e71b434663e445ee9232fc72786e5bc2ac699f4b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 1 11:49:51 2022 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 1 11:49:51 2022 -0600
device_id: check return value of label_read_pvid
for covscan
---
lib/device/device_id.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 367b7dbb9..1f2ab5ad4 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -2489,6 +2489,7 @@ void device_ids_check_serial(struct cmd_context *cmd, struct dm_list *scan_devs,
int has_pvid;
int found;
int count;
+ int err;
dm_list_init(&dus_check);
dm_list_init(&devs_check);
@@ -2544,8 +2545,8 @@ void device_ids_check_serial(struct cmd_context *cmd, struct dm_list *scan_devs,
dev = devl->dev;
has_pvid = 0;
- label_read_pvid(dev, &has_pvid);
- if (!has_pvid) {
+ err = label_read_pvid(dev, &has_pvid);
+ if (!err || !has_pvid) {
log_debug("serial %s no pvid %s", idname, dev_name(devl->dev));
dm_list_del(&devl->list);
continue;
1 year, 4 months
main - device_id: _get_devs_with_serial_numbers add missing free
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e71b434663e445ee923...
Commit: e71b434663e445ee9232fc72786e5bc2ac699f4b
Parent: 7552ed9010f823d2ac2b99349c62dce8cd6fd506
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 1 11:43:24 2022 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 1 11:43:24 2022 -0600
device_id: _get_devs_with_serial_numbers add missing free
on malloc failure path
---
lib/device/device_id.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 4fa02edc7..367b7dbb9 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -2124,11 +2124,11 @@ static void _get_devs_with_serial_numbers(struct cmd_context *cmd, struct dm_lis
if (id->idtype == DEV_ID_TYPE_SYS_SERIAL) {
if (str_list_match_item(serial_str_list, id->idname)) {
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
- goto next_dev;
+ goto next_continue;
devl->dev = dev;
dm_list_add(devs, &devl->list);
}
- goto next_dev;
+ goto next_continue;
}
}
@@ -2145,20 +2145,22 @@ static void _get_devs_with_serial_numbers(struct cmd_context *cmd, struct dm_lis
if ((idname = device_id_system_read(cmd, dev, DEV_ID_TYPE_SYS_SERIAL))) {
if (str_list_match_item(serial_str_list, idname)) {
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
- goto next_dev;
+ goto next_free;
if (!(id = zalloc(sizeof(struct dev_id))))
- goto next_dev;
+ goto next_free;
id->idtype = DEV_ID_TYPE_SYS_SERIAL;
id->idname = (char *)idname;
id->dev = dev;
dm_list_add(&dev->ids, &id->list);
devl->dev = dev;
dm_list_add(devs, &devl->list);
- } else {
- free((char *)idname);
+ idname = NULL;
}
}
- next_dev:
+ next_free:
+ if (idname)
+ free((char *)idname);
+ next_continue:
continue;
}
dev_iter_destroy(iter);
1 year, 4 months
main - device_id: add null id->name null check
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7552ed9010f823d2ac2...
Commit: 7552ed9010f823d2ac2b99349c62dce8cd6fd506
Parent: f80273a1071532115219ea7c23054e6bbb096039
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 1 10:38:48 2022 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 1 10:38:48 2022 -0600
device_id: add null id->name null check
for covscan
---
lib/device/device_id.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index aae875776..4fa02edc7 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1844,8 +1844,8 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
idtype_to_str(du->idtype), du->idname, dev_name(dev));
return 1;
- } else if ((id->idtype == DEV_ID_TYPE_SYS_WWID) && !strncmp(id->idname, "t10", 3) &&
- du_t10[0] && !strcmp(id->idname, du_t10)) {
+ } else if ((id->idtype == DEV_ID_TYPE_SYS_WWID) && id->idname &&
+ !strncmp(id->idname, "t10", 3) && du_t10[0] && !strcmp(id->idname, du_t10)) {
/* Compare the shorter form du t10 wwid to the dev t10 wwid. */
du->dev = dev;
dev->id = id;
1 year, 4 months
main - lvmcache: fix strncpy len for wwid
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f80273a107153211521...
Commit: f80273a1071532115219ea7c23054e6bbb096039
Parent: 55b29c1c3d4b5c1366ec0a24fb680cfb81fc4961
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 1 10:03:06 2022 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 1 10:03:06 2022 -0600
lvmcache: fix strncpy len for wwid
---
lib/cache/lvmcache.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 1ae63b3fc..ec32b3be9 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -654,13 +654,13 @@ static int _all_multipath_components(struct cmd_context *cmd, struct lvmcache_in
if (dev_is_mp) {
if ((wwid1 = dev_mpath_component_wwid(cmd, dev))) {
- strncpy(wwid1_buf, wwid1, DEV_WWID_SIZE);
+ strncpy(wwid1_buf, wwid1, DEV_WWID_SIZE-1);
dev_mp = dev;
dev1 = dev;
}
} else {
if ((wwid1 = device_id_system_read(cmd, dev, DEV_ID_TYPE_SYS_WWID))) {
- strncpy(wwid1_buf, wwid1, DEV_WWID_SIZE);
+ strncpy(wwid1_buf, wwid1, DEV_WWID_SIZE-1);
free((char *)wwid1);
dev1 = dev;
}
@@ -673,10 +673,10 @@ static int _all_multipath_components(struct cmd_context *cmd, struct lvmcache_in
if (dev_is_mp) {
if ((wwid = dev_mpath_component_wwid(cmd, dev)))
- strncpy(wwid_buf, wwid, DEV_WWID_SIZE);
+ strncpy(wwid_buf, wwid, DEV_WWID_SIZE-1);
} else {
if ((wwid = device_id_system_read(cmd, dev, DEV_ID_TYPE_SYS_WWID))) {
- strncpy(wwid_buf, wwid, DEV_WWID_SIZE);
+ strncpy(wwid_buf, wwid, DEV_WWID_SIZE-1);
free((char *)wwid);
}
}
@@ -692,7 +692,7 @@ static int _all_multipath_components(struct cmd_context *cmd, struct lvmcache_in
continue;
if (!wwid1_buf[0]) {
- memcpy(wwid1_buf, wwid_buf, DEV_WWID_SIZE);
+ memcpy(wwid1_buf, wwid_buf, DEV_WWID_SIZE-1);
dev1 = dev;
continue;
}
1 year, 4 months
main - lvmlockd: fix missing closedir
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=55b29c1c3d4b5c1366e...
Commit: 55b29c1c3d4b5c1366ec0a24fb680cfb81fc4961
Parent: e63b0c7262f50ab43fcde1c50b6d880acab68407
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 1 09:53:57 2022 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 1 09:55:11 2022 -0600
lvmlockd: fix missing closedir
in get_local_nodeid from recent lock purge feature:
lvmlockd: purge the lock resources left in previous lockspace
---
daemons/lvmlockd/lvmlockd-dlm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index d262fa281..248081d0e 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -260,6 +260,7 @@ static int get_local_nodeid(void)
rv = sscanf(line, "%d", &val);
if (rv == 1) {
fclose(file);
+ closedir(ls_dir);
return val;
}
}
@@ -270,7 +271,7 @@ static int get_local_nodeid(void)
if (closedir(ls_dir))
log_error("get_local_nodeid closedir error");
- return rv;
+ return rv;
}
int lm_purge_locks_dlm(struct lockspace *ls)
1 year, 4 months
rhel-8.8.0 - lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0aa45120e92fe8b0f37...
Commit: 0aa45120e92fe8b0f379d00f3a031e3c53feca43
Parent: 73943825501daede9963bb5d15abbc4d36febb40
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Aug 24 15:37:56 2022 -0500
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Nov 28 17:11:21 2022 +0100
lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
We need this to prevent lvm from interleaving the JSON output with errors
written to stderr.
(cherry picked from commit a5e6947d74f7b88f7f0df4328a923ad82a970634)
---
daemons/lvmdbusd/main.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index b0a82d492..eaea13ef8 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -112,8 +112,10 @@ def main():
use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
- # Ensure that we get consistent output for parsing stdout/stderr
+ # Ensure that we get consistent output for parsing stdout/stderr and that we
+ # are using the lvmdbusd profile.
os.environ["LC_ALL"] = "C"
+ os.environ["LVM_COMMAND_PROFILE"] = "lvmdbusd"
cfg.args = parser.parse_args()
cfg.create_request_entry = RequestEntry
1 year, 4 months
rhel-8.8.0 - lvconvert: correct test support for vdo-pool
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=73943825501daede996...
Commit: 73943825501daede9963bb5d15abbc4d36febb40
Parent: 87904fbbb84c10e6f733db1c5ba447537d1cf08c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 11 11:44:58 2022 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Nov 28 17:11:21 2022 +0100
lvconvert: correct test support for vdo-pool
(cherry picked from commit d0697be5004af0e040b1f746e619b8075350bc46)
---
WHATS_NEW | 4 ++++
lib/metadata/vdo_manip.c | 4 +++-
tools/lvconvert.c | 4 +++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 240234e4d..e626802ec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.03.17 -
+===============================
+ Fix lvconvert --test --type vdo-pool execution.
+
Version 2.03.14 - 20th October 2021
===================================
Device scanning is skipping directories on different filesystems.
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index fa9c893cb..11a119a68 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -392,7 +392,9 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv,
/* Format data LV as VDO volume */
if (format) {
- if (!_format_vdo_pool_data_lv(data_lv, vtp, &vdo_logical_size)) {
+ if (test_mode()) {
+ log_verbose("Test mode: Skipping formating of VDO pool volume.");
+ } else if (!_format_vdo_pool_data_lv(data_lv, vtp, &vdo_logical_size)) {
log_error("Cannot format VDO pool volume %s.", display_lvname(data_lv));
return NULL;
}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 3d4b24fe3..c1d373318 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5482,7 +5482,9 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd,
}
if (vdo_pool_zero) {
- if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .do_wipe_signatures = 1,
+ if (test_mode()) {
+ log_verbose("Test mode: Skipping activation, zeroing and signature wiping.");
+ } else if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .do_wipe_signatures = 1,
.yes = arg_count(cmd, yes_ARG),
.force = arg_count(cmd, force_ARG)})) {
log_error("Aborting. Failed to wipe VDO data store.");
1 year, 4 months