master - tests: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f5401fbd34371dfed74...
Commit: f5401fbd34371dfed74f981eb1d4c5b4b3220cc2
Parent: 552e60b3a1e35329a47d6112c548ada124b5a4e3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 14 23:08:26 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 15 13:56:35 2018 +0100
tests: update
---
test/shell/pvmove-basic.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh
index 42f165b..2fc71e2 100644
--- a/test/shell/pvmove-basic.sh
+++ b/test/shell/pvmove-basic.sh
@@ -41,7 +41,7 @@ prepare_lvs_() {
lvextend -l+2 $vg/$lv1 "$dev3"
lvextend -l+2 $vg/$lv1 "$dev1"
check lv_on $vg $lv1 "$dev1" "$dev2" "$dev3"
- lvcreate -l1 -n $lv3 $vg "$dev2"
+ lvcreate -aey -l1 -n $lv3 $vg "$dev2"
check lv_on $vg $lv3 "$dev2"
aux mkdev_md5sum $vg $lv1
aux mkdev_md5sum $vg $lv2
5 years, 9 months
master - locking: exclusive can be either remote or local
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a2d2fe3a8cf840fcfcd...
Commit: a2d2fe3a8cf840fcfcd23fb0e706c3699b79b5fa
Parent: a1195aaa66ab4a04bc2149f53bf442f141b78229
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 14 23:06:49 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 15 13:54:55 2018 +0100
locking: exclusive can be either remote or local
When LOCK is exclusive and LV is already locally active,
it cannot be active remotely.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e2deaae..b11de8c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Do not report LV as remotely active when it's locally exclusive in cluster.
Add deprecate messages for usage of mirrors with mirrorlog.
Separate reporting of monitoring status and error status.
Improve validation of created strings in vgimportclone.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 1b870f7..3052f31 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1543,8 +1543,11 @@ static int _lv_is_active(const struct logical_volume *lv,
if (skip_cluster_query)
goto out;
- if ((r = cluster_lock_held(lv->lvid.s, "", &e)) >= 0)
+ if ((r = cluster_lock_held(lv->lvid.s, "", &e)) >= 0) {
+ if (l && e)
+ r = 0; /* exclusive locally */
goto out;
+ }
/*
* If lock query is not supported (due to interfacing with old
5 years, 9 months
master - cleanup: add missing WARNING
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a1195aaa66ab4a04bc2...
Commit: a1195aaa66ab4a04bc2149f53bf442f141b78229
Parent: d67f1602005b4f83e5949668a0cf4e7e5ff0c7d2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 15 13:49:45 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 15 13:52:02 2018 +0100
cleanup: add missing WARNING
ATM log_warn() is supposed to be used with WARNING: prefix.
---
WHATS_NEW | 1 +
lib/metadata/mirror.c | 2 +-
tools/lvconvert.c | 8 ++++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2bded4d..e2deaae 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Add deprecate messages for usage of mirrors with mirrorlog.
Separate reporting of monitoring status and error status.
Improve validation of created strings in vgimportclone.
Add missing initialisation of mem pool in systemd generator.
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 71d3457..4a0e99f 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1946,7 +1946,7 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
}
if (log_count > 1) {
- log_warn("Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
+ log_warn("WARNING: Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
}
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0)))
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e18ec23..8006699 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -686,7 +686,7 @@ static void _remove_missing_empty_pv(struct volume_group *vg, struct dm_list *re
stack;
return;
}
- log_warn("%d missing and now unallocated Physical Volumes removed from VG.", removed);
+ log_warn("WARNING: %d missing and now unallocated Physical Volumes removed from VG.", removed);
}
}
@@ -828,7 +828,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
uint32_t old_log_count = _get_log_count(lv);
if ((lp->mirrors == 1) && !lv_is_mirrored(lv)) {
- log_warn("Logical volume %s is already not mirrored.",
+ log_warn("WARNING: Logical volume %s is already not mirrored.",
display_lvname(lv));
return 1;
}
@@ -1100,7 +1100,7 @@ static int _lvconvert_mirrors_repair(struct cmd_context *cmd,
log_count = replace_logs ? original_logs : (original_logs - failed_logs);
while (replace_mimages || replace_logs) {
- log_warn("Trying to up-convert to %d images, %d logs.", lp->mirrors, log_count);
+ log_warn("WARNING: Trying to up-convert to %d images, %d logs.", lp->mirrors, log_count);
if (_lvconvert_mirrors_aux(cmd, lv, lp, NULL,
lp->mirrors, log_count, pvh))
break;
@@ -1218,7 +1218,7 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
if ((old_log_count != new_log_count) &&
(new_log_count == MIRROR_LOG_MIRRORED)) {
- log_warn("Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
+ log_warn("WARNING: Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
}
if (!_lvconvert_mirrors_aux(cmd, lv, lp, NULL,
5 years, 9 months
master - mirror: Add deprecation warning for mirrored log
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d67f1602005b4f83e59...
Commit: d67f1602005b4f83e5949668a0cf4e7e5ff0c7d2
Parent: dd6fbcbb6941b0d534689258f7f07f567ee6f352
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Feb 14 12:46:08 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Feb 14 13:32:04 2018 +0100
mirror: Add deprecation warning for mirrored log
---
lib/metadata/mirror.c | 4 ++++
tools/lvconvert.c | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 38c3df6..71d3457 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1945,6 +1945,10 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}
+ if (log_count > 1) {
+ log_warn("Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
+ }
+
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0)))
return_0;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index fee0a4e..e18ec23 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1216,6 +1216,11 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
(old_log_count == new_log_count))
return 1;
+ if ((old_log_count != new_log_count) &&
+ (new_log_count == MIRROR_LOG_MIRRORED)) {
+ log_warn("Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead.");
+ }
+
if (!_lvconvert_mirrors_aux(cmd, lv, lp, NULL,
new_mimage_count, new_log_count, lp->pvh))
return_0;
5 years, 9 months
master - test: mirrored mirrorlog is not supposed to work in cluster
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dd6fbcbb6941b0d5346...
Commit: dd6fbcbb6941b0d534689258f7f07f567ee6f352
Parent: c3642957c5427d69b6aac45d2d1088786967cabd
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Feb 13 18:34:08 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Feb 14 13:10:52 2018 +0100
test: mirrored mirrorlog is not supposed to work in cluster
---
test/shell/lvconvert-mirror.sh | 11 ++++++++---
test/shell/lvcreate-operation.sh | 11 ++++++++++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 449f605..76ff166 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -293,15 +293,20 @@ lvcreate -aey -l15 -n $lv1 $vg
not lvconvert --type mirror -m1 --corelog --stripes 2 $vg/$lv1
lvremove -ff $vg
-test -e LOCAL_CLVMD && exit 0
-
-# FIXME - cases which needs to be fixed to work in cluster
# Linear to mirror with mirrored log using --alloc anywhere
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
+if test -e LOCAL_CLVMD; then
+# This is not supposed to work in cluster
+not lvconvert --type mirror -m +1 --mirrorlog mirrored --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
+else
lvconvert --type mirror -m +1 --mirrorlog mirrored --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
should check mirror $vg $lv1
+fi
lvremove -ff $vg
+# FIXME - cases which needs to be fixed to work in cluster
+test -e LOCAL_CLVMD && exit 0
+
# Should not be able to add images to --nosync mirror
# but should be able to after 'lvchange --resync'
lvcreate -aey --type mirror -m 1 -l1 -n $lv1 $vg --nosync
diff --git a/test/shell/lvcreate-operation.sh b/test/shell/lvcreate-operation.sh
index 63d05db..38d50cd 100644
--- a/test/shell/lvcreate-operation.sh
+++ b/test/shell/lvcreate-operation.sh
@@ -37,7 +37,14 @@ lvcreate -n$lv3 -l4 --permission r -s $vg/$lv1
cleanup_lvs
# Skip the rest for cluster
-test -e LOCAL_CLVMD && exit 0
+if test -e LOCAL_CLVMD; then
+
+# ---
+# Create mirror on two devices with mirrored log using --alloc anywhere - should always fail in cluster
+not lvcreate --type mirror -m 1 -l4 -n $lv1 --mirrorlog mirrored $vg --alloc anywhere "$dev1" "$dev2"
+cleanup_lvs
+
+else
# ---
# Create mirror on two devices with mirrored log using --alloc anywhere
@@ -49,4 +56,6 @@ cleanup_lvs
not lvcreate --type mirror -m 1 -l4 -n $lv1 --mirrorlog mirrored $vg --alloc anywhere "$dev1"
cleanup_lvs
+fi
+
vgremove -ff $vg
5 years, 9 months
master - gcc: remove warns about free of const
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c3642957c5427d69b6a...
Commit: c3642957c5427d69b6aac45d2d1088786967cabd
Parent: 0eb9daf602281d233c83e5823b3c6297fb541deb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 13 19:53:07 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 13 19:56:02 2018 +0100
gcc: remove warns about free of const
---
lib/mirror/mirrored.c | 2 +-
lib/raid/raid.c | 6 +++---
lib/snapshot/snapshot.c | 2 +-
lib/thin/thin.c | 2 +-
lib/unknown/unknown.c | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 1a8f1bb..a46cc29 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -531,7 +531,7 @@ static int _mirrored_modules_needed(struct dm_pool *mem,
static void _mirrored_destroy(struct segment_type *segtype)
{
- dm_free(segtype->dso);
+ dm_free((void *) segtype->dso);
dm_free(segtype);
}
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 8ae679e..31a0ac0 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -363,8 +363,8 @@ static int _raid_target_status_compatible(const char *type)
static void _raid_destroy(struct segment_type *segtype)
{
- dm_free(segtype->dso);
- dm_free((void *) segtype);
+ dm_free((void *) segtype->dso);
+ dm_free(segtype);
}
#ifdef DEVMAPPER_SUPPORT
@@ -652,7 +652,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
#endif
{
struct segment_type *segtype;
- const char *dso = NULL;
+ char *dso = NULL;
unsigned i;
uint64_t monitored = 0;
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index e99acf1..5fd39e9 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -224,7 +224,7 @@ static int _snap_modules_needed(struct dm_pool *mem,
static void _snap_destroy(struct segment_type *segtype)
{
- dm_free(segtype->dso);
+ dm_free((void *) segtype->dso);
dm_free(segtype);
}
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index a679784..b6eb3aa 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -745,7 +745,7 @@ static int _thin_target_present(struct cmd_context *cmd,
static void _thin_destroy(struct segment_type *segtype)
{
- dm_free(segtype->dso);
+ dm_free((void *) segtype->dso);
dm_free(segtype);
}
diff --git a/lib/unknown/unknown.c b/lib/unknown/unknown.c
index 8f6083a..7728545 100644
--- a/lib/unknown/unknown.c
+++ b/lib/unknown/unknown.c
@@ -49,7 +49,7 @@ static int _unknown_text_export(const struct lv_segment *seg, struct formatter *
static void _unknown_destroy(struct segment_type *segtype)
{
- dm_free(segtype->name);
+ dm_free((void *) segtype->name);
dm_free(segtype);
}
5 years, 9 months
master - segtype: no libmem pool usage for name allocation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0eb9daf602281d233c8...
Commit: 0eb9daf602281d233c83e5823b3c6297fb541deb
Parent: 32febed8d55d0761fdbe86015c02da90e026b359
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 13 19:06:35 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 13 19:11:28 2018 +0100
segtype: no libmem pool usage for name allocation
Allocate name with plain malloc & free.
---
lib/unknown/unknown.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/unknown/unknown.c b/lib/unknown/unknown.c
index 68d11c3..8f6083a 100644
--- a/lib/unknown/unknown.c
+++ b/lib/unknown/unknown.c
@@ -49,6 +49,7 @@ static int _unknown_text_export(const struct lv_segment *seg, struct formatter *
static void _unknown_destroy(struct segment_type *segtype)
{
+ dm_free(segtype->name);
dm_free(segtype);
}
@@ -68,7 +69,12 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd, const char *n
}
segtype->ops = &_unknown_ops;
- segtype->name = dm_pool_strdup(cmd->libmem, name);
+ if (!(segtype->name = dm_strdup(name))) {
+ log_error("Failed to allocate name.");
+ dm_free(segtype);
+ return NULL;
+ }
+
segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name);
5 years, 9 months
master - segtype: replace mempool allocation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=32febed8d55d0761fdb...
Commit: 32febed8d55d0761fdbe86015c02da90e026b359
Parent: e40768ac32e6de5e6f9614ae0ad702c93a4e1330
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 13 19:00:47 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 13 19:11:28 2018 +0100
segtype: replace mempool allocation
So this is a bit more complex and possibly worth futher checking.
ATM clvmd drops cmd->mem mempool AFTER refresh of cmd.
So anything allocating from cmd->mem during toolcontext init
will likely die at some point in time.
As a quick fix - just use regular malloc/free for 'dso' alloction.
It's worth to note - cmd->libmem seems to be often misused
causing hidden memleaking for clvmd.
---
lib/activate/activate.c | 2 +-
lib/mirror/mirrored.c | 1 +
lib/raid/raid.c | 8 ++++++--
lib/snapshot/snapshot.c | 1 +
lib/thin/thin.c | 1 +
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index bd1dc18..1b870f7 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1692,7 +1692,7 @@ char *get_monitor_dso_path(struct cmd_context *cmd, int id)
get_shared_library_path(cmd, libpath, path, sizeof(path));
- return dm_pool_strdup(cmd->mem, path);
+ return dm_strdup(path);
}
static char *_build_target_uuid(struct cmd_context *cmd, const struct logical_volume *lv)
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 2d9c3de..1a8f1bb 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -531,6 +531,7 @@ static int _mirrored_modules_needed(struct dm_pool *mem,
static void _mirrored_destroy(struct segment_type *segtype)
{
+ dm_free(segtype->dso);
dm_free(segtype);
}
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index e835160..8ae679e 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -363,6 +363,7 @@ static int _raid_target_status_compatible(const char *type)
static void _raid_destroy(struct segment_type *segtype)
{
+ dm_free(segtype->dso);
dm_free((void *) segtype);
}
@@ -629,7 +630,8 @@ static struct segment_type *_init_raid_segtype(struct cmd_context *cmd,
segtype->flags = SEG_RAID | SEG_ONLY_EXCLUSIVE | rt->extra_flags;
/* Never monitor raid0 or raid0_meta LVs */
- if (!segtype_is_any_raid0(segtype)) {
+ if (!segtype_is_any_raid0(segtype) &&
+ dso && (dso = dm_strdup(dso))) {
segtype->dso = dso;
segtype->flags |= monitored;
}
@@ -650,7 +652,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
#endif
{
struct segment_type *segtype;
- const char *dso;
+ const char *dso = NULL;
unsigned i;
uint64_t monitored = 0;
@@ -669,5 +671,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
/* segtype is already destroyed */
return_0;
+ dm_free(dso);
+
return 1;
}
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index 1105204..e99acf1 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -224,6 +224,7 @@ static int _snap_modules_needed(struct dm_pool *mem,
static void _snap_destroy(struct segment_type *segtype)
{
+ dm_free(segtype->dso);
dm_free(segtype);
}
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index dad1bf2..a679784 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -745,6 +745,7 @@ static int _thin_target_present(struct cmd_context *cmd,
static void _thin_destroy(struct segment_type *segtype)
{
+ dm_free(segtype->dso);
dm_free(segtype);
}
5 years, 9 months
master - debug: add stack tracking
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e40768ac32e6de5e6f9...
Commit: e40768ac32e6de5e6f9614ae0ad702c93a4e1330
Parent: 27399755fd1b1292cc93f6469162c0855b7231c2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 8 11:03:06 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Feb 12 22:15:03 2018 +0100
debug: add stack tracking
---
lib/locking/cluster_locking.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c
index e2f8123..038f6b6 100644
--- a/lib/locking/cluster_locking.c
+++ b/lib/locking/cluster_locking.c
@@ -211,11 +211,10 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
*num = 0;
- if (_clvmd_sock == -1)
- _clvmd_sock = _open_local_sock(0);
-
- if (_clvmd_sock == -1)
- return 0;
+ if (_clvmd_sock == -1) {
+ if ((_clvmd_sock = _open_local_sock(0)) == -1)
+ return_0;
+ }
/* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
_build_header(head, clvmd_cmd, node, len - 1);
@@ -224,7 +223,7 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
status = _send_request(outbuf, sizeof(struct clvm_header) +
strlen(head->node) + len - 1, &retbuf);
if (!status)
- goto out;
+ goto_out;
/* Count the number of responses we got */
head = (struct clvm_header *) retbuf;
@@ -245,7 +244,7 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
if (!(rarray = dm_malloc(sizeof(lvm_response_t) * num_responses))) {
errno = ENOMEM;
status = 0;
- goto out;
+ goto_out;
}
/* Unpack the response into an lvm_response_t array */
@@ -267,7 +266,7 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
dm_free(rarray);
errno = ENOMEM;
status = 0;
- goto out;
+ goto_out;
}
strcpy(rarray[i].response, inptr);
5 years, 9 months
master - segtype: better get_monitor_dso_path api
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=27399755fd1b1292cc9...
Commit: 27399755fd1b1292cc93f6469162c0855b7231c2
Parent: e113df129ebc4c2b4fca2a973ac6e06630e1a470
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 10 20:22:32 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Feb 12 22:15:03 2018 +0100
segtype: better get_monitor_dso_path api
Instead of allocating always 4K for dso path, use only real needed size.
Also simplify API call and move common functionality into function
itself.
---
lib/activate/activate.c | 14 +++++---------
lib/activate/activate.h | 2 +-
lib/mirror/mirrored.c | 3 +--
lib/raid/raid.c | 3 +--
lib/snapshot/snapshot.c | 3 +--
lib/thin/thin.c | 3 +--
6 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index b39f314..bd1dc18 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1685,18 +1685,14 @@ bad:
return NULL;
}
-char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath)
+char *get_monitor_dso_path(struct cmd_context *cmd, int id)
{
- char *path;
-
- if (!(path = dm_pool_alloc(cmd->mem, PATH_MAX))) {
- log_error("Failed to allocate dmeventd library path.");
- return NULL;
- }
+ const char *libpath = find_config_tree_str(cmd, id, NULL);
+ char path[PATH_MAX];
- get_shared_library_path(cmd, libpath, path, PATH_MAX);
+ get_shared_library_path(cmd, libpath, path, sizeof(path));
- return path;
+ return dm_pool_strdup(cmd->mem, path);
}
static char *_build_target_uuid(struct cmd_context *cmd, const struct logical_volume *lv)
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index b1cc176..8d06867 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -206,7 +206,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
#ifdef DMEVENTD
# include "libdevmapper-event.h"
-char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath);
+char *get_monitor_dso_path(struct cmd_context *cmd, int id);
int target_registered_with_dmeventd(struct cmd_context *cmd, const char *dso,
const struct logical_volume *lv, int *pending, int *monitored);
int target_register_events(struct cmd_context *cmd, const char *dso, const struct logical_volume *lv,
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 16a5852..2d9c3de 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -572,8 +572,7 @@ struct segment_type *init_segtype(struct cmd_context *cmd)
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
- segtype->dso = get_monitor_dso_path(cmd,
- find_config_tree_str(cmd, dmeventd_mirror_library_CFG, NULL));
+ segtype->dso = get_monitor_dso_path(cmd, dmeventd_mirror_library_CFG);
if (segtype->dso)
segtype->flags |= SEG_MONITORED;
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index eb75c1b..e835160 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -656,8 +656,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
- dso = get_monitor_dso_path(cmd,
- find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL));
+ dso = get_monitor_dso_path(cmd, dmeventd_raid_library_CFG);
if (dso)
monitored = SEG_MONITORED;
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index e44a49a..1105204 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -263,8 +263,7 @@ struct segment_type *init_segtype(struct cmd_context *cmd)
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
- segtype->dso = get_monitor_dso_path(cmd,
- find_config_tree_str(cmd, dmeventd_snapshot_library_CFG, NULL));
+ segtype->dso = get_monitor_dso_path(cmd, dmeventd_snapshot_library_CFG);
if (segtype->dso)
segtype->flags |= SEG_MONITORED;
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 06854ed..dad1bf2 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -816,8 +816,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
- segtype->dso = get_monitor_dso_path(cmd,
- find_config_tree_str(cmd, dmeventd_thin_library_CFG, NULL));
+ segtype->dso = get_monitor_dso_path(cmd, dmeventd_thin_library_CFG);
if ((reg_segtypes[i].flags & SEG_THIN_POOL) &&
segtype->dso)
5 years, 9 months