master - thin: properly check for status for max sizes metadata
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=109532290138d3b8b53...
Commit: 109532290138d3b8b535457150052b6bda4f797c
Parent: 3503ef23e30da87f16b881248be92842a774d7d9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 8 19:38:17 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 12 21:34:08 2017 +0200
thin: properly check for status for max sizes metadata
When metadata LV size was over DM_THIN_MAX_METADATA_SIZE sectors,
the info() routine was incorrectly trying to match bigger size,
while we do never pass any bigger device.
Fixing a case, where lvs should be displaying status for metadata
LV with 16GB size.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 5 +++++
test/shell/lvcreate-thin-big.sh | 5 +++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a597c42..bc958e2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.170 -
==================================
+ Look for limited thin pool metadata size when using 16G metadata.
Add lvconvert pool creation rule disallowing options with poolmetadata.
Fix lvconvert when the same LV is incorrectly reused in options.
Fix lvconvert VG name validation in option values.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index a2e399d..8f71771 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -260,6 +260,11 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
start *= seg_status->seg->le;
length *= _seg_len(seg_status->seg);
+ /* Uses max DM_THIN_MAX_METADATA_SIZE sectors for metadata device */
+ if (lv_is_thin_pool_metadata(seg_status->seg->lv) &&
+ (length > DM_THIN_MAX_METADATA_SIZE))
+ length = DM_THIN_MAX_METADATA_SIZE;
+
do {
target = dm_get_next_target(dmt, target, &target_start,
&target_length, &target_name, &target_params);
diff --git a/test/shell/lvcreate-thin-big.sh b/test/shell/lvcreate-thin-big.sh
index 9abc1fd..da7812f 100644
--- a/test/shell/lvcreate-thin-big.sh
+++ b/test/shell/lvcreate-thin-big.sh
@@ -37,6 +37,11 @@ lvcreate -L4M --chunksize 64k --poolmetadatasize 17G -T $vg/pool2 2>out
grep "WARNING: Maximum" out
check lv_field $vg/pool1_tmeta size "2.00m"
check lv_field $vg/pool2_tmeta size "16.00g"
+
+# Check can start and see thinpool with metadata size above kernel limit
+lvcreate -L4M --poolmetadatasize 16G -T $vg/poolM
+check lv_field $vg/poolM data_percent "0.00"
+
lvremove -ff $vg
# Test automatic calculation of pool metadata size
7 years
master - cmdline: ensure command struct is defined
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3503ef23e30da87f16b...
Commit: 3503ef23e30da87f16b881248be92842a774d7d9
Parent: 635e7e0c928aba62f7d6ddf892978ece6217b905
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 1 12:17:16 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200
cmdline: ensure command struct is defined
Make it clear to Coverity cmd will be defined.
---
tools/lvmcmdline.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4d20d08..4f66f7e 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1832,7 +1832,7 @@ static void _short_usage(const char *name)
static int _usage(const char *name, int longhelp, int skip_notes)
{
struct command_name *cname = find_command_name(name);
- struct command *cmd;
+ struct command *cmd = NULL;
int show_full = longhelp;
int i;
@@ -1876,6 +1876,11 @@ static int _usage(const char *name, int longhelp, int skip_notes)
}
/* Common options are printed once for all variants of a command name. */
+ if (!cmd) {
+ log_error(INTERNAL_ERROR "Command %s not found.", name);
+ return 0;
+ }
+
print_usage_common_cmd(cname, cmd);
print_usage_common_lvm(cname, cmd);
7 years
master - libdm: set min,maj
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=635e7e0c928aba62f7d...
Commit: 635e7e0c928aba62f7d6ddf892978ece6217b905
Parent: 3e3f2a53eaa5979d2c32b231f528e7b99c55675e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 1 12:13:37 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200
libdm: set min,maj
Reset derefered pointers instead of pointers.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 23f3ce5..2fa2566 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.139 -
==================================
+ Fix assignment in _target_version() when dm task can't run.
Flush stdout on each iteration when using --count or --interval.
Show detailed error message when execvp fails while starting dmfilemapd.
Fix segmentation fault when dmfilemapd is run with no arguments.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 80bfc1b..6ea710d 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2400,9 +2400,8 @@ static int _target_version(const char *target_name, uint32_t *maj,
if (!dm_task_run(dmt)) {
log_debug_activation("Failed to get %s target versions", target_name);
/* Assume this was because LIST_VERSIONS isn't supported */
- maj = min = patchlevel = 0;
+ *maj = *min = *patchlevel = 0;
r = 1;
-
} else
for (target = dm_task_get_versions(dmt);
target != last_target;
7 years
master - dmfilemapd: free path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3e3f2a53eaa5979d2c3...
Commit: 3e3f2a53eaa5979d2c32b231f528e7b99c55675e
Parent: dfc083d8d66cf3286908e9c7fc0c53bd1e5d4967
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 1 12:11:41 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200
dmfilemapd: free path
Cleanup resources before exit.
---
daemons/dmfilemapd/dmfilemapd.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index d232a83..2dd069a 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -533,6 +533,7 @@ static void _filemap_monitor_destroy(struct filemap_monitor *fm)
_filemap_monitor_close_fd(fm);
}
dm_free((void *) fm->program_id);
+ dm_free(fm->path);
}
static int _filemap_monitor_check_same_file(int fd1, int fd2)
@@ -800,8 +801,10 @@ int main(int argc, char **argv)
{
struct filemap_monitor fm;
- if (!_parse_args(argc, argv, &fm))
+ if (!_parse_args(argc, argv, &fm)) {
+ dm_free(fm.path);
return 1;
+ }
_setup_logging();
7 years
master - dmfilemapd: keep 1 byte for \0
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dfc083d8d66cf328690...
Commit: dfc083d8d66cf3286908e9c7fc0c53bd1e5d4967
Parent: 6c342abb7f4fd13126467f6ab2cdf5013f074695
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 1 12:05:49 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200
dmfilemapd: keep 1 byte for \0
Coverity noticed the buffer should have 1 byte for \0.
---
daemons/dmfilemapd/dmfilemapd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 88f8af2..d232a83 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -589,7 +589,7 @@ check_unlinked:
log_error("Could not format pid path.");
return 0;
}
- if ((len = readlink(path_buf, link_buf, sizeof(link_buf))) < 0) {
+ if ((len = readlink(path_buf, link_buf, sizeof(link_buf) - 1)) < 0) {
log_error("readlink failed for " DEFAULT_PROC_DIR "/%d/fd/%d.",
getpid(), fm->fd);
return 0;
7 years
master - commands: improve error message for option rules
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6c342abb7f4fd131264...
Commit: 6c342abb7f4fd13126467f6ab2cdf5013f074695
Parent: 4b121a1f6ff5dafc860f60d351284bd917e6042f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Apr 12 14:05:36 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 12 14:05:36 2017 -0500
commands: improve error message for option rules
When a cmd def RULE fails because of a disallowed
combination of options, improve the error message
to show the option combination, not just the options
that broke the rule.
---
tools/lvmcmdline.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 3626b1b..4d20d08 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1506,10 +1506,13 @@ static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp
/* The max number of unused options we keep track of to warn about */
#define MAX_UNUSED_COUNT 8
+#define MAX_OPTS_MSG 64
+
static struct command *_find_command(struct cmd_context *cmd, const char *path, int *argc, char **argv)
{
const char *name;
- char buf[64];
+ char opts_msg[MAX_OPTS_MSG];
+ char check_opts_msg[MAX_OPTS_MSG];
int match_required, match_ro, match_rp, match_type, match_unused, mismatch_required;
int best_i = 0, best_required = 0, best_type = 0, best_unused = 0;
int close_i = 0, close_ro = 0, close_type = 0;
@@ -1792,16 +1795,24 @@ out:
&opts_match_count, &opts_unmatch_count);
if (opts_match_count && (rule->rule == RULE_INVALID)) {
- memset(buf, 0, sizeof(buf));
- opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_error("Invalid options for command: %s", buf);
+ memset(opts_msg, 0, sizeof(opts_msg));
+ memset(check_opts_msg, 0, sizeof(check_opts_msg));
+
+ if (rule->opts_count)
+ opt_array_to_str(cmd, rule->opts, rule->opts_count, opts_msg, sizeof(opts_msg));
+ opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, check_opts_msg, sizeof(check_opts_msg));
+
+ if (rule->opts_count)
+ log_error("Invalid option combination: %s with %s", opts_msg, check_opts_msg);
+ else
+ log_error("Invalid options: %s", check_opts_msg);
return NULL;
}
if (opts_unmatch_count && (rule->rule == RULE_REQUIRE)) {
- memset(buf, 0, sizeof(buf));
- opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_error("Required options for command: %s", buf);
+ memset(check_opts_msg, 0, sizeof(check_opts_msg));
+ opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, check_opts_msg, sizeof(check_opts_msg));
+ log_error("Required options for command: %s", check_opts_msg);
return NULL;
}
}
7 years
master - WHATS_NEW: add items since last release
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b121a1f6ff5dafc860...
Commit: 4b121a1f6ff5dafc860f60d351284bd917e6042f
Parent: 61cfe2d55b145e16f841cc1e23a3939b7fd91d6d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Apr 12 13:45:37 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 12 13:45:37 2017 -0500
WHATS_NEW: add items since last release
---
WHATS_NEW | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 85636e8..a597c42 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,14 @@
Version 2.02.170 -
==================================
+ Add lvconvert pool creation rule disallowing options with poolmetadata.
+ Fix lvconvert when the same LV is incorrectly reused in options.
+ Fix lvconvert VG name validation in option values.
+ Fix missing lvmlockd LV locks in lvchange and lvconvert.
+ Fix dmeventd setup for lvchange --poll.
+ Fix use of --poll and --monitor with lvchange and vgchange.
+ Disallow lvconvert of hidden LV to a pool.
+ Ignore --partial option when not used for activation.
+ Allow --activationmode option with lvchange --refresh.
Better message on lvconvert --regionsize
Allow valid lvconvert --regionsize change
Add raid10 alias raid10_near
7 years
master - commands: add rule for lvconvert commands that create pools
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=61cfe2d55b145e16f84...
Commit: 61cfe2d55b145e16f841cc1e23a3939b7fd91d6d
Parent: 19e6c338d32a081a94fb210785f0443406d2ff66
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Apr 12 13:33:40 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 12 13:33:40 2017 -0500
commands: add rule for lvconvert commands that create pools
For an lvconvert command that creates a thin pool or cache pool,
--poolmetadata cannot be used with --readahead, --stripes or --stripesize.
---
tools/command-lines.in | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 5a3b520..2d9e48e 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -427,6 +427,7 @@ ID: lvconvert_to_thin_with_external
DESC: Convert LV to a thin LV, using the original LV as an external origin.
RULE: all and lv_is_visible
RULE: all not lv_is_locked
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type thin
lvconvert --thin --thinpool LV LV_linear_striped_raid_cache
@@ -437,6 +438,7 @@ DESC: (infers \\-\\-type thin).
FLAGS: SECONDARY_SYNTAX
RULE: all and lv_is_visible
RULE: all not lv_is_locked
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
---
@@ -445,6 +447,7 @@ OO: --cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_cache_vol
DESC: Convert LV to type cache.
RULE: all and lv_is_visible
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type cache
lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool
@@ -452,6 +455,7 @@ OO: --type cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_cache_vol
DESC: Convert LV to type cache (infers \\-\\-type cache).
RULE: all and lv_is_visible
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
FLAGS: SECONDARY_SYNTAX
---
@@ -464,6 +468,7 @@ ID: lvconvert_to_thinpool
DESC: Convert LV to type thin-pool.
RULE: all and lv_is_visible
RULE: all not lv_is_locked lv_is_origin lv_is_merging_origin lv_is_external_origin lv_is_virtual
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
# This command syntax has two different meanings depending on
# whether the LV pos arg is already a thin pool or not.
@@ -496,6 +501,7 @@ DESC: Convert LV to type thin-pool (variant, use \\-\\-type thin-pool).
DESC: Swap metadata LV in a thin pool (variant, use \\-\\-swapmetadata).
FLAGS: PREVIOUS_SYNTAX
RULE: all and lv_is_visible
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
---
@@ -504,6 +510,7 @@ OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_cachepool
DESC: Convert LV to type cache-pool.
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
# This command syntax has two different meanings depending on
# whether the LV pos arg is already a cache pool or not.
@@ -535,6 +542,7 @@ DESC: Convert LV to type cache-pool (variant, use \\-\\-type cache-pool).
DESC: Swap metadata LV in a cache pool (variant, use \\-\\-swapmetadata).
FLAGS: PREVIOUS_SYNTAX
RULE: all and lv_is_visible
+RULE: --poolmetadata not --readahead --stripesize --stripes_long
---
7 years
master - WHATS_NEW: add recent RAID entries
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19e6c338d32a081a94f...
Commit: 19e6c338d32a081a94fb210785f0443406d2ff66
Parent: 51a31dbd79e6fd9dc289250f875badd9afbff428
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Apr 12 19:41:55 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Apr 12 19:41:55 2017 +0200
WHATS_NEW: add recent RAID entries
---
WHATS_NEW | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 57e01d4..85636e8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,10 @@
Version 2.02.170 -
==================================
+ Better message on lvconvert --regionsize
+ Allow valid lvconvert --regionsize change
+ Add raid10 alias raid10_near
+ Handle insufficient PVs on lvconvert takeover
+ Fix SIGINT blocking to prevent corrupted metadata
Fix systemd unit existence check for lvmconf --services --startstopservices.
Check and use PATH_MAX buffers when creating vgrename device paths.
7 years
master - lvconvert: better message on --regionsize
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=51a31dbd79e6fd9dc28...
Commit: 51a31dbd79e6fd9dc289250f875badd9afbff428
Parent: f5b0697c0535a532aa81bcf78e59fb6d7cdd9fe0
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Apr 12 19:34:18 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Apr 12 19:34:18 2017 +0200
lvconvert: better message on --regionsize
Enhance message on "lvconvert --regionsize size RaidLV".
in case the regionsize does not change and return error.
---
lib/metadata/raid_manip.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index b58ba2d..d16d49f 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -5792,9 +5792,10 @@ static int _region_size_change_requested(struct logical_volume *lv, int yes, con
return_0;
if (region_size == seg->region_size) {
- log_print_unless_silent("Region size wouldn't change on %s LV %s.",
- lvseg_name(seg), display_lvname(lv));
- return 1;
+ log_error("Region size is already %s on %s LV %s.",
+ display_size(lv->vg->cmd, region_size),
+ lvseg_name(seg), display_lvname(lv));
+ return 0;
}
if (!_check_region_size_constraints(lv, seg->segtype, region_size, seg->stripe_size))
7 years