master - tests: indent
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ee9d623d387c8789fc4...
Commit: ee9d623d387c8789fc40e957af7b47d287a57368
Parent: 6d8356d2084e0cc41ccc70db80e364bce10f0280
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 23 00:55:00 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 23 01:07:27 2018 +0100
tests: indent
---
test/unit/activation-generator_t.c | 114 ++++++++++++++++++------------------
1 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/test/unit/activation-generator_t.c b/test/unit/activation-generator_t.c
index 8157c0c..75f8ae4 100644
--- a/test/unit/activation-generator_t.c
+++ b/test/unit/activation-generator_t.c
@@ -42,22 +42,22 @@ static void _test_begins_with(void *fixture)
{"foo", "foobar", NULL},
{"fish", "fish", ""},
{"foo=bar ", "foo=", "bar "},
- };
+ };
unsigned i;
for (i = 0; i < DM_ARRAY_SIZE(_tests); i++) {
- const char *val;
- struct bw_test *t = _tests + i;
- if (t->val) {
- if (!_begins_with(t->input, t->prefix, &val))
- test_fail("_begins_with('%s', '%s') failed", t->input, t->prefix);
+ const char *val;
+ struct bw_test *t = _tests + i;
+ if (t->val) {
+ if (!_begins_with(t->input, t->prefix, &val))
+ test_fail("_begins_with('%s', '%s') failed", t->input, t->prefix);
if (strcmp(val, t->val))
- test_fail("_begins_with('%s', '%s') -> '%s', expected '%s'",
- t->input, t->prefix, val, t->val);
+ test_fail("_begins_with('%s', '%s') -> '%s', expected '%s'",
+ t->input, t->prefix, val, t->val);
} else {
if (_begins_with(t->input, t->prefix, &val))
- test_fail("_begins_with('%s', '%s') unexpectedly succeeded",
- t->input, t->prefix);
+ test_fail("_begins_with('%s', '%s') unexpectedly succeeded",
+ t->input, t->prefix);
}
}
@@ -71,7 +71,7 @@ struct pb_test {
static const char *_bool(bool v)
{
- return v ? "true" : "false";
+ return v ? "true" : "false";
}
static void _test_parse_bool(void *fixture)
@@ -90,18 +90,18 @@ static void _test_parse_bool(void *fixture)
unsigned i;
for (i = 0; i < DM_ARRAY_SIZE(_tests); i++) {
- bool result;
- struct pb_test *t = _tests + i;
+ bool result;
+ struct pb_test *t = _tests + i;
- if (t->parsed) {
+ if (t->parsed) {
if (!_parse_bool(t->input, &result))
- test_fail("_parse_bool('%s') unexpectedly failed", t->input);
- if (result != t->result)
- test_fail("_parse_bool('%s') -> %s", t->input, _bool(result));
- } else {
- if (_parse_bool(t->input, &result))
- test_fail("_parse_bool('%s') unexpectedly succeeded", t->input);
- }
+ test_fail("_parse_bool('%s') unexpectedly failed", t->input);
+ if (result != t->result)
+ test_fail("_parse_bool('%s') -> %s", t->input, _bool(result));
+ } else {
+ if (_parse_bool(t->input, &result))
+ test_fail("_parse_bool('%s') unexpectedly succeeded", t->input);
+ }
}
}
@@ -115,18 +115,18 @@ struct pl_test {
static void _test_parse_line(void *fixture)
{
static struct pl_test _tests[] = {
- {"", false, false, false},
- {"sldkjfs", false, false, false},
- {"event_activation=1", true, true, true},
- {"event_activation=0", true, false, true},
- {"use_lvmpolld=1", true, false, false},
- {"use_lvmpolld=0", true, false, true}
+ {"", false, false, false},
+ {"sldkjfs", false, false, false},
+ {"event_activation=1", true, true, true},
+ {"event_activation=0", true, false, true},
+ {"use_lvmpolld=1", true, false, false},
+ {"use_lvmpolld=0", true, false, true}
};
unsigned i;
for (i = 0; i< DM_ARRAY_SIZE(_tests); i++) {
- bool r;
+ bool r;
struct config cfg = {
.sysinit_needed = true
};
@@ -135,50 +135,50 @@ static void _test_parse_line(void *fixture)
r = _parse_line(t->input, &cfg);
if (t->success) {
if (!r)
- test_fail("_parse_line('%s') failed", t->input);
+ test_fail("_parse_line('%s') failed", t->input);
if (cfg.event_activation != t->event_activation)
test_fail("_parse_line('%s') -> event_activation='%s'",
t->input, _bool(cfg.event_activation));
- if (cfg.sysinit_needed != t->sysinit_needed)
- test_fail("_parse_line('%s') -> sysinit_needed='%s'",
- t->input, _bool(cfg.sysinit_needed));
+ if (cfg.sysinit_needed != t->sysinit_needed)
+ test_fail("_parse_line('%s') -> sysinit_needed='%s'",
+ t->input, _bool(cfg.sysinit_needed));
} else if (r)
- test_fail("_parse_line('%s') succeeded", t->input);
+ test_fail("_parse_line('%s') succeeded", t->input);
}
}
static void _test_get_config_bad_path(void *fixture)
{
- struct config cfg;
+ struct config cfg;
if (_get_config(&cfg, "/usr/bin/no-such-file"))
- test_fail("_get_config() succeeded despite a bad lvmconfig path");
+ test_fail("_get_config() succeeded despite a bad lvmconfig path");
}
static void _test_get_config_bad_exit(void *fixture)
{
- struct config cfg;
+ struct config cfg;
if (_get_config(&cfg, "/usr/bin/false"))
- test_fail("_get_config() succeeded despite a bad lvmconfig exit");
+ test_fail("_get_config() succeeded despite a bad lvmconfig exit");
}
struct gc_test {
- const char *output;
- bool success;
- bool event_activation;
- bool sysinit_needed;
+ const char *output;
+ bool success;
+ bool event_activation;
+ bool sysinit_needed;
};
static const char *_fake_lvmconfig(const char *output)
{
- const char *path = "./fake-lvmconfig";
+ const char *path = "./fake-lvmconfig";
FILE *fp = fopen(path, "w");
if (!fp)
- return NULL;
+ return NULL;
fprintf(fp, "#!/usr/bin/env bash\n");
fprintf(fp, "cat <<EOF\n");
@@ -207,33 +207,33 @@ static void _test_get_config(void *fixture)
const char *path;
for (i = 0; i < DM_ARRAY_SIZE(_tests); i++) {
- struct gc_test *t = _tests + i;
+ struct gc_test *t = _tests + i;
struct config cfg = {
.sysinit_needed = true
};
path = _fake_lvmconfig(t->output);
if (!path)
- test_fail("couldn't create fake lvmconfig");
+ test_fail("couldn't create fake lvmconfig");
- r = _get_config(&cfg, path);
- if (t->success) {
+ r = _get_config(&cfg, path);
+ if (t->success) {
if (!r)
- test_fail("_get_config() <- '%s' failed", t->output);
+ test_fail("_get_config() <- '%s' failed", t->output);
if (t->event_activation != cfg.event_activation)
test_fail("_get_config() <- '%s', event_activation = %s",
t->output, _bool(cfg.event_activation));
- if (t->sysinit_needed != cfg.sysinit_needed)
- test_fail("_get_config() <- '%s', sysinit = %s",
- t->output, _bool(cfg.sysinit_needed));
- } else {
+ if (t->sysinit_needed != cfg.sysinit_needed)
+ test_fail("_get_config() <- '%s', sysinit = %s",
+ t->output, _bool(cfg.sysinit_needed));
+ } else {
if (r)
- test_fail("_get_config() <- '%s' unexpectedly succeeded", t->output);
- }
+ test_fail("_get_config() <- '%s' unexpectedly succeeded", t->output);
+ }
- unlink(path);
+ unlink(path);
}
}
@@ -245,8 +245,8 @@ static struct test_suite *_tests(void)
{
struct test_suite *ts = test_suite_create(NULL, NULL);
if (!ts) {
- fprintf(stderr, "out of memory\n");
- exit(1);
+ fprintf(stderr, "out of memory\n");
+ exit(1);
};
T("begins-with", "Test cases for _begins_with()", _test_begins_with);
4 years, 11 months
master - tests: fix unit test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6d8356d2084e0cc41cc...
Commit: 6d8356d2084e0cc41ccc70db80e364bce10f0280
Parent: 1dee4b4ffcbc4324316718edbe464bbeb98a17db
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 23 00:54:39 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 23 01:07:27 2018 +0100
tests: fix unit test
Use more universal /usr/bin/env bash
(as older systems do only have /bin/sh)
Uncommment disabled event_activation testing.
---
test/unit/activation-generator_t.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/unit/activation-generator_t.c b/test/unit/activation-generator_t.c
index 6aa115c..8157c0c 100644
--- a/test/unit/activation-generator_t.c
+++ b/test/unit/activation-generator_t.c
@@ -137,9 +137,9 @@ static void _test_parse_line(void *fixture)
if (!r)
test_fail("_parse_line('%s') failed", t->input);
- //if (cfg.event_activation != t->event_activation)
- // test_fail("_parse_line('%s') -> event_activation='%s'",
- // t->input, _bool(cfg.event_activation));
+ if (cfg.event_activation != t->event_activation)
+ test_fail("_parse_line('%s') -> event_activation='%s'",
+ t->input, _bool(cfg.event_activation));
if (cfg.sysinit_needed != t->sysinit_needed)
test_fail("_parse_line('%s') -> sysinit_needed='%s'",
@@ -180,7 +180,7 @@ static const char *_fake_lvmconfig(const char *output)
if (!fp)
return NULL;
- fprintf(fp, "#!/usr/bin/sh\n");
+ fprintf(fp, "#!/usr/bin/env bash\n");
fprintf(fp, "cat <<EOF\n");
fprintf(fp, "%s", output);
fprintf(fp, "EOF\n");
@@ -221,9 +221,9 @@ static void _test_get_config(void *fixture)
if (!r)
test_fail("_get_config() <- '%s' failed", t->output);
- //if (t->event_activation != cfg.event_activation)
- // test_fail("_get_config() <- '%s', event_activation = %s",
- // t->output, _bool(cfg.event_activation));
+ if (t->event_activation != cfg.event_activation)
+ test_fail("_get_config() <- '%s', event_activation = %s",
+ t->output, _bool(cfg.event_activation));
if (t->sysinit_needed != cfg.sysinit_needed)
test_fail("_get_config() <- '%s', sysinit = %s",
4 years, 11 months
master - tests: testing mirrorred mirror log
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1dee4b4ffcbc4324316...
Commit: 1dee4b4ffcbc4324316718edbe464bbeb98a17db
Parent: 88faf5a53b34cdfe2d4932a6800af8530f8f5396
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 23 01:06:16 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 23 01:07:05 2018 +0100
tests: testing mirrorred mirror log
Enable mirrorlog creation for test.
---
test/shell/lvconvert-mirror-basic.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh
index 8166613..96d30d2 100644
--- a/test/shell/lvconvert-mirror-basic.sh
+++ b/test/shell/lvconvert-mirror-basic.sh
@@ -14,6 +14,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
log_name_to_count() {
case "$1" in
mirrored) echo 2 ;;
4 years, 11 months
master - debug: drop some unneeded backtraces
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=88faf5a53b34cdfe2d4...
Commit: 88faf5a53b34cdfe2d4932a6800af8530f8f5396
Parent: 44aeb6d6b8766dc547ba56a7d1580ccb0da974c7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 22 23:44:42 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 22 23:55:48 2018 +0100
debug: drop some unneeded backtraces
---
lib/format_text/export.c | 4 ++--
lib/format_text/format-text.c | 2 +-
libdm/libdm-stats.c | 2 +-
tools/lvconvert.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 48e4c9a..841e06d 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -1098,13 +1098,13 @@ struct dm_config_tree *export_vg_to_config_tree(struct volume_group *vg)
if (!export_vg_to_buffer(vg, &buf)) {
log_error("Could not format metadata for VG %s.", vg->name);
- return_NULL;
+ return NULL;
}
if (!(vg_cft = config_tree_from_string_without_dup_node_check(buf))) {
log_error("Error parsing metadata for VG %s.", vg->name);
free(buf);
- return_NULL;
+ return NULL;
}
free(buf);
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index f5bbf9e..414941f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -567,7 +567,7 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
if (!(mdah = raw_read_mda_header(fid->fmt, area, primary_mda))) {
log_error("Failed to read vg %s from %s", vgname, dev_name(area->dev));
- goto_out;
+ goto out;
}
if (!(rlocn = _read_metadata_location_vg(area, mdah, primary_mda, vgname, &precommitted))) {
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 4c7fd46..420e3e1 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4680,7 +4680,7 @@ static uint64_t *_stats_map_file_regions(struct dm_stats *dms, int fd,
/* make space for end-of-table marker */
if (!(regions = dm_malloc((1 + *count) * sizeof(*regions)))) {
log_error("Could not allocate memory for region IDs.");
- goto_out;
+ goto out;
}
/*
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index b63dc34..7139be3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4235,7 +4235,7 @@ static int _lvconvert_cache_attach_single(struct cmd_context *cmd,
} else {
log_error(INTERNAL_ERROR "Invalid cache pool state for %s", cachepool_lv->name);
- goto_out;
+ goto out;
}
log_print_unless_silent("Logical volume %s is now cached.", display_lvname(lv));
4 years, 11 months
master - cleanup: use zalloc
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=44aeb6d6b8766dc547b...
Commit: 44aeb6d6b8766dc547ba56a7d1580ccb0da974c7
Parent: fc479b2b079735afce810d3d352e367216d5a931
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 22 23:33:23 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 22 23:55:48 2018 +0100
cleanup: use zalloc
Some places forget to use zalloc().
---
daemons/cmirrord/cluster.c | 10 ++++------
daemons/lvmlockd/lvmlockd-core.c | 3 +--
daemons/lvmlockd/lvmlockd-dlm.c | 3 +--
daemons/lvmlockd/lvmlockd-sanlock.c | 6 ++----
4 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c
index c516447..9df321a 100644
--- a/daemons/cmirrord/cluster.c
+++ b/daemons/cmirrord/cluster.c
@@ -17,6 +17,7 @@
#include "link_mon.h"
#include "local.h"
#include "lib/mm/xlate.h"
+#include "base/memory/zalloc.h"
/* FIXME: remove this and the code */
#define CMIRROR_HAS_CHECKPOINT 0
@@ -402,13 +403,12 @@ static struct checkpoint_data *prepare_checkpoint(struct clog_cpg *entry,
return NULL;
}
- new = malloc(sizeof(*new));
+ new = zalloc(sizeof(*new));
if (!new) {
LOG_ERROR("Unable to create checkpoint data for %u",
cp_requester);
return NULL;
}
- memset(new, 0, sizeof(*new));
new->requester = cp_requester;
strncpy(new->uuid, entry->name.value, entry->name.length);
@@ -643,13 +643,12 @@ static int export_checkpoint(struct checkpoint_data *cp)
rq_size += RECOVERING_REGION_SECTION_SIZE;
rq_size += cp->bitmap_size * 2; /* clean|sync_bits */
- rq = malloc(rq_size);
+ rq = zalloc(rq_size);
if (!rq) {
LOG_ERROR("export_checkpoint: "
"Unable to allocate transfer structs");
return -ENOMEM;
}
- memset(rq, 0, rq_size);
dm_list_init(&rq->u.list);
rq->u_rq.request_type = DM_ULOG_CHECKPOINT_READY;
@@ -1621,12 +1620,11 @@ int create_cluster_cpg(char *uuid, uint64_t luid)
return -EEXIST;
}
- new = malloc(sizeof(*new));
+ new = zalloc(sizeof(*new));
if (!new) {
LOG_ERROR("Unable to allocate memory for clog_cpg");
return -ENOMEM;
}
- memset(new, 0, sizeof(*new));
dm_list_init(&new->list);
new->lowest_id = 0xDEAD;
dm_list_init(&new->startup_list);
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index e643d76..1ec3efd 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -405,12 +405,11 @@ struct lockspace *alloc_lockspace(void)
{
struct lockspace *ls;
- if (!(ls = malloc(sizeof(struct lockspace)))) {
+ if (!(ls = zalloc(sizeof(struct lockspace)))) {
log_error("out of memory for lockspace");
return NULL;
}
- memset(ls, 0, sizeof(struct lockspace));
INIT_LIST_HEAD(&ls->actions);
INIT_LIST_HEAD(&ls->resources);
pthread_mutex_init(&ls->mutex, NULL);
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index 668c75b..e73be51 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -272,10 +272,9 @@ static int lm_add_resource_dlm(struct lockspace *ls, struct resource *r, int wit
int rv;
if (r->type == LD_RT_GL || r->type == LD_RT_VG) {
- buf = malloc(sizeof(struct val_blk) + DLM_LVB_LEN);
+ buf = zalloc(sizeof(struct val_blk) + DLM_LVB_LEN);
if (!buf)
return -ENOMEM;
- memset(buf, 0, sizeof(struct val_blk) + DLM_LVB_LEN);
rdd->vb = (struct val_blk *)buf;
rdd->lksb.sb_lvbptr = buf + sizeof(struct val_blk);
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 7cbf92d..f960daf 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -1393,7 +1393,7 @@ int lm_prepare_lockspace_sanlock(struct lockspace *ls)
goto fail;
}
- lms = malloc(sizeof(struct lm_sanlock));
+ lms = zalloc(sizeof(struct lm_sanlock));
if (!lms) {
ret = -ENOMEM;
goto fail;
@@ -1402,7 +1402,6 @@ int lm_prepare_lockspace_sanlock(struct lockspace *ls)
memset(lsname, 0, sizeof(lsname));
strncpy(lsname, ls->name, SANLK_NAME_LEN);
- memset(lms, 0, sizeof(struct lm_sanlock));
memcpy(lms->ss.name, lsname, SANLK_NAME_LEN);
lms->ss.host_id_disk.offset = 0;
lms->ss.host_id = ls->host_id;
@@ -1615,10 +1614,9 @@ static int lm_add_resource_sanlock(struct lockspace *ls, struct resource *r)
/* LD_RT_LV offset is set in each lm_lock call from lv_args. */
if (r->type == LD_RT_GL || r->type == LD_RT_VG) {
- rds->vb = malloc(sizeof(struct val_blk));
+ rds->vb = zalloc(sizeof(struct val_blk));
if (!rds->vb)
return -ENOMEM;
- memset(rds->vb, 0, sizeof(struct val_blk));
}
return 0;
4 years, 11 months
master - cov: fix memleak on error path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fc479b2b079735afce8...
Commit: fc479b2b079735afce810d3d352e367216d5a931
Parent: 83c6f7e7e6e76199d836bf694266c78e3cbc12f1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 22 23:37:04 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 22 23:55:48 2018 +0100
cov: fix memleak on error path
Do not leak lvs pointer on error path.
---
daemons/lvmlockd/lvmlockd-sanlock.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 993f2f5..7cbf92d 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -1453,7 +1453,8 @@ int lm_prepare_lockspace_sanlock(struct lockspace *ls)
align_size = sanlock_align(&lms->ss.host_id_disk);
if (align_size <= 0) {
log_error("S %s prepare_lockspace_san align error %d", lsname, align_size);
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
sector_size = (align_size == ONE_MB) ? 512 : 4096;
log_debug("S %s prepare_lockspace_san found old sector_size %d align_size %d", lsname, sector_size, align_size);
4 years, 11 months
master - stats: initilize regions to NULL
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=83c6f7e7e6e76199d83...
Commit: 83c6f7e7e6e76199d836bf694266c78e3cbc12f1
Parent: 1fc5d8c4285fd42441a4f57e4c8fc242397b84f3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 22:42:36 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 22:42:36 2018 +0100
stats: initilize regions to NULL
Commit 3750b0cff5ab1c41076afdf8275e3fa20aa756d0 used bad: error
path in more occasions thus it now needs regions defined as NULL.
---
libdm/libdm-stats.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 80cb42b..4c7fd46 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4809,7 +4809,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
{
struct dm_histogram *bounds = NULL;
int nr_bins, precise, regroup;
- uint64_t *regions, count = 0;
+ uint64_t *regions = NULL, count = 0;
const char *alias = NULL;
if (!dms->regions || !dm_stats_group_present(dms, group_id)) {
4 years, 11 months
master - Revert "lvmlockd: Fix arguments when built without sanlock"
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1fc5d8c4285fd42441a...
Commit: 1fc5d8c4285fd42441a4f57e4c8fc242397b84f3
Parent: 26ead4bf45e94e6cfee2036d1c0c800abf4344b3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 22:41:00 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 22:41:00 2018 +0100
Revert "lvmlockd: Fix arguments when built without sanlock"
This reverts commit b068f21f6a24094936a33269067c18373b48f2cd.
This revert was incorrect.
---
daemons/lvmlockd/lvmlockd-internal.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index ead3098..04645fa 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -504,7 +504,7 @@ static inline int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flag
return -1;
}
-static inline int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, uint64_t free_offset)
+static inline int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, int sector_size, int align_size, uint64_t free_offset)
{
return -1;
}
@@ -592,7 +592,7 @@ static inline int lm_is_running_sanlock(void)
return 0;
}
-static inline int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
+static inline int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset, int *sector_size, int *align_size)
{
return -1;
}
4 years, 11 months
master - cov: extent_size cannot be 0
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=26ead4bf45e94e6cfee...
Commit: 26ead4bf45e94e6cfee2036d1c0c800abf4344b3
Parent: 9dfb1a11b76282ed8f3819bf63c369b179fac78d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 20:55:50 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:45:08 2018 +0100
cov: extent_size cannot be 0
Make this obvious to coverity.
---
lib/metadata/cache_manip.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 6cf945b..656e49d 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -1201,7 +1201,10 @@ int cache_single_set_params(struct cmd_context *cmd,
* data size: the LV size minus the metadata size.
*/
- extent_size = pool_lv->vg->extent_size;
+ if (!(extent_size = pool_lv->vg->extent_size)) {
+ log_error(INTERNAL_ERROR "Extend size can't be 0.");
+ return 0;
+ }
min_meta_size = extent_size;
max_meta_size = 2 * DEFAULT_CACHE_POOL_MAX_METADATA_SIZE; /* 2x for KiB to sectors */
4 years, 11 months
master - cov: drop unneeded header file
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9dfb1a11b76282ed8f3...
Commit: 9dfb1a11b76282ed8f3819bf63c369b179fac78d
Parent: a355aeb17a4fda7fab76a2c85bdc7ff03159424a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 20:52:49 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:45:08 2018 +0100
cov: drop unneeded header file
MAX macro no longer needed in pe_align.
---
lib/metadata/metadata.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 6a0be85..9efc355 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -34,7 +34,6 @@
#include "lib/notify/lvmnotify.h"
#include <math.h>
-#include <sys/param.h>
static struct physical_volume *_pv_read(struct cmd_context *cmd,
const struct format_type *fmt,
4 years, 11 months