stable-2.02 - cov: Clarify the control flow
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c24fa7b7b714871950e...
Commit: c24fa7b7b714871950e0366ca4c35d0e601786ff
Parent: 3fe2610cff1afc1eaf9bc9c141950fe8ded73793
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon Oct 21 15:32:09 2019 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Oct 21 15:32:09 2019 +0200
cov: Clarify the control flow
Return need a clean up but it is not bailing out due to an error.
Fix: 402b41f58dc14160ec21937d6308b0d9a1abba7d
---
libdm/libdm-common.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index b06e678..32d052c 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -2013,7 +2013,7 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz
else {
log_sys_debug("readlink", sysfs_path);
r = _sysfs_find_kernel_name(major, minor, buf, buf_size);
- goto bad;
+ goto out;
}
goto bad;
}
@@ -2034,6 +2034,7 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz
strcpy(buf, name);
r = 1;
bad:
+out:
dm_free(temp_buf);
dm_free(sysfs_path);
4 years, 7 months
stable-2.02 - debug: drop some unneeded backtraces
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3fe2610cff1afc1eaf9...
Commit: 3fe2610cff1afc1eaf9bc9c141950fe8ded73793
Parent: 889c88e9dab33195efc4dc0400a4b0aaa3383948
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 22 23:44:42 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Oct 21 15:26:11 2019 +0200
debug: drop some unneeded backtraces
(cherry picked from commit 88faf5a53b34cdfe2d4932a6800af8530f8f5396)
Conflicts:
lib/format_text/export.c
tools/lvconvert.c
---
lib/format_text/export.c | 4 ++--
lib/format_text/format-text.c | 2 +-
libdm/libdm-stats.c | 2 +-
tools/lvconvert.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 7866d56..3e294a1 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -1097,13 +1097,13 @@ struct dm_config_tree *export_vg_to_config_tree(struct volume_group *vg)
if (!export_vg_to_buffer(vg, &buf)) {
log_error("Could not format metadata for VG %s.", vg->name);
- return_NULL;
+ return NULL;
}
if (!(vg_cft = config_tree_from_string_without_dup_node_check(buf))) {
log_error("Error parsing metadata for VG %s.", vg->name);
dm_free(buf);
- return_NULL;
+ return NULL;
}
dm_free(buf);
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index f39051c..6eea07f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -546,7 +546,7 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
if (!(mdah = raw_read_mda_header(fid->fmt, area, primary_mda))) {
log_error("Failed to read vg %s from %s", vgname, dev_name(area->dev));
- goto_out;
+ goto out;
}
if (!(rlocn = _read_metadata_location_vg(area, mdah, primary_mda, vgname, &precommitted))) {
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index df4322a..b4b714d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4680,7 +4680,7 @@ static uint64_t *_stats_map_file_regions(struct dm_stats *dms, int fd,
/* make space for end-of-table marker */
if (!(regions = dm_malloc((1 + *count) * sizeof(*regions)))) {
log_error("Could not allocate memory for region IDs.");
- goto_out;
+ goto out;
}
/*
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 31ca5a1..677bed1 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4142,7 +4142,7 @@ static int _lvconvert_to_cache_vol_single(struct cmd_context *cmd,
/* Convert lv to cache vol using cachepool_lv. */
if (!_lvconvert_to_cache_vol(cmd, lv, cachepool_lv))
- goto_out;
+ goto out;
return ECMD_PROCESSED;
4 years, 7 months
stable-2.02 - dm: introduce DM_GET_TARGET_VERSION
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=889c88e9dab33195efc...
Commit: 889c88e9dab33195efc4dc0400a4b0aaa3383948
Parent: f50af80199f723f7b1970ee33ddf959ea79fcbef
Author: Mikulas Patocka <mpatocka(a)redhat.com>
AuthorDate: Mon Sep 16 05:58:10 2019 -0400
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Oct 21 15:21:29 2019 +0200
dm: introduce DM_GET_TARGET_VERSION
Adds support for the DM_GET_TARGET_VERSION to dmsetup.
It introduces a new comman "target-version" that will accept list
of targets and print their version.
Signed-off-by: Mikulas Patocka <mpatocka(a)redhat.com>
(cherry picked from commit 667b33dd3be1068ffb92783e189cbc1b41c9ac28)
Conflicts:
device_mapper/all.h
device_mapper/ioctl/libdm-iface.c
device_mapper/misc/dm-ioctl.h
---
libdm/ioctl/libdm-iface.c | 3 +++
libdm/libdevmapper.h | 4 +++-
libdm/misc/dm-ioctl.h | 2 ++
tools/dmsetup.c | 28 ++++++++++++++++++++++++++++
4 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 79ea51d..77bdd07 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -118,6 +118,9 @@ static struct cmd_data _cmd_data_v4[] = {
#ifdef DM_DEV_ARM_POLL
{"armpoll", DM_DEV_ARM_POLL, {4, 36, 0}},
#endif
+#ifdef DM_GET_TARGET_VERSION
+ {"target-version", DM_GET_TARGET_VERSION, {4, 41, 0}},
+#endif
};
/* *INDENT-ON* */
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index e885f52..81c67dc 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -121,7 +121,9 @@ enum {
DM_DEVICE_SET_GEOMETRY,
- DM_DEVICE_ARM_POLL
+ DM_DEVICE_ARM_POLL,
+
+ DM_GET_TARGET_VERSION
};
/*
diff --git a/libdm/misc/dm-ioctl.h b/libdm/misc/dm-ioctl.h
index 79f574c..52a7a93 100644
--- a/libdm/misc/dm-ioctl.h
+++ b/libdm/misc/dm-ioctl.h
@@ -244,6 +244,7 @@ enum {
DM_TARGET_MSG_CMD,
DM_DEV_SET_GEOMETRY_CMD,
DM_DEV_ARM_POLL_CMD,
+ DM_GET_TARGET_VERSION_CMD,
};
#define DM_IOCTL 0xfd
@@ -269,6 +270,7 @@ enum {
#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
+#define DM_GET_TARGET_VERSION _IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
#define DM_VERSION_MINOR 36
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 15a09c6..dfa9e34 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2588,6 +2588,33 @@ out:
return r;
}
+/* Show target names and their version numbers */
+static int _target_version(CMD_ARGS)
+{
+ int r = 0;
+ struct dm_task *dmt;
+ struct dm_versions *target;
+
+ if (!(dmt = dm_task_create(DM_GET_TARGET_VERSION)))
+ return_0;
+
+ if (!dm_task_set_name(dmt, argv[0]))
+ goto_out;
+
+ if (!_task_run(dmt))
+ goto_out;
+
+ target = dm_task_get_versions(dmt);
+ printf("%-16s v%d.%d.%d\n", target->name, target->version[0],
+ target->version[1], target->version[2]);
+
+ r = 1;
+
+out:
+ dm_task_destroy(dmt);
+ return r;
+}
+
static int _info(CMD_ARGS)
{
int r = 0;
@@ -6240,6 +6267,7 @@ static struct command _dmsetup_commands[] = {
{"udevcomplete", "<cookie>", 1, 1, 0, 0, _udevcomplete},
{"udevcomplete_all", "[<age_in_minutes>]", 0, 1, 0, 0, _udevcomplete_all},
{"udevcookies", "", 0, 0, 0, 0, _udevcookies},
+ {"target-version", "[<target>...]", 1, -1, 1, 0, _target_version},
{"targets", "", 0, 0, 0, 0, _targets},
{"version", "", 0, 0, 0, 0, _version},
{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, 0, 0, _setgeometry},
4 years, 7 months
master - vgchange: remove bogus option restriction
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=967e2decd22cee4aa44...
Commit: 967e2decd22cee4aa4426cfda5732860e1a085b3
Parent: c08704cee7e34a96fdaa453faf900683283e8691
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 21 13:27:29 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 21 13:29:57 2019 -0500
vgchange: remove bogus option restriction
for -A with -a
---
tools/vgchange.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 479ddd6..a10bf11 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -749,12 +749,6 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- if (arg_is_set(cmd, activate_ARG) &&
- arg_is_set(cmd, autobackup_ARG)) {
- log_error("-A option not necessary with -a option");
- return EINVALID_CMD_LINE;
- }
-
if (arg_is_set(cmd, maxphysicalvolumes_ARG) &&
arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("MaxPhysicalVolumes may not be negative");
4 years, 7 months
master - cachevol: use cachepool code for metadata size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c08704cee7e34a96fda...
Commit: c08704cee7e34a96fdaa453faf900683283e8691
Parent: 018cf39316923f26e42c25fc6e885b0ca46c88ba
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 21 12:13:33 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 21 12:13:33 2019 -0500
cachevol: use cachepool code for metadata size
Based on a more detailed calculation, but because of
extent size rounding, the final result is about the
same.
---
lib/metadata/cache_manip.c | 26 +-------------------------
1 files changed, 1 insertions(+), 25 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index c20cc49..2f35d83 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -1092,32 +1092,8 @@ int cache_vol_set_params(struct cmd_context *cmd,
}
}
- /*
- * cachevol size 8M to 16M -> metadata size 4M
- *
- * cachevol size 16M to 4G -> metadata size 8M
- *
- * cachevol size 4G to 16G -> metadata size 16M
- *
- * cachevol size 16G to 32G -> metadata size 32M
- *
- * cachevol size 32G and up -> metadata size 64M
- */
if (!meta_size) {
- if (pool_lv->size <= (16 * ONE_MB_IN_SECTORS))
- meta_size = 4 * ONE_MB_IN_SECTORS;
-
- else if (pool_lv->size <= (4 * ONE_GB_IN_SECTORS))
- meta_size = 8 * ONE_MB_IN_SECTORS;
-
- else if (pool_lv->size <= (16 * ONE_GB_IN_SECTORS))
- meta_size = 16 * ONE_MB_IN_SECTORS;
-
- else if (pool_lv->size <= (32 * ONE_GB_IN_SECTORS))
- meta_size = 32 * ONE_MB_IN_SECTORS;
-
- else
- meta_size = 64 * ONE_MB_IN_SECTORS;
+ meta_size = _cache_min_metadata_size(pool_lv->size, chunk_size);
if (meta_size < min_meta_size)
meta_size = min_meta_size;
4 years, 7 months
master - man: lvmcache naming updates
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=018cf39316923f26e42...
Commit: 018cf39316923f26e42c25fc6e885b0ca46c88ba
Parent: 0c01a4c2a6bee3faaffe301ea74d76fa75eb8f91
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 21 11:35:28 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 21 11:35:28 2019 -0500
man: lvmcache naming updates
---
man/lvmcache.7_main | 73 ++++++++++++++++++++++++++++++---------------------
1 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index 0eefc89..985b79a 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -44,10 +44,10 @@ cache.
.nf
$ lvcreate -n fast -L Size vg /dev/fast
- $ lvs vg -o+devices
- LV VG Attr LSize Devices
- fast vg -wi------- xx.00m /dev/fast(0)
- main vg -wi------- yyy.00m /dev/slow(0)
+ $ lvs -a
+ LV Attr Type Devices
+ fast -wi------- linear /dev/fast
+ main -wi------- linear /dev/slow
.fi
.B 3. Start caching the main LV
@@ -64,35 +64,45 @@ using dm-writecache:
$ lvconvert --type writecache --cachevol fast vg/main
-using dm-cache with a cache pool:
+using dm-cache (with cachepool):
- $ lvconvert --type cache --cachepool fastpool vg/main
+ $ lvconvert --type cache --cachepool fast vg/main
.fi
.B 4. Display LVs
Once the fast LV has been attached to the main LV, lvm reports the main LV
type as either \fBcache\fP or \fBwritecache\fP depending on the type used.
-While attached, the fast LV is hidden, and only displayed when lvs is
-given -a. The _corig or _wcorig LV represents the original LV without the
-cache.
+While attached, the fast LV is hidden, and renamed with a _cvol or _cpool
+suffix. It is displayed by lvs -a. The _corig or _wcorig LV represents
+the original LV without the cache.
.nf
using dm-cache:
- $ lvs -a -o name,vgname,lvattr,origin,segtype,devices vg
- LV VG Attr Origin Type Devices
- [fast] vg Cwi-aoC--- linear /dev/fast(xx)
- main vg Cwi-a-C--- [main_corig] cache main_corig(0)
- [main_corig] vg owi-aoC--- linear /dev/slow(0)
+ $ lvs -a
+ LV Pool Type Devices
+ main [fast_cvol] cache main_corig(0)
+ [fast_cvol] linear /dev/fast
+ [main_corig] linear /dev/slow
using dm-writecache:
- $ lvs -a -o name,vgname,lvattr,origin,segtype,devices vg
- LV VG Attr Origin Type Devices
- [fast] vg -wi-ao---- linear /dev/fast(xx)
- main vg Cwi-a----- [main_wcorig] writecache main_wcorig(0)
- [main_wcorig] vg -wi-ao---- linear /dev/slow(0)
+ $ lvs -a
+ LV Pool Type Devices
+ main [fast_cvol] writecache main_wcorig(0)
+ [fast_cvol] linear /dev/fast
+ [main_wcorig] linear /dev/slow
+
+using dm-cache (with cachepool):
+
+ $ lvs -a
+ LV Pool Type Devices
+ main [fast_cpool] cache main_corig(0)
+ [fast_cpool] cache-pool fast_pool_cdata(0)
+ [fast_cpool_cdata] linear /dev/fast
+ [fast_cpool_cmeta] linear /dev/fast
+ [main_corig] linear /dev/slow
.fi
.B 5. Use the main LV
@@ -106,7 +116,12 @@ changes the type of the main LV back to what it was before the cache was
attached.
.nf
- $ lvconvert --splitcache vg/main
+ $ lvconvert --splitcache vg/main
+
+ $ lvs -a
+ LV VG Attr Type Devices
+ fast vg -wi------- linear /dev/fast
+ main vg -wi------- linear /dev/slow
.fi
@@ -122,7 +137,7 @@ attached.
.I LV
.br
-Pass this option a standard LV. With a cache vol, cache data and metadata
+Pass this option a standard LV. With a cachevol, cache data and metadata
are contained within the single LV. This is used with dm-writecache or
dm-cache.
@@ -252,15 +267,15 @@ LV that references two sub LVs, one for data and one for metadata.
To create a cache pool from two separate LVs:
.nf
-$ lvcreate -n fastpool -L DataSize vg /dev/fast1
-$ lvcreate -n fastpoolmeta -L MetadataSize vg /dev/fast2
-$ lvconvert --type cache-pool --poolmetadata fastpoolmeta vg/fastpool
+$ lvcreate -n fast -L DataSize vg /dev/fast1
+$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast2
+$ lvconvert --type cache-pool --poolmetadata fastmeta vg/fast
.fi
Then use the cache pool LV to start caching the main LV:
.nf
-$ lvconvert --type cache --cachepool fastpool vg/main
+$ lvconvert --type cache --cachepool fast vg/main
.fi
A variation of the same procedure automatically creates a cache pool when
@@ -271,10 +286,9 @@ cache pool LV from the two specified LVs, and use the cache pool to start
caching the main LV.
.nf
-$ lvcreate -n fastpool -L DataSize vg /dev/fast1
-$ lvcreate -n fastpoolmeta -L MetadataSize vg /dev/fast2
-$ lvconvert --type cache --cachepool fastpool \\
- --poolmetadata fastpoolmeta vg/main
+$ lvcreate -n fast -L DataSize vg /dev/fast1
+$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast2
+$ lvconvert --type cache --cachepool fast --poolmetadata fastmeta vg/main
.fi
.SS dm-cache cache modes
@@ -433,7 +447,6 @@ normal lvcreate commands in which --type specifies the type of the newly
created LV. In this case, an LV with type cache-pool is being created,
and the existing main LV is being converted to type cache.)
-\&
.SH SEE ALSO
.BR lvm.conf (5),
4 years, 7 months
master - gcc: avoid warning: declaration of xxx shadows a global declaration
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0c01a4c2a6bee3faaff...
Commit: 0c01a4c2a6bee3faaffe301ea74d76fa75eb8f91
Parent: 644186e9204bfca21a6b3ca9dcc8256b93a74c15
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 21 12:32:11 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 21 15:32:35 2019 +0200
gcc: avoid warning: declaration of xxx shadows a global declaration
Fix some gcc complaints again shadowing global declarations
---
lib/cache/lvmcache.c | 10 +++++-----
lib/metadata/metadata.c | 14 +++++++-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index f6e7924..99818de 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -527,7 +527,7 @@ static void _choose_duplicates(struct cmd_context *cmd,
struct lvmcache_info *info;
struct device *dev1, *dev2;
uint32_t dev1_major, dev1_minor, dev2_major, dev2_minor;
- uint64_t dev1_size, dev2_size, pv_size;
+ uint64_t dev1_size, dev2_size, pvsummary_size;
int in_subsys1, in_subsys2;
int is_dm1, is_dm2;
int has_fs1, has_fs2;
@@ -655,9 +655,9 @@ next:
if (!dev_get_size(dev2, &dev2_size))
dev2_size = 0;
- pv_size = _get_pvsummary_size(devl->dev->pvid);
- same_size1 = (dev1_size == pv_size);
- same_size2 = (dev2_size == pv_size);
+ pvsummary_size = _get_pvsummary_size(devl->dev->pvid);
+ same_size1 = (dev1_size == pvsummary_size);
+ same_size2 = (dev2_size == pvsummary_size);
if ((device_hint = _get_pvsummary_device_hint(devl->dev->pvid))) {
same_name1 = !strcmp(device_hint, dev_name(dev1));
@@ -684,7 +684,7 @@ next:
log_debug_cache("PV %s: size %llu. %s is %llu. %s is %llu.",
devl->dev->pvid,
- (unsigned long long)pv_size,
+ (unsigned long long)pvsummary_size,
dev_name(dev1), (unsigned long long)dev1_size,
dev_name(dev2), (unsigned long long)dev2_size);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 3174ae0..45a83bd 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4884,7 +4884,7 @@ out:
}
struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const char *vgid,
- uint32_t read_flags, uint32_t lockd_state,
+ uint32_t vg_read_flags, uint32_t lockd_state,
uint32_t *error_flags, struct volume_group **error_vg)
{
char uuidstr[64] __attribute__((aligned(8)));
@@ -4894,8 +4894,8 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
int missing_pv_dev = 0;
int missing_pv_flag = 0;
uint32_t failure = 0;
- int writing = (read_flags & READ_FOR_UPDATE);
- int activating = (read_flags & READ_FOR_ACTIVATE);
+ int writing = (vg_read_flags & READ_FOR_UPDATE);
+ int activating = (vg_read_flags & READ_FOR_ACTIVATE);
if (is_orphan_vg(vg_name)) {
log_very_verbose("Reading orphan VG %s", vg_name);
@@ -4921,7 +4921,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
* of needing to write to them.
*/
- if (!(read_flags & READ_WITHOUT_LOCK) &&
+ if (!(vg_read_flags & READ_WITHOUT_LOCK) &&
!lock_vol(cmd, vg_name, (writing || activating) ? LCK_VG_WRITE : LCK_VG_READ, NULL)) {
log_error("Can't get lock for %s", vg_name);
failure |= FAILED_LOCKING;
@@ -4930,7 +4930,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
if (!(vg = _vg_read(cmd, vg_name, vgid, 0, writing))) {
/* Some callers don't care if the VG doesn't exist and don't want an error message. */
- if (!(read_flags & READ_OK_NOTFOUND))
+ if (!(vg_read_flags & READ_OK_NOTFOUND))
log_error("Volume group \"%s\" not found", vg_name);
failure |= FAILED_NOTFOUND;
goto_bad;
@@ -5164,12 +5164,12 @@ bad:
* so vg_read should acquire an exclusive file lock on the vg.
*/
struct volume_group *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
- const char *vgid, uint32_t read_flags, uint32_t lockd_state)
+ const char *vgid, uint32_t vg_read_flags, uint32_t lockd_state)
{
struct volume_group *vg;
uint32_t error_flags = 0;
- vg = vg_read(cmd, vg_name, vgid, read_flags | READ_FOR_UPDATE, lockd_state, &error_flags, NULL);
+ vg = vg_read(cmd, vg_name, vgid, vg_read_flags | READ_FOR_UPDATE, lockd_state, &error_flags, NULL);
return vg;
}
4 years, 7 months
master - gcc: all paths will set ret
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=644186e9204bfca21a6...
Commit: 644186e9204bfca21a6b3ca9dcc8256b93a74c15
Parent: f61d828c86d2b6466224290b9a1ffdaa16419f3d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 21 12:25:04 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 21 15:32:35 2019 +0200
gcc: all paths will set ret
Set success on common path.
Fixes random failure on writecache uncaching path.
---
tools/lvconvert.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e033e71..c312956 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4757,7 +4757,7 @@ static int _lvconvert_split_cache_single(struct cmd_context *cmd,
if (lvremove_single(cmd, lv_fast, NULL) != ECMD_PROCESSED)
return ECMD_FAILED;
}
-
+ ret = 1;
} else if (lv_is_cache(lv_main) && lv_is_cache_vol(lv_fast)) {
if (cmd->command->command_enum == lvconvert_split_and_remove_cache_CMD) {
ret = _lvconvert_split_and_remove_cachevol(cmd, lv_main, lv_fast);
4 years, 7 months
master - gcc: older compiler is happier with this initilizer
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f61d828c86d2b646622...
Commit: f61d828c86d2b6466224290b9a1ffdaa16419f3d
Parent: a0e40bad1d7c2a93d0dfd9ad27542673ee5300a5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 21 12:24:40 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 21 15:32:35 2019 +0200
gcc: older compiler is happier with this initilizer
---
lib/activate/dev_manager.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 9e4dba4..a2e9039 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2372,7 +2372,7 @@ static int _add_cvol_subdev_to_dtree(struct dev_manager *dm, struct dm_tree *dtr
struct lv_segment *lvseg = first_seg(lv);
struct dm_info info;
char *name ,*dlid;
- union lvid lvid = { 0 };
+ union lvid lvid = { { { "" } } };
memcpy(&lvid.id[0], &lv->vg->id, sizeof(struct id));
/* When ID is provided in form of metadata_id or data_id, otherwise use CVOL ID */
4 years, 7 months
master - tests: used cache_pool adds _cpool
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0e40bad1d7c2a93d0d...
Commit: a0e40bad1d7c2a93d0dfd9ad27542673ee5300a5
Parent: dd7629ea090d4e55de057b772e9eb9470a49e05b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 21 15:11:51 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 21 15:32:35 2019 +0200
tests: used cache_pool adds _cpool
---
test/shell/cache-single-options.sh | 2 +-
test/shell/component-cache.sh | 4 +-
test/shell/lvconvert-cache-raid.sh | 48 ++++++++++++++++----------------
test/shell/lvconvert-snapshot-cache.sh | 18 ++++++------
test/shell/lvcreate-cache.sh | 22 +++++++-------
test/shell/lvrename-cache-thin.sh | 6 ++--
test/shell/pvmove-cache-segtypes.sh | 12 ++++----
7 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/test/shell/cache-single-options.sh b/test/shell/cache-single-options.sh
index 6b71b2f..3be88d2 100644
--- a/test/shell/cache-single-options.sh
+++ b/test/shell/cache-single-options.sh
@@ -262,7 +262,7 @@ lvs -a -o+segtype $vg
check lv_field $vg/$lv5 segtype cache
# check lv_field doesn't work for hidden lvs
-lvs -a -o segtype $vg/$lv3 > segtype
+lvs -a -o segtype $vg/${lv3}_cpool > segtype
grep cache-pool segtype
lvconvert --splitcache $vg/$lv5
diff --git a/test/shell/component-cache.sh b/test/shell/component-cache.sh
index 87ca958..7234504 100644
--- a/test/shell/component-cache.sh
+++ b/test/shell/component-cache.sh
@@ -29,7 +29,7 @@ for j in 1 2
do
# Activate supported components
-for i in cpool_cmeta cpool_cdata corigin_corig
+for i in cpool_cpool_cmeta cpool_cpool_cdata corigin_corig
do
test ! -e "$DM_DEV_DIR/$vg/$i"
lvchange -ay -y $vg/$i
@@ -73,7 +73,7 @@ lvcreate -H -L 4 -n tpool --cachepool $vg/cpool
lvchange -an $vg
lvs -a $vg
# Cannot convert to thin-pool with component LV active
-lvchange -ay -y $vg/cpool_cmeta
+lvchange -ay -y $vg/cpool_cpool_cmeta
# Conversion does not need to activate data device, so it can proceed ??
lvconvert -y --thinpool $vg/tpool
diff --git a/test/shell/lvconvert-cache-raid.sh b/test/shell/lvconvert-cache-raid.sh
index 465def7..033376d 100644
--- a/test/shell/lvconvert-cache-raid.sh
+++ b/test/shell/lvconvert-cache-raid.sh
@@ -60,25 +60,25 @@ lvs -a -o+seg_pe_ranges $vg
lvconvert --yes --type cache-pool --poolmetadata $vg/cpool_meta $vg/cpool
lvcreate -n corigin --type cache --cachepool $vg/cpool -l 10
-lvchange --syncaction repair $vg/cpool_cmeta
-aux wait_for_sync $vg cpool_cmeta
+lvchange --syncaction repair $vg/cpool_cpool_cmeta
+aux wait_for_sync $vg cpool_cpool_cmeta
-lvchange --syncaction repair $vg/cpool_cdata
-aux wait_for_sync $vg cpool_cdata
+lvchange --syncaction repair $vg/cpool_cpool_cdata
+aux wait_for_sync $vg cpool_cpool_cdata
-lvconvert -y --repair $vg/cpool_cmeta
-lvconvert -y --repair $vg/cpool_cdata
+lvconvert -y --repair $vg/cpool_cpool_cmeta
+lvconvert -y --repair $vg/cpool_cpool_cdata
# do not allow reserved names for *new* LVs
-not lvconvert --splitmirrors 1 --name split_cmeta $vg/cpool_cmeta "$dev1"
-not lvconvert --splitmirrors 1 --name split_cdata $vg/cpool_cdata "$dev1"
+not lvconvert --splitmirrors 1 --name split_cmeta $vg/cpool_cpool_cmeta "$dev1"
+not lvconvert --splitmirrors 1 --name split_cdata $vg/cpool_cpool_cdata "$dev1"
# but allow manipulating existing LVs with reserved names
-aux wait_for_sync $vg cpool_cmeta
-aux wait_for_sync $vg cpool_cdata
-lvconvert --yes --splitmirrors 1 --name split_meta $vg/cpool_cmeta "$dev1"
-lvconvert --yes --splitmirrors 1 --name split_data $vg/cpool_cdata "$dev1"
-not lvconvert --splitmirrors 1 --name split_data $vg/cpool_cdata "$dev1"
+aux wait_for_sync $vg cpool_cpool_cmeta
+aux wait_for_sync $vg cpool_cpool_cdata
+lvconvert --yes --splitmirrors 1 --name split_meta $vg/cpool_cpool_cmeta "$dev1"
+lvconvert --yes --splitmirrors 1 --name split_data $vg/cpool_cpool_cdata "$dev1"
+not lvconvert --splitmirrors 1 --name split_data $vg/cpool_cpool_cdata "$dev1"
lvremove -f $vg
@@ -91,24 +91,24 @@ lvconvert -y --type cache-pool $vg/cp1
lvcreate -l 20 -n co1 $vg
lvconvert -y --type cache --cachepool cp1 $vg/co1
-lvconvert -y -m +1 --type raid1 $vg/cp1_cmeta
-check lv_field $vg/cp1_cmeta layout "raid,raid1"
-check lv_field $vg/cp1_cmeta role "private,cache,pool,metadata"
+lvconvert -y -m +1 --type raid1 $vg/cp1_cpool_cmeta
+check lv_field $vg/cp1_cpool_cmeta layout "raid,raid1"
+check lv_field $vg/cp1_cpool_cmeta role "private,cache,pool,metadata"
-lvconvert -y -m +1 --type raid1 $vg/cp1_cdata
-check lv_field $vg/cp1_cdata layout "raid,raid1"
-check lv_field $vg/cp1_cdata role "private,cache,pool,data"
+lvconvert -y -m +1 --type raid1 $vg/cp1_cpool_cdata
+check lv_field $vg/cp1_cpool_cdata layout "raid,raid1"
+check lv_field $vg/cp1_cpool_cdata role "private,cache,pool,data"
sleep 5
lvs -a -o+devices $vg
-not lvconvert -m -1 $vg/cp1_cmeta
+not lvconvert -m -1 $vg/cp1_cpool_cmeta
-lvconvert -y -m -1 $vg/cp1_cmeta
-check lv_field $vg/cp1_cmeta layout "linear"
-lvconvert -y -m -1 $vg/cp1_cdata
-check lv_field $vg/cp1_cdata layout "linear"
+lvconvert -y -m -1 $vg/cp1_cpool_cmeta
+check lv_field $vg/cp1_cpool_cmeta layout "linear"
+lvconvert -y -m -1 $vg/cp1_cpool_cdata
+check lv_field $vg/cp1_cpool_cdata layout "linear"
lvremove -f $vg
diff --git a/test/shell/lvconvert-snapshot-cache.sh b/test/shell/lvconvert-snapshot-cache.sh
index d32f4c2..9cb383a 100644
--- a/test/shell/lvconvert-snapshot-cache.sh
+++ b/test/shell/lvconvert-snapshot-cache.sh
@@ -32,38 +32,38 @@ lvcreate -aey -L1 -n ch $vg
lvcreate -H -L1 -n cpool $vg/ch
# Cannot create snapshot of cpool
-not lvcreate -s -L1 $vg/cpool 2>&1 | tee err
+not lvcreate -s -L1 $vg/cpool_cpool 2>&1 | tee err
grep "not supported" err
# Cannot create snapshot of cpool's meta
-not lvcreate -s -L1 $vg/cpool_cmeta 2>&1 | tee err
+not lvcreate -s -L1 $vg/cpool_cpool_cmeta 2>&1 | tee err
grep "not supported" err
# Cannot create snapshot of cpool's data
-not lvcreate -s -L1 $vg/cpool_cdata 2>&1 | tee err
+not lvcreate -s -L1 $vg/cpool_cpool_cdata 2>&1 | tee err
grep "not supported" err
# Cannot use cache-type as COW
not lvconvert --yes --type snapshot $vg/cow $vg/ch 2>&1 | tee err
grep "not accept" err
-not lvconvert --yes --type snapshot $vg/cow $vg/cpool 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cpool 2>&1 | tee err
grep "not accept" err
-not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cdata 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cpool_cdata 2>&1 | tee err
grep "lv_is_visible" err
-not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cmeta 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cpool_cmeta 2>&1 | tee err
grep "lv_is_visible" err
# Cannot use thin-pool, _tdata, _tmeta as origin
-not lvconvert --yes --type snapshot $vg/cpool $vg/cow 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cpool_cpool $vg/cow 2>&1 | tee err
grep "not supported" err
-not lvconvert --yes --type snapshot $vg/cpool_cdata $vg/cow 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cpool_cpool_cdata $vg/cow 2>&1 | tee err
grep "not supported" err
-not lvconvert --yes --type snapshot $vg/cpool_cmeta $vg/cow 2>&1 | tee err
+not lvconvert --yes --type snapshot $vg/cpool_cpool_cmeta $vg/cow 2>&1 | tee err
grep "not supported" err
lvconvert --yes -s $vg/ch $vg/cow
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 0663033..2c46e21 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -98,11 +98,11 @@ check lv_field $vg/$lv1 copy_percent "0.00"
# there should be something present (value differs per policy version)
test -n "$(get lv_field $vg/$lv1 data_percent)"
test -n "$(get lv_field $vg/$lv1 metadata_percent)"
-check lv_field $vg/cpool copy_percent "0.00"
-test -n "$(get lv_field $vg/cpool data_percent)"
-test -n "$(get lv_field $vg/cpool metadata_percent)"
+check lv_field $vg/cpool_cpool copy_percent "0.00"
+test -n "$(get lv_field $vg/cpool_cpool data_percent)"
+test -n "$(get lv_field $vg/cpool_cpool metadata_percent)"
# check we also display percent value for segmented output (-o+devices)
-lvs -a -o+devices $vg/cpool | tee out
+lvs -a -o+devices $vg/cpool_cpool | tee out
grep "0.00" out
lvremove -f $vg
@@ -155,8 +155,8 @@ check lv_not_exists $vg $lv1 pool1 pool1_cdata pool1_cmeta
# Removal of cache pool leaves origin uncached
check lv_field $vg/$lv2 segtype "cache"
-lvremove -f $vg/pool2
-check lv_not_exists $vg pool2 pool2_cdata pool2_cmeta
+lvremove -f $vg/pool2_cpool
+check lv_not_exists $vg pool2_cpool pool2_cpool_cdata pool2_cpool_cmeta
check lv_field $vg/$lv2 segtype "linear"
lvremove -f $vg
@@ -193,7 +193,7 @@ lvcreate -an -l1 -n $vg/$lv1
# do not allow stripping for cache-pool
fail lvcreate -H -i 2 -l1 -n cpool1 $vg/$lv1
lvcreate -H -l1 -n cpool1 $vg/$lv1
-check lv_attr_bit perm $vg/cpool1 "w"
+check lv_attr_bit perm $vg/cpool1_cpool "w"
check lv_attr_bit perm $vg/${lv1}_corig "w"
check lv_attr_bit perm $vg/$lv1 "w"
@@ -204,16 +204,16 @@ fail lvcreate -H -l1 -pr -n cpool2 $vg/$lv2
# read-only origin and -pr => read-only cache + origin
lvcreate -an -pr -l1 -n $vg/$lv3
lvcreate -an -H -l1 -pr -n cpool3 $vg/$lv3
-check lv_attr_bit perm $vg/cpool3 "w"
+check lv_attr_bit perm $vg/cpool3_cpool "w"
check lv_attr_bit perm $vg/${lv3}_corig "r"
check lv_attr_bit perm $vg/$lv3 "r"
check inactive $vg $lv3
-check inactive $vg cpool3
+check inactive $vg cpool3_cpool
# read-only origin and 'default' => read-only cache + origin
lvcreate -an -pr -l1 -n $vg/$lv4
lvcreate -H -l1 -n cpool4 $vg/$lv4
-check lv_attr_bit perm $vg/cpool4 "w"
+check lv_attr_bit perm $vg/cpool4_cpool "w"
check lv_attr_bit perm $vg/${lv4}_corig "r"
check lv_attr_bit perm $vg/$lv4 "r"
@@ -224,7 +224,7 @@ fail lvcreate -H -l1 -prw -n cpool5 $vg/$lv5
# cached volume respects permissions
lvcreate --type cache-pool -l1 -n $vg/cpool
lvcreate -H -l1 -pr -n $lv6 $vg/cpool
-check lv_attr_bit perm $vg/cpool "w"
+check lv_attr_bit perm $vg/cpool_cpool "w"
check lv_attr_bit perm $vg/$lv6 "r"
lvremove -f $vg
diff --git a/test/shell/lvrename-cache-thin.sh b/test/shell/lvrename-cache-thin.sh
index 0697d1c..a77a2c1 100644
--- a/test/shell/lvrename-cache-thin.sh
+++ b/test/shell/lvrename-cache-thin.sh
@@ -38,14 +38,14 @@ lvcreate -V10 $vg/tpool
# check cache pool remains same after thin-pool rename
lvrename $vg/tpool $vg/newpool
-check lv_exists $vg newpool cpool
+check lv_exists $vg newpool cpool_cpool
check lv_not_exists $vg tpool
# allowing rename of internal cache pool
-lvrename $vg/cpool $vg/cachepool
+lvrename $vg/cpool_cpool $vg/cachepool
check lv_exists $vg cachepool
-check lv_not_exists $vg cpool
+check lv_not_exists $vg cpool_cpool
lvs -a $vg
diff --git a/test/shell/pvmove-cache-segtypes.sh b/test/shell/pvmove-cache-segtypes.sh
index b5b341d..0cd3a16 100644
--- a/test/shell/pvmove-cache-segtypes.sh
+++ b/test/shell/pvmove-cache-segtypes.sh
@@ -60,7 +60,7 @@ lvcreate --type cache-pool -n ${lv1}_pool -l 4 $vg "$dev5"
lvcreate --type cache -n $lv1 -l 8 $vg/${lv1}_pool "$dev1"
check lv_tree_on $vg ${lv1}_foo "$dev1"
-check lv_tree_on $vg ${lv1}_pool "$dev5"
+check lv_tree_on $vg ${lv1}_pool_cpool "$dev5"
check lv_tree_on $vg ${lv1} "$dev1"
aux mkdev_md5sum $vg $lv1
@@ -86,7 +86,7 @@ lvcreate --type raid1 -m 1 -l 8 -n $lv1 $vg "$dev1" "$dev2"
lvcreate --type cache -l 4 -n ${lv1}_pool $vg/$lv1 "$dev5"
check lv_tree_on $vg ${lv1}_foo "$dev1"
check lv_tree_on $vg ${lv1} "$dev1" "$dev2"
-check lv_tree_on $vg ${lv1}_pool "$dev5"
+check lv_tree_on $vg ${lv1}_pool_cpool "$dev5"
aux mkdev_md5sum $vg $lv1
pvmove $mode "$dev1" "$dev3" 2>&1 | tee out
@@ -113,7 +113,7 @@ lvconvert --yes --type cache-pool $vg/${lv1}_pool --poolmetadata $vg/meta
lvcreate --type cache -n $lv1 -L 8M $vg/${lv1}_pool "$dev5"
check lv_tree_on $vg ${lv1}_foo "$dev1"
-check lv_tree_on $vg ${lv1}_pool "$dev1" "$dev2"
+check lv_tree_on $vg ${lv1}_pool_cpool "$dev1" "$dev2"
check lv_tree_on $vg ${lv1} "$dev5"
aux mkdev_md5sum $vg $lv1
@@ -121,7 +121,7 @@ aux mkdev_md5sum $vg $lv1
# LVs, both of which contain a RAID1 _rimage & _rmeta LV - 5 total LVs
pvmove $mode "$dev1" "$dev3" 2>&1 | tee out
check lv_tree_on $vg ${lv1}_foo "$dev3"
-not check lv_tree_on $vg ${lv1}_pool "$dev1"
+not check lv_tree_on $vg ${lv1}_pool_cpool "$dev1"
#check lv_tree_on $vg ${lv1} "$dev5"
#check dev_md5sum $vg $lv1
@@ -152,7 +152,7 @@ lvconvert --yes --thinpool $vg/thinpool --poolmetadata $vg/meta
lvcreate -T $vg/thinpool -V 20 -n thin_lv
check lv_tree_on $vg ${lv1}_foo "$dev1"
-check lv_tree_on $vg cachepool "$dev1" "$dev2"
+check lv_tree_on $vg cachepool_cpool "$dev1" "$dev2"
check lv_tree_on $vg thinpool "$dev1" "$dev3" "$dev4"
aux mkdev_md5sum $vg thin_lv
@@ -161,7 +161,7 @@ lvs -a -o name,attr,devices $vg
pvmove $mode "$dev1" "$dev5" 2>&1 | tee out
lvs -a -o name,attr,devices $vg
check lv_tree_on $vg ${lv1}_foo "$dev5"
-not check lv_tree_on $vg cachepool "$dev1"
+not check lv_tree_on $vg cachepool_cpool "$dev1"
check lv_tree_on $vg thinpool "$dev3" "$dev4" "$dev5" # Move non-cache tmeta
#check dev_md5sum $vg/thin_lv
4 years, 7 months