master - lvmlockd: do not allow mirror LV to be activated shared
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c33770c02d9d6b9dedd...
Commit: c33770c02d9d6b9deddbc1b3c52c77c1a17ea246
Parent: 50800e33d56176e034970f93c5f87f59ecd569db
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 22 12:07:31 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 4 13:21:38 2019 -0500
lvmlockd: do not allow mirror LV to be activated shared
This reverts 518a8e8cfbb672c2bf5e3455f1fe7cd8d94eb5b0
"lvmlockd: activate mirror LVs in shared mode with cmirrord"
because while activating a mirror LV with cmirrord worked,
changes to the active cmirror did not work.
---
lib/commands/toolcontext.h | 1 -
lib/locking/lvmlockd.c | 38 +-------------------------------------
lib/metadata/mirror.c | 12 ------------
lib/mirror/mirrored.c | 9 ---------
man/lvmlockd.8_main | 2 +-
5 files changed, 2 insertions(+), 60 deletions(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 2ce243e..fea0e51 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -159,7 +159,6 @@ struct cmd_context {
unsigned lockd_gl_removed:1;
unsigned lockd_vg_default_sh:1;
unsigned lockd_vg_enforce_sh:1;
- unsigned lockd_lv_sh:1;
unsigned lockd_lv_sh_for_ex:1;
unsigned vg_notify:1;
unsigned lv_notify:1;
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 60e0617..1e3553d 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2160,15 +2160,6 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- /*
- * This is a hack for mirror LVs which need to know at a very low level
- * which lock mode the LV is being activated with so that it can pick
- * a mirror log type during activation. Do not use this for anything
- * else.
- */
- if (mode && !strcmp(mode, "sh"))
- cmd->lockd_lv_sh = 1;
-
if (!mode)
mode = "ex";
@@ -2302,31 +2293,6 @@ static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
}
/*
- * Only the combination of dlm + corosync + cmirrord allows
- * mirror LVs to be activated in shared mode on multiple nodes.
- */
-static int _lockd_lv_mirror(struct cmd_context *cmd, struct logical_volume *lv,
- const char *def_mode, uint32_t flags)
-{
- if (!strcmp(lv->vg->lock_type, "sanlock"))
- flags |= LDLV_MODE_NO_SH;
-
- else if (!strcmp(lv->vg->lock_type, "dlm") && def_mode && !strcmp(def_mode, "sh")) {
-#ifdef CMIRRORD_PIDFILE
- if (!cmirrord_is_running()) {
- log_error("cmirrord must be running to activate an LV in shared mode.");
- return 0;
- }
-#else
- flags |= LDLV_MODE_NO_SH;
-#endif
- }
-
- return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
- lv->lock_args, def_mode, flags);
-}
-
-/*
* If the VG has no lock_type, then this function can return immediately.
* The LV itself may have no lock (NULL lv->lock_args), but the lock request
* may be directed to another lock, e.g. the pool LV lock in _lockd_lv_thin.
@@ -2379,14 +2345,12 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
*/
if (lv_is_external_origin(lv) ||
lv_is_thin_type(lv) ||
+ lv_is_mirror_type(lv) ||
lv_is_raid_type(lv) ||
lv_is_cache_type(lv)) {
flags |= LDLV_MODE_NO_SH;
}
- if (lv_is_mirror_type(lv))
- return _lockd_lv_mirror(cmd, lv, def_mode, flags);
-
return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
lv->lock_args, def_mode, flags);
}
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 6950546..8459457 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -2056,18 +2056,6 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
- if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "dlm") && cmd->lockd_lv_sh) {
- if (!cluster_mirror_is_available(cmd)) {
- log_error("Shared cluster mirrors are not available.");
- return 0;
- }
-
- if (log_count > 1) {
- log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
- return 0;
- }
- }
-
/* For corelog mirror, activation code depends on
* the global mirror_in_sync status. As we are adding
* a new mirror, it should be set as 'out-of-sync'
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 7fa8714..aaaa0b8 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -278,15 +278,6 @@ static int _add_log(struct dm_pool *mem, struct lv_segment *seg,
char *log_dlid = NULL;
uint32_t log_flags = 0;
- if (seg->lv->vg->lock_type && !strcmp(seg->lv->vg->lock_type, "dlm")) {
- /*
- * If shared lock was used due to -asy, then we set clustered
- * to use a clustered mirror log with cmirrod.
- */
- if (seg->lv->vg->cmd->lockd_lv_sh)
- clustered = 1;
- }
-
if (seg->log_lv) {
/* If disk log, use its UUID */
if (!(log_dlid = build_dm_uuid(mem, seg->log_lv, NULL))) {
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index 50b3473..0feab80 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -545,7 +545,7 @@ report an error and fail.
The shared mode is intended for a multi-host/cluster application or
file system.
LV types that cannot be used concurrently
-from multiple hosts include thin, cache, raid, and snapshot.
+from multiple hosts include thin, cache, raid, mirror, and snapshot.
.IP \fBn\fP
The command deactivates the LV. After deactivating the LV, the command
4 years, 11 months
master - lvextend: refresh shared LV without using select
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=50800e33d56176e0349...
Commit: 50800e33d56176e034970f93c5f87f59ecd569db
Parent: 5d6fe796bd03a49b44e387dc8026996292505f27
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 4 13:19:08 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 4 13:19:08 2019 -0500
lvextend: refresh shared LV without using select
Using select instead of normal args did not end
up being a help, so remove it.
---
daemons/lvmlockd/lvmlockd-dlm.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index ee39c3e..bfc1d23 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -818,11 +818,10 @@ int lm_refresh_lv_start_dlm(struct action *act)
memset(run_uuid, 0, sizeof(run_uuid));
/* todo: add --readonly */
- /* FIXME: move vgname into the select option once the dlm can handle compound select args */
snprintf(command, DLMC_RUN_COMMAND_LEN,
- "lvm lvchange --refresh --partial --nolocking --select lvname=%s %s",
- lvname, vgname);
+ "lvm lvchange --refresh --partial --nolocking %s/%s",
+ vgname, lvname);
rv = dlmc_run_start(command, strlen(command), 0,
DLMC_FLAG_RUN_START_NODE_NONE,
4 years, 11 months
stable-2.02 - bcache: Fix memory leak
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b79f1e176f013167ca9...
Commit: b79f1e176f013167ca9798efb55eaf048d64e042
Parent: 81d954df4ed844600c44b99ee68453e1e53fcf31
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Apr 4 10:18:07 2019 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Apr 4 10:19:15 2019 +0200
bcache: Fix memory leak
---
lib/device/bcache.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 7384a32..f64931f 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -411,6 +411,7 @@ static bool _sync_issue(struct io_engine *ioe, enum dir d, int fd,
(unsigned long long)offset,
(unsigned long long)nbytes,
(unsigned long long)_last_byte_offset);
+ free(io);
return false;
}
4 years, 12 months
master - tests: check auto-growth of thin-pool meta
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5d6fe796bd03a49b44e...
Commit: 5d6fe796bd03a49b44e387dc8026996292505f27
Parent: fcec6691f074f1123b9c04c3130f84e35d195b01
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 13:25:54 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 3 13:28:56 2019 +0200
tests: check auto-growth of thin-pool meta
---
test/shell/lvextend-thin-full.sh | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvextend-thin-full.sh b/test/shell/lvextend-thin-full.sh
index e23eca8..263ab2f 100644
--- a/test/shell/lvextend-thin-full.sh
+++ b/test/shell/lvextend-thin-full.sh
@@ -28,7 +28,7 @@ test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_r
aux have_thin 1 10 0 || skip
-aux prepare_vg 3 256
+aux prepare_vg 3 4096
aux lvmconf 'activation/thin_pool_autoextend_percent = 30' \
'activation/thin_pool_autoextend_threshold = 70'
@@ -58,6 +58,12 @@ not lvcreate -V10 $vg/pool
lvextend --use-policies $vg/pool "$dev2" "$dev3"
#should lvextend -l+100%FREE $vg/pool2
+check lv_field $vg/pool_tmeta size "3.00m"
+
+lvextend -L+3G $vg/pool
+
+check lv_field $vg/pool_tmeta size "3.50m"
+
lvs -a $vg
vgremove -ff $vg
4 years, 12 months
master - thin: fix maintenance of _pmspare
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fcec6691f074f1123b9...
Commit: fcec6691f074f1123b9c04c3130f84e35d195b01
Parent: e27d0271557d4b93e87a70854b3c7f1cc6008155
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 13:02:50 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 3 13:28:54 2019 +0200
thin: fix maintenance of _pmspare
When metadata grows lvm2 may need to extend also _pmspare volume.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 00c96b5..81c3d71 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Fix missing growth of _pmsmare volume when extending _tmeta volume.
Automatically grow thin metadata, when thin data gets too big.
Add synchronization with udev before removing cached devices.
Add support for caching VDO LVs and VDOPOOL LVs.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index a13ba31..76d18b0 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5539,6 +5539,10 @@ static int _lvresize_volume(struct logical_volume *lv,
display_lvname(lv),
display_size(cmd, (uint64_t) old_extents * vg->extent_size), old_extents,
display_size(cmd, (uint64_t) lv->le_count * vg->extent_size), lv->le_count);
+
+ /* Resizing metadata and PV list is not specified -> maintain size of _pmspare volume */
+ if ((&vg->pvs == pvh) && lv_is_pool_metadata(lv))
+ (void) handle_pool_metadata_spare(vg, 0, pvh, 1);
}
return 1;
4 years, 12 months
master - thin: resize metadata with data
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e27d0271557d4b93e87...
Commit: e27d0271557d4b93e87a70854b3c7f1cc6008155
Parent: 7c3de2fd935aee428af8d75e774f5dd23a74c409
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 13:01:06 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 3 13:28:22 2019 +0200
thin: resize metadata with data
When data are growing, adapt also size of metadata.
As we get way too many reports from users doing huge growths of
data portion while keep metadata small and avoiding using monitoring.
So to enhance the user-experience in case user requests grown of
thin-pool (without passing PV list for growth) - lvm2 will automaticaly
grown also the metadata part of thin-pool (if possible).
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0f1fe1b..00c96b5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Automatically grow thin metadata, when thin data gets too big.
Add synchronization with udev before removing cached devices.
Add support for caching VDO LVs and VDOPOOL LVs.
Add support for vgsplit with cached devices.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index cc391b6..a13ba31 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5664,6 +5664,24 @@ int lv_resize(struct logical_volume *lv,
if (!_lvresize_prepare(&lv, lp, pvh))
return_0;
+ if (lp->resize != LV_REDUCE && !aux_lv && !lp->poolmetadata_size &&
+ &lv->vg->pvs == pvh && lv_is_thin_pool_data(lv)) {
+ /* When thin-pool data part is extended, automatically extend also metadata part
+ * to have the metadata chunks for adressing all data blocks
+ * Do this only when PV list is not defined and --poolmetadatasize is unspecified */
+ aux_lp = *lp;
+ seg = get_only_segment_using_this_lv(lv);
+ aux_lp.size = estimate_thin_pool_metadata_size(lp->extents, lv->vg->extent_size, seg->chunk_size);
+ if (aux_lp.size > seg->metadata_lv->size) {
+ log_verbose("Also going to resize thin-pool metadata to match bigger data.");
+ aux_lv = _lvresize_setup_aux(seg->metadata_lv, &aux_lp);
+ aux_lp.sign = SIGN_NONE;
+ if (!_lvresize_prepare(&aux_lv, &aux_lp, pvh))
+ return_0;
+ } else
+ aux_lp.size = 0;
+ }
+
if (((lp->resize == LV_REDUCE) ||
(aux_lv && aux_lp.resize == LV_REDUCE)) &&
(pvh != &vg->pvs))
4 years, 12 months
master - thin: introduce estimate_thin_pool_metadata_size
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7c3de2fd935aee428af...
Commit: 7c3de2fd935aee428af8d75e774f5dd23a74c409
Parent: bca0a4df9a5c6287bee682b40f4feae6f450729d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 12:56:48 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 3 13:27:17 2019 +0200
thin: introduce estimate_thin_pool_metadata_size
Add function for estimation of thin-pool metadata size for given size of
data. Function is using already existing internal API so it can
be reused for resize of thin-pool data.
---
lib/metadata/metadata.h | 1 +
lib/metadata/thin_manip.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index f578325..8e9c18a 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -490,6 +490,7 @@ int pool_below_threshold(const struct lv_segment *pool_seg);
int pool_check_overprovisioning(const struct logical_volume *lv);
int create_pool(struct logical_volume *pool_lv, const struct segment_type *segtype,
struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size);
+uint64_t estimate_thin_pool_metadata_size(uint32_t data_extents, uint32_t extent_size, uint32_t chunk_size);
/*
* Begin skeleton for external LVM library
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 79fadc2..b9c01ee 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -908,3 +908,15 @@ int validate_thin_pool_chunk_size(struct cmd_context *cmd, uint32_t chunk_size)
return r;
}
+
+uint64_t estimate_thin_pool_metadata_size(uint32_t data_extents, uint32_t extent_size, uint32_t chunk_size)
+{
+ uint64_t sz = _estimate_metadata_size(data_extents, extent_size, chunk_size);
+
+ if (sz > (2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE))
+ sz = 2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE;
+ else if (sz < (2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE))
+ sz = 2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE;
+
+ return sz;
+}
4 years, 12 months
master - filter: fix mpath test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bca0a4df9a5c6287bee...
Commit: bca0a4df9a5c6287bee682b40f4feae6f450729d
Parent: 2f471f0184aaac7499a33b32efb708aa8153a2af
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 13:06:00 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 3 13:27:17 2019 +0200
filter: fix mpath test
Fix bug which leaked into commit
dc6dea40331687b8740cc48833f4c7c42a2db1a1,
where the testing code got mistakenly commited.
---
lib/filters/filter-mpath.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/filters/filter-mpath.c b/lib/filters/filter-mpath.c
index 466d9c9..53a767c 100644
--- a/lib/filters/filter-mpath.c
+++ b/lib/filters/filter-mpath.c
@@ -243,7 +243,7 @@ static int _native_dev_is_mpath(struct dev_filter *f, struct device *dev)
if (look > 0) {
log_debug_devs("%s(%u:%u): already checked as %sbeing mpath.",
parent_name, major, minor, (look > 1) ? "" : "not ");
- return (look > 1) ? 0 : 1;
+ return (look > 1) ? 1 : 0;
}
if (lvm_dm_prefix_check(major, minor, MPATH_PREFIX)) {
4 years, 12 months
master - lvresize: fix when compiled without lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2f471f0184aaac7499a...
Commit: 2f471f0184aaac7499a33b32efb708aa8153a2af
Parent: 27cfeb1d39b2515b9c4b81a1d217e05ae954a68b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 2 10:50:12 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 2 10:51:38 2019 -0500
lvresize: fix when compiled without lvmlockd
The no-op result of lockd_lv_resize should be success.
---
lib/locking/lvmlockd.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/locking/lvmlockd.h b/lib/locking/lvmlockd.h
index ecd39bb..e11ea15 100644
--- a/lib/locking/lvmlockd.h
+++ b/lib/locking/lvmlockd.h
@@ -215,7 +215,7 @@ static inline int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
static inline int lockd_lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
const char *def_mode, uint32_t flags, struct lvresize_params *lp)
{
- return 0;
+ return 1;
}
static inline int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg,
4 years, 12 months