master - cache: runtime detect default policy
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=feb8e9a7907c91...
Commit: feb8e9a7907c91bd55769b4e3ae625434f2ba589
Parent: 8a74d1ec79d209aa8bce51821836179afe7d48f9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jul 26 23:05:11 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:17 2015 +0200
cache: runtime detect default policy
When the policy is not preset in lvm.conf,
detect in runtime whether to use 'mq' or
new available 'smq'.
---
WHATS_NEW | 1 +
lib/config/config.c | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 347fcd4..da0ef4d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Runtime detect presence of cache smq policy.
Add demo cache-mq and cache-smq profiles.
Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
Require cache_check 0.5.4 for use of --clear-needs-check-flag.
diff --git a/lib/config/config.c b/lib/config/config.c
index 436efff..cd6c1d8 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -23,6 +23,7 @@
#include "toolcontext.h"
#include "lvm-file.h"
#include "memlock.h"
+#include "segtype.h"
#include <sys/stat.h>
#include <sys/mman.h>
@@ -2418,5 +2419,24 @@ int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, st
const char *get_default_allocation_cache_policy_CFG(struct cmd_context *cmd, struct profile *profile)
{
- return DEFAULT_CACHE_POLICY;
+ const struct segment_type *segtype = get_segtype_from_string(cmd, "cache");
+ unsigned attr = ~0;
+
+ if (!segtype ||
+ !segtype->ops->target_present ||
+ !segtype->ops->target_present(cmd, NULL, &attr)) {
+ log_warn("WARNING: Cannot detect default cache policy, using \""
+ DEFAULT_CACHE_POLICY "\".");
+ return DEFAULT_CACHE_POLICY;
+ }
+
+ if (attr & CACHE_FEATURE_POLICY_SMQ)
+ return "smq";
+
+ if (attr & CACHE_FEATURE_POLICY_MQ)
+ return "mq";
+
+ log_warn("WARNING: Default cache policy not available.");
+
+ return NULL;
}
8 years, 8 months
master - cache: detect smq policy presence
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a74d1ec79d209...
Commit: 8a74d1ec79d209aa8bce51821836179afe7d48f9
Parent: 694c88e031fb44f957c75bea369b898e1dedf932
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 23 11:32:09 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:17 2015 +0200
cache: detect smq policy presence
Add code to detect available cache features.
Support policy_mq & policy_smq features which might be disabled.
Introduce global_cache_disabled_features_CFG.
---
lib/cache_segtype/cache.c | 73 ++++++++++++++++++++++++++++++++++++++++--
lib/config/config_settings.h | 8 ++++
lib/metadata/segtype.h | 3 ++
3 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 18c0168..d74fbf1 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -25,6 +25,11 @@
#include "lv_alloc.h"
#include "defaults.h"
+static const char _cache_module[] = "cache";
+
+/* TODO: using static field here, maybe should be a part of segment_type */
+static unsigned _feature_mask;
+
#define SEG_LOG_ERROR(t, p...) \
log_error(t " segment %s of logical volume %s.", ## p, \
dm_config_parent_name(sn), seg->lv->name), 0;
@@ -168,9 +173,26 @@ static int _target_present(struct cmd_context *cmd,
const struct lv_segment *seg __attribute__((unused)),
unsigned *attributes __attribute__((unused)))
{
- uint32_t maj, min, patchlevel;
+ /* List of features with their kernel target version */
+ static const struct feature {
+ uint32_t maj;
+ uint32_t min;
+ unsigned cache_feature;
+ const char feature[12];
+ const char module[12]; /* check dm-%s */
+ } _features[] = {
+ { 1, 3, CACHE_FEATURE_POLICY_MQ, "policy_mq", "cache-mq" },
+ { 1, 8, CACHE_FEATURE_POLICY_SMQ, "policy_smq", "cache-smq" },
+ };
+ static const char _lvmconf[] = "global/cache_disabled_features";
+ static unsigned _attrs = 0;
static int _cache_checked = 0;
static int _cache_present = 0;
+ uint32_t maj, min, patchlevel;
+ unsigned i;
+ const struct dm_config_node *cn;
+ const struct dm_config_value *cv;
+ const char *str;
if (!_cache_checked) {
_cache_present = target_present(cmd, "cache", 1);
@@ -184,11 +206,53 @@ static int _target_present(struct cmd_context *cmd,
if ((maj < 1) ||
((maj == 1) && (min < 3))) {
- log_error("The cache kernel module is version %u.%u.%u."
- " Version 1.3.0+ is required.",
+ _cache_present = 0;
+ log_error("The cache kernel module is version %u.%u.%u. "
+ "Version 1.3.0+ is required.",
maj, min, patchlevel);
return 0;
}
+
+
+ for (i = 0; i < DM_ARRAY_SIZE(_features); ++i) {
+ if (((maj > _features[i].maj) ||
+ (maj == _features[i].maj && min >= _features[i].min)) &&
+ (!_features[i].module[0] || module_present(cmd, _features[i].module)))
+ _attrs |= _features[i].cache_feature;
+ else
+ log_very_verbose("Target %s does not support %s.",
+ _cache_module, _features[i].feature);
+ }
+ }
+
+ if (attributes) {
+ if (!_feature_mask) {
+ /* Support runtime lvm.conf changes, N.B. avoid 32 feature */
+ if ((cn = find_config_tree_array(cmd, global_cache_disabled_features_CFG, NULL))) {
+ for (cv = cn->v; cv; cv = cv->next) {
+ if (cv->type != DM_CFG_STRING) {
+ log_error("Ignoring invalid string in config file %s.",
+ _lvmconf);
+ continue;
+ }
+ str = cv->v.str;
+ if (!*str)
+ continue;
+ for (i = 0; i < DM_ARRAY_SIZE(_features); ++i)
+ if (strcasecmp(str, _features[i].feature) == 0)
+ _feature_mask |= _features[i].cache_feature;
+ }
+ }
+
+ _feature_mask = ~_feature_mask;
+
+ for (i = 0; i < DM_ARRAY_SIZE(_features); ++i)
+ if ((_attrs & _features[i].cache_feature) &&
+ !(_feature_mask & _features[i].cache_feature))
+ log_very_verbose("Target %s %s support disabled by %s",
+ _cache_module, _features[i].feature, _lvmconf);
+ }
+ *attributes = _attrs & _feature_mask;
}
return _cache_present;
@@ -376,5 +440,8 @@ int init_cache_segtypes(struct cmd_context *cmd,
return_0;
log_very_verbose("Initialised segtype: %s", segtype->name);
+ /* Reset mask for recalc */
+ _feature_mask = 0;
+
return 1;
}
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index deb17ef..c8461f7 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -909,6 +909,14 @@ cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CF
"Example:\n"
"thin_disabled_features = [ \"discards\", \"block_size\" ]\n")
+cfg_array(global_cache_disabled_features_CFG, "cache_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 126), NULL, 0, NULL,
+ "Features to not use in the cache driver.\n"
+ "This can be helpful for testing, or to avoid\n"
+ "using a feature that is causing problems.\n"
+ "Features: policy_mq, policy_smq.\n"
+ "Example:\n"
+ "cache_disabled_features = [ \"policy_smq\" ]\n")
+
cfg(global_cache_check_executable_CFG, "cache_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, CACHE_CHECK_CMD, vsn(2, 2, 108), "@CACHE_CHECK_CMD@", 0, NULL,
"The full path to the cache_check command.\n"
"LVM uses this command to check that a cache metadata\n"
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
index 4b2df78..a80d5ed 100644
--- a/lib/metadata/segtype.h
+++ b/lib/metadata/segtype.h
@@ -191,6 +191,9 @@ int init_thin_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
int init_cache_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
#endif
+#define CACHE_FEATURE_POLICY_MQ (1U << 0)
+#define CACHE_FEATURE_POLICY_SMQ (1U << 1)
+
#define SNAPSHOT_FEATURE_FIXED_LEAK (1U << 0) /* version 1.12 */
#ifdef SNAPSHOT_INTERNAL
8 years, 8 months
master - cache: introduce mq and smq profiles
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=694c88e031fb44...
Commit: 694c88e031fb44f957c75bea369b898e1dedf932
Parent: 036d90bba6c1ac76195302bc5c7f2f5ce8ad89b4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 20 16:46:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:16 2015 +0200
cache: introduce mq and smq profiles
Add 2 demo profiles for mq and smq policies.
Show all support profilable params.
Use with: lvcreate --policy cache-mq ....
---
WHATS_NEW | 1 +
conf/Makefile.in | 8 ++++++--
conf/cache-mq.profile | 20 ++++++++++++++++++++
conf/cache-smq.profile | 14 ++++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9c8a103..347fcd4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Add demo cache-mq and cache-smq profiles.
Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
Require cache_check 0.5.4 for use of --clear-needs-check-flag.
Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
diff --git a/conf/Makefile.in b/conf/Makefile.in
index 43d5f75..128395e 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -20,7 +20,11 @@ CONFDEST=lvm.conf
CONFLOCAL=lvmlocal.conf
PROFILE_TEMPLATES=command_profile_template.profile metadata_profile_template.profile
-PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-generic.profile $(srcdir)/thin-performance.profile
+PROFILES=$(PROFILE_TEMPLATES) \
+ $(srcdir)/cache-mq.profile \
+ $(srcdir)/cache-smq.profile \
+ $(srcdir)/thin-generic.profile \
+ $(srcdir)/thin-performance.profile
include $(top_builddir)/make.tmpl
diff --git a/conf/cache-mq.profile b/conf/cache-mq.profile
new file mode 100644
index 0000000..3c90331
--- /dev/null
+++ b/conf/cache-mq.profile
@@ -0,0 +1,20 @@
+# Demo configuration 'mq' cache policy
+#
+# Note: This policy has been deprecated in favor of the smq policy
+# keyword "default" means, setting is left with kernel defaults.
+#
+
+allocation {
+ cache_pool_chunk_size = 64
+ cache_mode = "writethrough"
+ cache_policy = "mq"
+ cache_settings {
+ mq {
+ sequential_threshold = "default" # #nr_sequential_ios
+ random_threshold = "default" # #nr_random_ios
+ read_promote_adjustment = "default"
+ write_promote_adjustment = "default"
+ discard_promote_adjustment = "default"
+ }
+ }
+}
diff --git a/conf/cache-smq.profile b/conf/cache-smq.profile
new file mode 100644
index 0000000..c0d6266
--- /dev/null
+++ b/conf/cache-smq.profile
@@ -0,0 +1,14 @@
+# Demo configuration 'smq' cache policy
+#
+# The stochastic multi-queue (smq) policy addresses some of the problems
+# with the multiqueue (mq) policy and uses less memory.
+#
+
+allocation {
+ cache_pool_chunk_size = 64
+ cache_mode = "writethrough"
+ cache_policy = "smq"
+ cache_settings {
+ # currently no settins for "smq" policy
+ }
+}
8 years, 8 months
master - cache: add cache_policy cache_settings
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=036d90bba6c1ac...
Commit: 036d90bba6c1ac76195302bc5c7f2f5ce8ad89b4
Parent: 664a9f4830925cc3f51934dc09f9e2f3963c0de2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 20 11:44:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:16 2015 +0200
cache: add cache_policy cache_settings
Add new profilable configurables:
allocation/cache_policy
allocation/cache_settings
and mark allocation/cache_pool_chunk_size as profilable as well.
Obsolete allocation/cache_pool_cachemode and
introduce new allocation/cache_mode instead.
Rename DEFAULT_CACHE_POOL_POLICY to DEFAULT_CACHE_POLICY.
---
WHATS_NEW | 1 +
lib/cache_segtype/cache.c | 2 +-
lib/config/config.c | 5 +++++
lib/config/config.h | 2 ++
lib/config/config_settings.h | 24 +++++++++++++++++++++---
lib/config/defaults.h | 4 ++--
tools/toollib.c | 2 +-
7 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d28e06c..9c8a103 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
Require cache_check 0.5.4 for use of --clear-needs-check-flag.
Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index ad356a9..18c0168 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -79,7 +79,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Failed to duplicate policy in");
} else {
/* Cannot use 'just' default, so pick one */
- seg->policy_name = DEFAULT_CACHE_POOL_POLICY; /* FIXME make configurable */
+ seg->policy_name = DEFAULT_CACHE_POLICY; /* FIXME make configurable */
/* FIXME maybe here should be always 'mq' */
log_warn("WARNING: cache_policy undefined, using default \"%s\" policy.",
seg->policy_name);
diff --git a/lib/config/config.c b/lib/config/config.c
index eb8880e..436efff 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -2415,3 +2415,8 @@ int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, st
{
return DEFAULT_CACHE_POOL_CHUNK_SIZE * 2;
}
+
+const char *get_default_allocation_cache_policy_CFG(struct cmd_context *cmd, struct profile *profile)
+{
+ return DEFAULT_CACHE_POLICY;
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index 7520fc0..fb39e6e 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -296,5 +296,7 @@ int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, str
#define get_default_unconfigured_allocation_thin_pool_chunk_size_CFG NULL
int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
#define get_default_unconfigured_allocation_cache_pool_chunk_size_CFG NULL
+const char *get_default_allocation_cache_policy_CFG(struct cmd_context *cmd, struct profile *profile);
+#define get_default_unconfigured_allocation_cache_policy_CFG NULL
#endif
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 5209531..deb17ef 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -462,15 +462,33 @@ cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separa
cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL, 0, NULL,
"Cache pool metadata and data will always use different PVs.\n")
-cfg(allocation_cache_pool_cachemode_CFG, "cache_pool_cachemode", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_POOL_CACHEMODE, vsn(2, 2, 113), NULL, 0, NULL,
- "The default cache mode used for new cache pools.\n"
+cfg(allocation_cache_pool_cachemode_CFG, "cache_pool_cachemode", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_MODE, vsn(2, 2, 113), NULL, vsn(2, 2, 128),
+ "This has been replaced by the allocation/cache_mode setting.\n",
+ "Cache mode.\n")
+
+cfg(allocation_cache_mode_CFG, "cache_mode", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_MODE, vsn(2, 2, 128), NULL, 0, NULL,
+ "The default cache mode used for new cache.\n"
"Possible options are: writethrough, writeback.\n"
"writethrough - Data blocks are immediately written from\n"
"the cache to disk.\n"
"writeback - Data blocks are written from the cache back\n"
"to disk after some delay to improve performance.\n")
-cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), 0, NULL,
+cfg_runtime(allocation_cache_policy_CFG, "cache_policy", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, vsn(2, 2, 127), 0, NULL,
+ "The default cache policy used for new cache volume.\n"
+ "Generally available policies are: mq, smq.\n"
+ "mq - Multiqueue policy with 88 bytes per block\n"
+ "smq - Stochastic multique with 25 bytes per block (kernel >= 4.2).\n")
+
+cfg_section(allocation_cache_settings_CFG_SECTION, "cache_settings", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, vsn(2, 2, 127), 0, NULL,
+ "Individual settings for policies.\n"
+ "See the help for individual policies for more info.\n")
+
+cfg_section(policy_settings_CFG_SUBSECTION, "policy_settings", allocation_cache_settings_CFG_SECTION, CFG_NAME_VARIABLE | CFG_SECTION_NO_CHECK | CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, vsn(2, 2, 127), 0, NULL,
+ "Replace this subsection name with a policy name.\n"
+ "Multiple subsections for different policies can be created.\n")
+
+cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), 0, NULL,
"The minimal chunk size (in kiB) for cache pool volumes.\n"
"Using a chunk_size that is too large can result in wasteful\n"
"use of the cache, where small reads and writes can cause\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 5ee9b1c..f84eb19 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -117,8 +117,8 @@
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
#define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048 /* KB */
#define DEFAULT_CACHE_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
-#define DEFAULT_CACHE_POOL_CACHEMODE "writethrough"
-#define DEFAULT_CACHE_POOL_POLICY "mq"
+#define DEFAULT_CACHE_POLICY "mq"
+#define DEFAULT_CACHE_MODE "writethrough"
#define DEFAULT_UMASK 0077
diff --git a/tools/toollib.c b/tools/toollib.c
index 5d5e4d6..0d401e4 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1408,7 +1408,7 @@ int get_cache_policy_params(struct cmd_context *cmd, const char **name,
struct dm_config_node *cn;
int ok = 0;
- *name = arg_str_value(cmd, cachepolicy_ARG, DEFAULT_CACHE_POOL_POLICY);
+ *name = arg_str_value(cmd, cachepolicy_ARG, DEFAULT_CACHE_POLICY);
dm_list_iterate_items(group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(group->arg_values, cachesettings_ARG))
8 years, 8 months
master - configure: --clear-need-check-flag needs 0.5.4
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=664a9f4830925c...
Commit: 664a9f4830925cc3f51934dc09f9e2f3963c0de2
Parent: 3ea396e9d220cec55fd4e139be7ae486cb4ddb91
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 15 16:08:02 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:15 2015 +0200
configure: --clear-need-check-flag needs 0.5.4
Require version 5.4 of cache_check tool where this option
will work correctly.
---
WHATS_NEW | 1 +
configure | 25 ++++++++++++++++---------
configure.in | 25 ++++++++++++++++---------
3 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8241dc1..d28e06c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Require cache_check 0.5.4 for use of --clear-needs-check-flag.
Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
Version 2.02.127 - 10th August 2015
diff --git a/configure b/configure
index 07059b8..b17e5a3 100755
--- a/configure
+++ b/configure
@@ -8813,20 +8813,27 @@ $as_echo "$as_me: WARNING: cache_check not found in path $PATH" >&2;}
fi
fi
if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
- CACHE_CHECK_VSN=`"$CACHE_CHECK_CMD" -V 2>/dev/null`
- CACHE_CHECK_VSN_MAJOR=`echo "$CACHE_CHECK_VSN" | $AWK -F '.' '{print $1}'`
- CACHE_CHECK_VSN_MINOR=`echo "$CACHE_CHECK_VSN" | $AWK -F '.' '{print $2}'`
-
- if test -z "$CACHE_CHECK_VSN_MAJOR" -o -z "$CACHE_CHECK_VSN_MINOR"; then
+ $CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
+ read -r CACHE_CHECK_VSN < conftest.tmp
+ IFS=. read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH < conftest.tmp
+ rm -f conftest.tmp
+
+ # Require version >= 0.5.4 for --clear-needs-check-flag
+ if test -z "$CACHE_CHECK_VSN_MAJOR" \
+ || test -z "$CACHE_CHECK_VSN_MINOR" \
+ || test -z "$CACHE_CHECK_VSN_PATCH"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CACHE_CHECK_CMD: Bad version \"$CACHE_CHECK_VSN\" found" >&5
$as_echo "$as_me: WARNING: $CACHE_CHECK_CMD: Bad version \"$CACHE_CHECK_VSN\" found" >&2;}
CACHE_CHECK_VERSION_WARN=y
CACHE_CHECK_NEEDS_CHECK=no
- elif test "$CACHE_CHECK_VSN_MAJOR" -eq 0 -a "$CACHE_CHECK_VSN_MINOR" -lt 5; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CACHE_CHECK_CMD: Old version \"$CACHE_CHECK_VSN\" found" >&5
+ elif test "$CACHE_CHECK_VSN_MAJOR" -eq 0 ; then
+ if test "$CACHE_CHECK_VSN_MINOR" -lt 5 \
+ || test "$CACHE_CHECK_VSN_MINOR" -eq 5 -a "$CACHE_CHECK_VSN_PATCH" -lt 4; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CACHE_CHECK_CMD: Old version \"$CACHE_CHECK_VSN\" found" >&5
$as_echo "$as_me: WARNING: $CACHE_CHECK_CMD: Old version \"$CACHE_CHECK_VSN\" found" >&2;}
- CACHE_CHECK_VERSION_WARN=y
- CACHE_CHECK_NEEDS_CHECK=no
+ CACHE_CHECK_VERSION_WARN=y
+ CACHE_CHECK_NEEDS_CHECK=no
+ fi
fi
fi
# Empty means a config way to ignore cache dumping
diff --git a/configure.in b/configure.in
index 1825fb7..243b634 100644
--- a/configure.in
+++ b/configure.in
@@ -584,18 +584,25 @@ case "$CACHE" in
fi
fi
if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
- CACHE_CHECK_VSN=`"$CACHE_CHECK_CMD" -V 2>/dev/null`
- CACHE_CHECK_VSN_MAJOR=`echo "$CACHE_CHECK_VSN" | $AWK -F '.' '{print $1}'`
- CACHE_CHECK_VSN_MINOR=`echo "$CACHE_CHECK_VSN" | $AWK -F '.' '{print $2}'`
-
- if test -z "$CACHE_CHECK_VSN_MAJOR" -o -z "$CACHE_CHECK_VSN_MINOR"; then
+ $CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
+ read -r CACHE_CHECK_VSN < conftest.tmp
+ IFS=. read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH < conftest.tmp
+ rm -f conftest.tmp
+
+ # Require version >= 0.5.4 for --clear-needs-check-flag
+ if test -z "$CACHE_CHECK_VSN_MAJOR" \
+ || test -z "$CACHE_CHECK_VSN_MINOR" \
+ || test -z "$CACHE_CHECK_VSN_PATCH"; then
AC_MSG_WARN([$CACHE_CHECK_CMD: Bad version "$CACHE_CHECK_VSN" found])
CACHE_CHECK_VERSION_WARN=y
CACHE_CHECK_NEEDS_CHECK=no
- elif test "$CACHE_CHECK_VSN_MAJOR" -eq 0 -a "$CACHE_CHECK_VSN_MINOR" -lt 5; then
- AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" found])
- CACHE_CHECK_VERSION_WARN=y
- CACHE_CHECK_NEEDS_CHECK=no
+ elif test "$CACHE_CHECK_VSN_MAJOR" -eq 0 ; then
+ if test "$CACHE_CHECK_VSN_MINOR" -lt 5 \
+ || test "$CACHE_CHECK_VSN_MINOR" -eq 5 -a "$CACHE_CHECK_VSN_PATCH" -lt 4; then
+ AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" found])
+ CACHE_CHECK_VERSION_WARN=y
+ CACHE_CHECK_NEEDS_CHECK=no
+ fi
fi
fi
# Empty means a config way to ignore cache dumping
8 years, 8 months
master - udev: use += for SYSTEMD_WANTS instead of =
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3ea396e9d220ce...
Commit: 3ea396e9d220cec55fd4e139be7ae486cb4ddb91
Parent: 819dc1845edcf48e0f3eb282a6d8b9ace8cb1a1b
Author: Thomas Bächler <thomas(a)archlinux.org>
AuthorDate: Wed Aug 12 09:29:04 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Aug 12 09:33:06 2015 +0200
udev: use += for SYSTEMD_WANTS instead of =
Instead of using = to override SYSTEMD_WANTS, use += to add
the pvscan service.
---
WHATS_NEW | 1 +
udev/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 71c41d2..8241dc1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
Version 2.02.127 - 10th August 2015
===================================
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 390069b..c4cc2bd 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -47,7 +47,7 @@ BLKID_RULE=IMPORT{program}=\"${SBIN}\/blkid -o udev -p \$$tempnode\"
endif
ifeq ("@UDEV_SYSTEMD_BACKGROUND_JOBS@", "yes")
-PVSCAN_RULE=ACTION\!=\"remove\", ENV{LVM_PV_GONE}==\"1\", RUN\+=\"@bindir@/systemd-run $(LVM_EXEC)\/lvm pvscan --cache \$$major\:\$$minor\", GOTO=\"lvm_end\"\nENV{SYSTEMD_ALIAS}=\"\/dev\/block\/\$$major:\$$minor\"\nENV{ID_MODEL}=\"LVM PV \$$env{ID_FS_UUID_ENC} on \/dev\/\$$name\"\nENV{SYSTEMD_WANTS}=\"lvm2-pvscan@\$$major:\$$minor.service\"
+PVSCAN_RULE=ACTION\!=\"remove\", ENV{LVM_PV_GONE}==\"1\", RUN\+=\"@bindir@/systemd-run $(LVM_EXEC)\/lvm pvscan --cache \$$major\:\$$minor\", GOTO=\"lvm_end\"\nENV{SYSTEMD_ALIAS}=\"\/dev\/block\/\$$major:\$$minor\"\nENV{ID_MODEL}=\"LVM PV \$$env{ID_FS_UUID_ENC} on \/dev\/\$$name\"\nENV{SYSTEMD_WANTS}+=\"lvm2-pvscan@\$$major:\$$minor.service\"
else
PVSCAN_RULE=RUN\+\=\"$(LVM_EXEC)/lvm pvscan --background --cache --activate ay --major \$$major --minor \$$minor\", ENV{LVM_SCANNED}=\"1\"
endif
8 years, 8 months
master - lvconvert: fix lockd LV locking
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=819dc1845edcf4...
Commit: 819dc1845edcf48e0f3eb282a6d8b9ace8cb1a1b
Parent: 53c08f0bba9f18df80403eab67acb032f3049902
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Aug 11 12:12:22 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Aug 11 12:17:24 2015 -0500
lvconvert: fix lockd LV locking
Request a transient LV lock from lvmlockd when
converting an LV. If the LV is inactive when
lvconvert is run, the LV lock will be acquired
and then released when the command is done.
If the LV is active, a persistent lock exists
already and the transient lock request does nothing.
This fixes the issue that had been mentioned in the
comment previously.
---
tools/lvconvert.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6a0e0ca..3a7f9ae 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3427,14 +3427,12 @@ static int lvconvert_single(struct cmd_context *cmd, struct lvconvert_params *lp
}
/*
- * If the lv is inactive before and after the command, the
- * use of PERSISTENT here means the lv will remain locked as
- * an effect of running the lvconvert.
- * To unlock it, it would need to be activated+deactivated.
- * Or, we could identify the commands for which the lv remains
- * inactive, and not use PERSISTENT here for those cases.
+ * Request a transient lock. If the LV is active, it has a persistent
+ * lock already, and this request does nothing. If the LV is not
+ * active, this acquires a transient lock that will be released when
+ * the command exits.
*/
- if (!lockd_lv(cmd, lv, "ex", LDLV_PERSISTENT))
+ if (!lockd_lv(cmd, lv, "ex", 0))
goto_bad;
/*
8 years, 8 months
master - lvrename: fix lockd LV locking
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=53c08f0bba9f18...
Commit: 53c08f0bba9f18df80403eab67acb032f3049902
Parent: 597de9d58673f141bf21aa9db899d13ca2c97b7b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 10 15:46:21 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 10 15:46:21 2015 -0500
lvrename: fix lockd LV locking
lvrename should not be done if the LV is active on another host.
This check was mistakenly removed when the code was changed to
use LV uuids in locks rather than LV names.
---
lib/metadata/lv_manip.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 86411d5..b22773e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4205,6 +4205,18 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
+ /*
+ * The lvmlockd LV lock is only acquired here to ensure the LV is not
+ * active on another host. This requests a transient LV lock.
+ * If the LV is active, a persistent LV lock already exists in
+ * lvmlockd, and the transient lock request does nothing.
+ * If the LV is not active, then no LV lock exists and the transient
+ * lock request acquires the LV lock (or fails). The transient lock
+ * is automatically released when the command exits.
+ */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_0;
+
if (update_mda && !archive(vg))
return_0;
8 years, 8 months
master - lvmlockd: add LV name to some debug logging
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=597de9d58673f1...
Commit: 597de9d58673f141bf21aa9db899d13ca2c97b7b
Parent: f072a7632655d0541b56858d5fbe172fa6075e68
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 10 15:05:41 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 10 15:07:10 2015 -0500
lvmlockd: add LV name to some debug logging
The LV uuid is used as the lock name, and including
the LV name in some log messages makes it easier to
follow log messages.
---
daemons/lvmlockd/lvmlockd-core.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 5e4e73f..86bb89b 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -1022,7 +1022,10 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act
uint32_t r_version = 0;
int rv;
- log_debug("S %s R %s res_lock mode %s", ls->name, r->name, mode_str(act->mode));
+ if (r->type == LD_RT_LV)
+ log_debug("S %s R %s res_lock mode %s (%s)", ls->name, r->name, mode_str(act->mode), act->lv_name);
+ else
+ log_debug("S %s R %s res_lock mode %s", ls->name, r->name, mode_str(act->mode));
if (r->mode == LD_LK_SH && act->mode == LD_LK_SH)
goto add_lk;
@@ -1284,8 +1287,12 @@ static int res_unlock(struct lockspace *ls, struct resource *r,
return -ENOENT;
do_unlock:
- log_debug("S %s R %s res_unlock %s", ls->name, r->name,
- (act->op == LD_OP_CLOSE) ? "from close" : "");
+ if (act->op == LD_OP_CLOSE)
+ log_debug("S %s R %s res_unlock from close", ls->name, r->name);
+ else if (r->type == LD_RT_LV)
+ log_debug("S %s R %s res_unlock (%s)", ls->name, r->name, act->lv_name);
+ else
+ log_debug("S %s R %s res_unlock", ls->name, r->name);
/* send unlock to lm when last sh lock is unlocked */
if (lk->mode == LD_LK_SH) {
8 years, 8 months
master - libdm-stats: backtrace if fclose fails (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f072a7632655d0...
Commit: f072a7632655d0541b56858d5fbe172fa6075e68
Parent: 856f9cced83078a90ca2291eff0758d42775f195
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 19:23:41 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:26:07 2015 +0100
libdm-stats: backtrace if fclose fails (Coverity)
Since libdm-stats only uses fmemopen'd FILE objects the only way
that a close can fail is corruption of the memory containing the
FILE: check for this case and emit a backtrace if it occurs.
libdm/libdm-stats.c: 338 in _stats_parse_list()
libdm/libdm-stats.c: 341 in _stats_parse_list()
libdm/libdm-stats.c: 481 in _stats_parse_region()
libdm/libdm-stats.c: 487 in _stats_parse_region()
libdm/libdm-stats.c: 487 in _stats_parse_region()
- Calling "fclose" without checking return value
---
libdm/libdm-stats.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 192326e..ea4feef 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -81,11 +81,13 @@ static char *_program_id_from_proc(void)
if (!fgets(buf, sizeof(buf), comm)) {
log_error("Could not read from %s", PROC_SELF_COMM);
- fclose(comm);
+ if(fclose(comm))
+ stack;
return NULL;
}
- fclose(comm);
+ if (fclose(comm))
+ stack;
return dm_strdup(buf);
}
@@ -340,10 +342,13 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
dms->max_region = max_region - 1;
dms->regions = dm_pool_end_object(mem);
- fclose(list_rows);
+ if (fclose(list_rows))
+ stack;
+
return 1;
out:
- fclose(list_rows);
+ if(fclose(list_rows))
+ stack;
dm_pool_abandon_object(mem);
return 0;
}
@@ -483,13 +488,16 @@ static int _stats_parse_region(struct dm_pool *mem, const char *resp,
region->timescale = timescale;
region->counters = dm_pool_end_object(mem);
- fclose(stats_rows);
+ if (fclose(stats_rows))
+ stack;
+
return 1;
out:
if (stats_rows)
- fclose(stats_rows);
+ if(fclose(stats_rows))
+ stack;
dm_pool_abandon_object(mem);
return 0;
}
8 years, 8 months