master - systemid: Use correct mempool.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=87941ccd1706ac...
Commit: 87941ccd1706ac9818f0f4828cade1d4cfae622d
Parent: 80f4b4b8039a88dfa2648a9b5bb5e16f41b81f87
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 18 23:25:30 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 18 23:25:30 2015 +0000
systemid: Use correct mempool.
libmem is necessary when this ends up in cmd->system_id.
---
lib/commands/toolcontext.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 54dcf86..fb0e94d 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -67,7 +67,7 @@ const char *system_id_from_string(struct cmd_context *cmd, const char *str)
return "";
}
- if (!(system_id = dm_pool_zalloc(cmd->mem, strlen(str) + 1))) {
+ if (!(system_id = dm_pool_zalloc(cmd->libmem, strlen(str) + 1))) {
log_warn("WARNING: Failed to allocate system ID.");
return NULL;
}
8 years
master - cache: Retain orphans while global lock held.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=80f4b4b8039a88...
Commit: 80f4b4b8039a88dfa2648a9b5bb5e16f41b81f87
Parent: 32a6c11877946bfc34a7af0821a793fd62f6bb36
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 18 23:20:09 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 18 23:20:09 2015 +0000
cache: Retain orphans while global lock held.
Fixes segfault when 'pvs' encounters two different PVs sharing the same
uuid but one an orphan, the other in a VG.
If VG_GLOBAL is held, there seems no point in doing a full scan more
than once.
If undesirable side-effects show up, we can try restricting this to
VG_GLOBAL READ locks. The original code dates back to 2.02.40.
---
WHATS_NEW | 1 +
lib/cache/lvmcache.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7d0038a..2e50b18 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Don't invalidate cached orphan information while global lock is held.
Avoid rescan of all devices when requested pvscan for removed device.
Measure configuration timestamps with nanoseconds when available.
Disable lvchange of major and minor of pool LVs.
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 6a9a05f..b8096d7 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -285,6 +285,9 @@ void lvmcache_commit_metadata(const char *vgname)
void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
{
+ if (lvmcache_vgname_is_locked(VG_GLOBAL))
+ return;
+
/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */
if (!strcmp(vgname, VG_ORPHANS)) {
_drop_metadata(FMT_TEXT_ORPHAN_VG_NAME, 0);
@@ -293,7 +296,7 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
/* Indicate that PVs could now be missing from the cache */
init_full_scan_done(0);
- } else if (!lvmcache_vgname_is_locked(VG_GLOBAL))
+ } else
_drop_metadata(vgname, drop_precommitted);
}
8 years
master - pvscan: check sysfs dev entry before rescan
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32a6c11877946b...
Commit: 32a6c11877946bfc34a7af0821a793fd62f6bb36
Parent: 1260b86b2b76f5b1ab5fa6c0c324d8d6f3ba2173
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 18 16:19:58 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 16:19:58 2015 +0100
pvscan: check sysfs dev entry before rescan
When pvscan --cache --major --minor command is issued from
udev REMOVE event, it basically resulted into a whole device
scan since the device was missing. So avoid such scan
and first check via /sysfs (when available) if such device actually
exists.
---
WHATS_NEW | 1 +
lib/device/dev-cache.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 51307cb..7d0038a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Avoid rescan of all devices when requested pvscan for removed device.
Measure configuration timestamps with nanoseconds when available.
Disable lvchange of major and minor of pool LVs.
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 7ad9fb8..d594dd4 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -986,12 +986,31 @@ static struct device *_dev_cache_seek_devt(dev_t dev)
*/
struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
{
+ char path[PATH_MAX];
+ const char *sysfs_dir;
+ struct stat info;
struct device *d = _dev_cache_seek_devt(dev);
if (d && (d->flags & DEV_REGULAR))
return d;
if (!d) {
+ sysfs_dir = dm_sysfs_dir();
+ if (sysfs_dir && *sysfs_dir) {
+ /* First check if dev is sysfs to avoid useless scan */
+ if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d",
+ sysfs_dir, (int)MAJOR(dev), (int)MINOR(dev)) < 0) {
+ log_error("dm_snprintf partition failed.");
+ return NULL;
+ }
+
+ if (lstat(path, &info)) {
+ log_debug("No sysfs entry for %d:%d.",
+ (int)MAJOR(dev), (int)MINOR(dev));
+ return NULL;
+ }
+ }
+
_full_scan(0);
d = _dev_cache_seek_devt(dev);
}
8 years
master - pvscan: check sysfs dev entry before rescan
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec00348f9ce8cd...
Commit: ec00348f9ce8cd1c04b479e1606b20dd8f60675d
Parent: 1260b86b2b76f5b1ab5fa6c0c324d8d6f3ba2173
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 18 13:22:26 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:44:37 2015 +0100
pvscan: check sysfs dev entry before rescan
When pvscan --cache --major --minor command is issued from
udev remove event, it basically resulted into a whole device
scan since the device was missing. So avoid such scan
and first check via sysfs if such device actually exists.
---
WHATS_NEW | 1 +
lib/device/dev-cache.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 51307cb..7d0038a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Avoid rescan of all devices when requested pvscan for removed device.
Measure configuration timestamps with nanoseconds when available.
Disable lvchange of major and minor of pool LVs.
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 7ad9fb8..312cf8d 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -986,12 +986,26 @@ static struct device *_dev_cache_seek_devt(dev_t dev)
*/
struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
{
+ char path[PATH_MAX];
struct device *d = _dev_cache_seek_devt(dev);
if (d && (d->flags & DEV_REGULAR))
return d;
if (!d) {
+ /* First check if dev is sysfs to avoid useless scan */
+ if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d",
+ dm_sysfs_dir(), (int)MAJOR(dev), (int)MINOR(dev)) < 0) {
+ log_error("dm_snprintf partition failed.");
+ return NULL;
+ }
+
+ if (access(path, R_OK) == -1) {
+ log_debug("No sysfs entry for %d:%d.",
+ (int)MAJOR(dev), (int)MINOR(dev));
+ return NULL;
+ }
+
_full_scan(0);
d = _dev_cache_seek_devt(dev);
}
8 years
master - config: use timestamp with nanosecond precision
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1260b86b2b76f5...
Commit: 1260b86b2b76f5b1ab5fa6c0c324d8d6f3ba2173
Parent: 6606b1bff3fba90cc7af92dcda1c6eafdbf5e200
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 18 10:59:41 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:42:56 2015 +0100
config: use timestamp with nanosecond precision
Since kernel 2.6 we can use more precise timestamping,
so e.g. we could better recognize configs are slightly
older then generated .cache file.
---
WHATS_NEW | 1 +
lib/commands/toolcontext.c | 14 +++++++++-----
lib/config/config.c | 13 ++++++++-----
lib/config/config.h | 2 +-
lib/filters/filter-persistent.c | 10 ++++++----
5 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0ce81fb..51307cb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Measure configuration timestamps with nanoseconds when available.
Disable lvchange of major and minor of pool LVs.
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 25d9826..54dcf86 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1140,6 +1140,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
struct dev_filter *filter = NULL, *filter_components[2] = {0};
struct stat st;
const struct dm_config_node *cn;
+ struct timespec ts, cts;
cmd->dump_filter = 0;
@@ -1212,11 +1213,14 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
*/
if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL) &&
load_persistent_cache && !cmd->is_long_lived &&
- !stat(dev_cache, &st) &&
- (st.st_ctime > config_file_timestamp(cmd->cft)) &&
- !persistent_filter_load(cmd->filter, NULL))
- log_verbose("Failed to load existing device cache from %s",
- dev_cache);
+ !stat(dev_cache, &st)) {
+ lvm_stat_ctim(&ts, &st);
+ cts = config_file_timestamp(cmd->cft);
+ if (timespeccmp(&ts, &cts, >) &&
+ !persistent_filter_load(cmd->filter, NULL))
+ log_verbose("Failed to load existing device cache from %s",
+ dev_cache);
+ }
return 1;
bad:
diff --git a/lib/config/config.c b/lib/config/config.c
index 5de6df6..b635654 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -53,7 +53,7 @@ struct config_file {
struct config_source {
config_source_t type;
- time_t timestamp;
+ struct timespec timestamp;
union {
struct config_file *file;
struct config_file *profile;
@@ -173,7 +173,7 @@ int config_file_check(struct dm_config_tree *cft, const char **filename, struct
return 0;
}
- cs->timestamp = info->st_ctime;
+ lvm_stat_ctim(&cs->timestamp, info);
cf->exists = 1;
cf->st_size = info->st_size;
@@ -193,6 +193,7 @@ int config_file_changed(struct dm_config_tree *cft)
struct config_source *cs = dm_config_get_custom(cft);
struct config_file *cf;
struct stat info;
+ struct timespec ts;
if (cs->type != CONFIG_FILE) {
log_error(INTERNAL_ERROR "config_file_changed: expected file config source, "
@@ -226,7 +227,9 @@ int config_file_changed(struct dm_config_tree *cft)
}
/* Unchanged? */
- if (cs->timestamp == info.st_ctime && cf->st_size == info.st_size)
+ lvm_stat_ctim(&ts, &info);
+ if ((timespeccmp(&cs->timestamp, &ts, ==)) &&
+ cf->st_size == info.st_size)
return 0;
reload:
@@ -594,7 +597,7 @@ int config_file_read(struct dm_config_tree *cft)
return r;
}
-time_t config_file_timestamp(struct dm_config_tree *cft)
+struct timespec config_file_timestamp(struct dm_config_tree *cft)
{
struct config_source *cs = dm_config_get_custom(cft);
return cs->timestamp;
@@ -1473,7 +1476,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
cs = dm_config_get_custom(cft);
csn = dm_config_get_custom(newdata);
- if (cs && csn && (cs->timestamp < csn->timestamp))
+ if (cs && csn && timespeccmp(&cs->timestamp, &csn->timestamp, <))
cs->timestamp = csn->timestamp;
return 1;
diff --git a/lib/config/config.h b/lib/config/config.h
index 50ea361..5fe6a9f 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -215,7 +215,7 @@ int config_write(struct dm_config_tree *cft, struct config_def_tree_spec *tree_s
struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec);
void config_destroy(struct dm_config_tree *cft);
-time_t config_file_timestamp(struct dm_config_tree *cft);
+struct timespec config_file_timestamp(struct dm_config_tree *cft);
int config_file_changed(struct dm_config_tree *cft);
int config_file_check(struct dm_config_tree *cft, const char **filename, struct stat *info);
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index b4a7683..8c7b79f 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -22,7 +22,7 @@ struct pfilter {
char *file;
struct dm_hash_table *devices;
struct dev_filter *real;
- time_t ctime;
+ struct timespec ctime;
struct dev_types *dt;
};
@@ -106,7 +106,7 @@ int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out
}
if (!stat(pf->file, &info))
- pf->ctime = info.st_ctime;
+ lvm_stat_ctim(&pf->ctime, &info);
else {
log_very_verbose("%s: stat failed: %s", pf->file,
strerror(errno));
@@ -177,6 +177,7 @@ static int _persistent_filter_dump(struct dev_filter *f, int merge_existing)
struct pfilter *pf;
char *tmp_file;
struct stat info, info2;
+ struct timespec ts;
struct dm_config_tree *cft = NULL;
FILE *fp;
int lockfd;
@@ -227,7 +228,8 @@ static int _persistent_filter_dump(struct dev_filter *f, int merge_existing)
/*
* If file contents changed since we loaded it, merge new contents
*/
- if (merge_existing && info.st_ctime != pf->ctime)
+ lvm_stat_ctim(&ts, &info);
+ if (merge_existing && timespeccmp(&ts, &pf->ctime, !=))
/* Keep cft open to avoid losing lock */
persistent_filter_load(f, &cft);
@@ -352,7 +354,7 @@ struct dev_filter *persistent_filter_create(struct dev_types *dt,
/* Only merge cache file before dumping it if it changed externally. */
if (!stat(pf->file, &info))
- pf->ctime = info.st_ctime;
+ lvm_stat_ctim(&pf->ctime, &info);
f->passes_filter = _lookup_p;
f->destroy = _persistent_destroy;
8 years
master - lvm-file: wrapper to read ctim from stat
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6606b1bff3fba9...
Commit: 6606b1bff3fba90cc7af92dcda1c6eafdbf5e200
Parent: 17583f1b591bc4f84acf1e6be76083ddd84020ac
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 18 10:54:08 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:42:24 2015 +0100
lvm-file: wrapper to read ctim from stat
When available use nanosecond stat info.
If commands are running closely enough after config update,
the .cache file from persistent filter could have been ignored.
This happens sometimes during i.e. synthetic test suite run.
---
lib/misc/lvm-file.c | 11 +++++++++++
lib/misc/lvm-file.h | 11 +++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/lib/misc/lvm-file.c b/lib/misc/lvm-file.c
index f0e2841..2e896ec 100644
--- a/lib/misc/lvm-file.c
+++ b/lib/misc/lvm-file.c
@@ -21,6 +21,7 @@
#include <sys/file.h>
#include <fcntl.h>
#include <dirent.h>
+#include <sys/time.h>
/*
* Creates a temporary filename, and opens a descriptor to the
@@ -273,3 +274,13 @@ int lvm_fclose(FILE *fp, const char *filename)
return EOF;
}
+
+void lvm_stat_ctim(struct timespec *ctim, const struct stat *buf)
+{
+#ifdef HAVE_STAT_ST_CTIM
+ *ctim = buf->st_ctim;
+#else
+ ctim->tv_sec = buf->st_ctime;
+ ctim->tv_nsec = 0;
+#endif
+}
diff --git a/lib/misc/lvm-file.h b/lib/misc/lvm-file.h
index c23d8ad..a4f332c 100644
--- a/lib/misc/lvm-file.h
+++ b/lib/misc/lvm-file.h
@@ -62,4 +62,15 @@ void fcntl_unlock_file(int lockfd);
*/
int lvm_fclose(FILE *fp, const char *filename);
+/*
+ * Convert stat->st_ctim status of last change in nanoseconds
+ * uses st_ctime when not available.
+ */
+void lvm_stat_ctim(struct timespec *ts, const struct stat *buf);
+
+/* Inspired by <sys/time.h> timercmp() macro for timeval */
+#define timespeccmp(tsp, usp, cmp)\
+ (((tsp)->tv_sec == (usp)->tv_sec) ?\
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) :\
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
#endif
8 years
master - configure: detect st_ctim
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17583f1b591bc4...
Commit: 17583f1b591bc4f84acf1e6be76083ddd84020ac
Parent: a10a11bd54d9f33842eee8c168dc3c47aebec05b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 18 10:52:40 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:42:24 2015 +0100
configure: detect st_ctim
Check stat has nanosecond precision for ctim.
---
acinclude.m4 | 4 ++++
configure | 34 ++++++++++++++++++++++++++++++++++
configure.in | 12 ++++++++++++
lib/misc/configure.h.in | 3 +++
4 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 601ae9d..b6c9b18 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -37,6 +37,10 @@ AC_DEFUN([AC_TRY_CCFLAG],
fi
])
+dnl AC_IF_YES([TEST-FOR-YES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl AS_IF() abstraction, checks shell variable for 'yes'
+AC_DEFUN([AC_IF_YES], [AS_IF([test $$1 = yes], [$2], [$3])])
+
dnl AC_TRY_LDFLAGS([LDFLAGS], [VAR], [ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check if $CC supports given ld flags
diff --git a/configure b/configure
index d85e7c9..34d2a50 100755
--- a/configure
+++ b/configure
@@ -11958,6 +11958,40 @@ $as_echo "$as_me: WARNING: Disabling realtime clock" >&2;}
fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat has st_ctim." >&5
+$as_echo_n "checking for struct stat has st_ctim.... " >&6; }
+if ${ac_cv_stat_st_ctim+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/stat.h>
+long bar(void) { struct stat s; return (long)(s.st_ctim.tv_sec + s.st_ctim.tv_nsec);}
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_stat_st_ctim=yes
+else
+ ac_cv_stat_st_ctim=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_st_ctim" >&5
+$as_echo "$ac_cv_stat_st_ctim" >&6; }
+
+if test $ac_cv_stat_st_ctim = yes; then :
+
+$as_echo "#define HAVE_STAT_ST_CTIM 1" >>confdefs.h
+
+fi
+
################################################################################
for ac_header in getopt.h
do :
diff --git a/configure.in b/configure.in
index 55c13a6..38c7b51 100644
--- a/configure.in
+++ b/configure.in
@@ -1379,6 +1379,18 @@ if test "$REALTIME" = yes; then
fi
fi
+dnl Check if the system has struct stat st_ctim.
+AC_CACHE_CHECK([for struct stat has st_ctim.],
+ [ac_cv_stat_st_ctim],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[#include <sys/stat.h>
+long bar(void) { struct stat s; return (long)(s.st_ctim.tv_sec + s.st_ctim.tv_nsec);}]
+ )], [ac_cv_stat_st_ctim=yes], [ac_cv_stat_st_ctim=no])])
+
+AC_IF_YES(ac_cv_stat_st_ctim,
+ AC_DEFINE(HAVE_STAT_ST_CTIM, 1,
+ [Define if struct stat has a field st_ctim with timespec for ctime]))
+
################################################################################
dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))
diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in
index ee9f859..48ae3f6 100644
--- a/lib/misc/configure.h.in
+++ b/lib/misc/configure.h.in
@@ -322,6 +322,9 @@
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
+/* Define if struct stat has a field st_ctim with timespec for ctime */
+#undef HAVE_STAT_ST_CTIM
+
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
8 years
master - lvchange: disable persistent minors for pools
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a10a11bd54d9f3...
Commit: a10a11bd54d9f33842eee8c168dc3c47aebec05b
Parent: 95fbbf4f40e8d0e9d9565f5a25f66a8127986822
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 17 09:44:26 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:42:13 2015 +0100
lvchange: disable persistent minors for pools
There is no reason to support persistent major/minor numbers
for pool volumes - it's only meant to be supported for filesystems
(since i.e. nfs may need to keep volume on a persistent device node.)
Support for pools is now explicitely disabled and documented.
---
WHATS_NEW | 1 +
man/lvchange.8.in | 1 +
test/shell/lvchange-cache.sh | 4 ++++
test/shell/lvchange-thin.sh | 5 +++--
tools/lvchange.c | 5 +++++
5 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d0a0c2d..0ce81fb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Disable lvchange of major and minor of pool LVs.
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index fbae953..6b41c81 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -279,6 +279,7 @@ Do not use this if dmeventd is already monitoring a device.
.TP
.BR \-M ", " \-\-persistent " {" \fIy | \fIn }
Set to y to make the minor number specified persistent.
+Change of persistent numbers is not supported for pool volumes.
.TP
.BR \-p ", " \-\-permission " {" \fIr | \fIrw }
Change access permission to read-only or read/write.
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 9959f93..20826fb 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -18,6 +18,10 @@ lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
lvcreate -H -L 4 -n corigin --cachepool $vg/cpool
lvcreate -n noncache -l 1 $vg
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/cpool
+not lvchange -M n $vg/cpool
+
not lvchange --cachepolicy mq $vg/noncache
not lvchange --cachesettings foo=bar $vg/noncache
diff --git a/test/shell/lvchange-thin.sh b/test/shell/lvchange-thin.sh
index 4d33563..87919bc 100644
--- a/test/shell/lvchange-thin.sh
+++ b/test/shell/lvchange-thin.sh
@@ -54,8 +54,9 @@ lvchange -r auto $vg/$lv1
lvchange --yes -M y --minor 234 --major 253 $vg/$lv1
lvchange -M n $vg/$lv1
-lvchange --yes -M y --minor 235 --major 253 $vg/pool
-lvchange -M n $vg/pool
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/pool
+not lvchange -M n $vg/pool
# addtag_ARG
lvchange --addtag foo $vg/$lv1
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5e90adc..096aae4 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -966,6 +966,11 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED;
}
+ if (arg_count(cmd, persistent_ARG) && lv_is_pool(lv)) {
+ log_error("Persistent major and minor numbers are not supported with pools.");
+ return ECMD_FAILED;
+ }
+
/*
* FIXME: DEFAULT_BACKGROUND_POLLING should be "unspecified".
* If --poll is explicitly provided use it; otherwise polling
8 years
master - metadata: Fix recent vg_validate message text.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95fbbf4f40e8d0...
Commit: 95fbbf4f40e8d0e9d9565f5a25f66a8127986822
Parent: 038013cf42710da3e815713c7e7482fca00e110b
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Mar 17 17:48:56 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Mar 17 17:48:56 2015 +0000
metadata: Fix recent vg_validate message text.
---
lib/metadata/metadata.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 21066fb..ed91948 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2576,7 +2576,7 @@ int vg_validate(struct volume_group *vg)
if (lvl->lv->status & LVM_WRITE_LOCKED) {
log_error(INTERNAL_ERROR "LV %s has external flag LVM_WRITE_LOCKED set internally.",
- vg->name);
+ lvl->lv->name);
r = 0;
}
8 years
master - lvmetad: pvscan: do not scan and read ignored MDAs from PVs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=038013cf42710d...
Commit: 038013cf42710da3e815713c7e7482fca00e110b
Parent: ff5217f85079fa8cc969e0a81a66f1e1bd6490b5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 16 17:00:36 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 16 17:00:36 2015 +0100
lvmetad: pvscan: do not scan and read ignored MDAs from PVs
Metadata areas which are marked as ignored should not be scanned
and read during pvscan --cache. Otherwise, this can cause lvmetad
to cache out-of-date metadata in case other PVs with fresh metadata
are missing by chance.
Make this to work like in non-lvmetad case where the behaviour would
be the same as if the PV was orphan (in case we have no other PVs
with valid non-ignored metadata areas).
---
WHATS_NEW | 1 +
lib/cache/lvmetad.c | 4 +++-
test/shell/lvmetad-pvscan-cache.sh | 13 +++++++++++++
3 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 97b562d..d0a0c2d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
Don't do a full read of VG when creating a new VG with an existing name.
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 08c58d2..d878c17 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -895,7 +895,9 @@ struct _lvmetad_pvscan_baton {
static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
{
struct _lvmetad_pvscan_baton *b = baton;
- struct volume_group *this = mda->ops->vg_read(b->fid, "", mda, 1);
+ struct volume_group *this;
+
+ this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, 1);
/* FIXME Also ensure contents match etc. */
if (!b->vg || this->seqno > b->vg->seqno)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
index 5c48817..75890a5 100644
--- a/test/shell/lvmetad-pvscan-cache.sh
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -22,4 +22,17 @@ pvscan --cache
vgs | grep $vg1
+# When MDA is ignored on PV, do not read any VG
+# metadata from such PV as it may contain old
+# metadata which hasn't been updated for some
+# time and also since the MDA is marked as ignored,
+# it should really be *ignored*!
+pvchange --metadataignore y "$dev1"
+aux disable_dev "$dev2"
+pvscan --cache
+check pv_field "$dev1" vg_name ""
+aux enable_dev "$dev2"
+pvscan --cache
+check pv_field "$dev1" vg_name "$vg1"
+
vgremove -ff $vg1
8 years