master - cleanup: access pool segs with check
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5d73c0c674502b...
Commit: 5d73c0c674502bc1cf4962ee958511adf53fd720
Parent: 5e19410d935134794b7a206b5300e43be44c8a28
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 22:02:12 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:33 2013 +0200
cleanup: access pool segs with check
Add some minor checks after first_seg(lv).
Use direct check for thin pool segment.
Drop some unneeded {}
---
lib/metadata/lv.c | 30 ++++++++++++++++++++----------
lib/metadata/thin_manip.c | 7 ++++++-
lib/report/report.c | 12 ++++++------
3 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index fb7870d..6215e1a 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -170,7 +170,7 @@ uint64_t lvseg_chunksize(const struct lv_segment *seg)
if (lv_is_cow(seg->lv))
size = (uint64_t) find_cow(seg->lv)->chunk_size;
- else if (lv_is_thin_pool(seg->lv))
+ else if (seg_is_thin_pool(seg))
size = (uint64_t) seg->chunk_size;
else
size = UINT64_C(0);
@@ -254,14 +254,16 @@ char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
char *lv_data_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
- return lv_is_thin_pool(lv) ?
- dm_pool_strdup(mem, seg_lv(first_seg(lv), 0)->name) : NULL;
+ struct lv_segment *seg = lv_is_thin_pool(lv) ? first_seg(lv) : NULL;
+
+ return seg ? dm_pool_strdup(mem, seg_lv(seg, 0)->name) : NULL;
}
char *lv_metadata_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
- return lv_is_thin_pool(lv) ?
- dm_pool_strdup(mem, first_seg(lv)->metadata_lv->name) : NULL;
+ struct lv_segment *seg = lv_is_thin_pool(lv) ? first_seg(lv) : NULL;
+
+ return seg ? dm_pool_strdup(mem, seg->metadata_lv->name) : NULL;
}
const char *lv_layer(const struct logical_volume *lv)
@@ -310,27 +312,35 @@ char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
struct lv_segment *seg;
- dm_list_iterate_items(seg, &lv->segments) {
+ dm_list_iterate_items(seg, &lv->segments)
if (seg->status & PVMOVE)
return dm_pool_strdup(mem, dev_name(seg_dev(seg, 0)));
- }
+
return NULL;
}
uint64_t lv_origin_size(const struct logical_volume *lv)
{
+ struct lv_segment *seg;
+
if (lv_is_cow(lv))
return (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
- if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv)
- return first_seg(lv)->external_lv->size;
+
+ if (lv_is_thin_volume(lv) && (seg = first_seg(lv)) &&
+ seg->external_lv)
+ return seg->external_lv->size;
+
if (lv_is_origin(lv))
return lv->size;
+
return 0;
}
uint64_t lv_metadata_size(const struct logical_volume *lv)
{
- return lv_is_thin_pool(lv) ? first_seg(lv)->metadata_lv->size : 0;
+ struct lv_segment *seg = lv_is_thin_pool(lv) ? first_seg(lv) : NULL;
+
+ return seg ? seg->metadata_lv->size : 0;
}
char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 37b5d77..bd30458 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -378,7 +378,12 @@ struct logical_volume *find_pool_lv(struct logical_volume *lv)
{
struct lv_segment *seg;
- if (!(seg = find_pool_seg(first_seg(lv))))
+ if (!(seg = first_seg(lv))) {
+ log_error("LV %s has no segment", lv->name);
+ return NULL;
+ }
+
+ if (!(seg = find_pool_seg(seg)))
return_NULL;
return seg->lv;
diff --git a/lib/report/report.c b/lib/report/report.c
index 47b3a33..8ff4f28 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -277,10 +277,10 @@ static int _datalv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
const void *data, void *private __attribute__((unused)))
{
const struct logical_volume *lv = (const struct logical_volume *) data;
+ const struct lv_segment *seg = lv_is_thin_pool(lv) ? first_seg(lv) : NULL;
- if (lv_is_thin_pool(lv))
- return _lvname_disp(rh, mem, field,
- seg_lv(first_seg(lv), 0), private);
+ if (seg)
+ return _lvname_disp(rh, mem, field, seg_lv(seg, 0), private);
dm_report_field_set_value(field, "", NULL);
return 1;
@@ -291,10 +291,10 @@ static int _metadatalv_disp(struct dm_report *rh, struct dm_pool *mem __attribut
const void *data, void *private __attribute__((unused)))
{
const struct logical_volume *lv = (const struct logical_volume *) data;
+ const struct lv_segment *seg = lv_is_thin_pool(lv) ? first_seg(lv) : NULL;
- if (lv_is_thin_pool(lv))
- return _lvname_disp(rh, mem, field,
- first_seg(lv)->metadata_lv, private);
+ if (seg)
+ return _lvname_disp(rh, mem, field, seg->metadata_lv, private);
dm_report_field_set_value(field, "", NULL);
return 1;
10 years, 10 months
master - cleanup: use simplier structure initialization
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e19410d935134...
Commit: 5e19410d935134794b7a206b5300e43be44c8a28
Parent: 636c51ae3f0fda00b38851ead7f419bc834786a4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 22:00:44 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:33 2013 +0200
cleanup: use simplier structure initialization
And also use static struct for _out_spec.
---
daemons/dmeventd/dmeventd.c | 4 ++--
lib/config/config.c | 20 +++++++++++---------
libdm/libdm-config.c | 14 +++++++++-----
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 64e1683..50bd1df 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1830,8 +1830,8 @@ static void _daemonize(void)
static void restart(void)
{
- struct dm_event_fifos fifos;
- struct dm_event_daemon_message msg = { 0, 0, NULL };
+ struct dm_event_fifos fifos = { 0 };
+ struct dm_event_daemon_message msg = { 0 };
int i, count = 0;
char *message;
int length;
diff --git a/lib/config/config.c b/lib/config/config.c
index cda9b83..7b6ac7b 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -879,16 +879,18 @@ int config_write(struct dm_config_tree *cft,
int withcomment, int withversion,
const char *file, int argc, char **argv)
{
- struct out_baton baton = {0, 0, 0};
+ static const struct dm_config_node_out_spec _out_spec = {
+ .prefix_fn = _out_prefix_fn,
+ .line_fn = _out_line_fn,
+ .suffix_fn = _out_suffix_fn
+ };
const struct dm_config_node *cn;
- const struct dm_config_node_out_spec out_spec = {.prefix_fn = _out_prefix_fn,
- .line_fn = _out_line_fn,
- .suffix_fn = _out_suffix_fn};
+ struct out_baton baton = {
+ .withcomment = withcomment,
+ .withversion = withversion
+ };
int r = 1;
- baton.withcomment = withcomment;
- baton.withversion = withversion;
-
if (!file) {
baton.fp = stdout;
file = "stdout";
@@ -899,13 +901,13 @@ int config_write(struct dm_config_tree *cft,
log_verbose("Dumping configuration to %s", file);
if (!argc) {
- if (!dm_config_write_node_out(cft->root, &out_spec, &baton)) {
+ if (!dm_config_write_node_out(cft->root, &_out_spec, &baton)) {
log_error("Failure while writing to %s", file);
r = 0;
}
} else while (argc--) {
if ((cn = dm_config_find_node(cft->root, *argv))) {
- if (!dm_config_write_one_node_out(cn, &out_spec, &baton)) {
+ if (!dm_config_write_one_node_out(cn, &_out_spec, &baton)) {
log_error("Failure while writing to %s", file);
r = 0;
}
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index dfd9174..3385e18 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -346,12 +346,16 @@ static int _write_node(const struct dm_config_node *cn, int only_one,
const struct dm_config_node_out_spec *out_spec,
void *baton)
{
- struct config_output out;
- if (!(out.mem = dm_pool_create("config_output", 1024)))
+ struct config_output out = {
+ .mem = dm_pool_create("config_output", 1024),
+ .putline = putline,
+ .spec = out_spec,
+ .baton = baton
+ };
+
+ if (!out.mem)
return_0;
- out.putline = putline;
- out.spec = out_spec;
- out.baton = baton;
+
if (!_write_config(cn, only_one, &out, 0)) {
dm_pool_destroy(out.mem);
return_0;
10 years, 10 months
master - cleanup: use unrelated temporary variables
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=636c51ae3f0fda...
Commit: 636c51ae3f0fda00b38851ead7f419bc834786a4
Parent: 450ac7be4297012d57880e39261eda726cb75eba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 21:49:12 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:33 2013 +0200
cleanup: use unrelated temporary variables
use of tmp_rq2 is unrelated to tmp_rq - so use separate
variable.
---
daemons/cmirrord/cluster.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c
index 70c76c3..f19b2a9 100644
--- a/daemons/cmirrord/cluster.c
+++ b/daemons/cmirrord/cluster.c
@@ -1020,7 +1020,7 @@ static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gna
int i_am_server;
int response = 0;
struct clog_request *rq = msg;
- struct clog_request *tmp_rq;
+ struct clog_request *tmp_rq, *tmp_rq2;
struct clog_cpg *match;
match = find_clog_cpg(handle);
@@ -1151,18 +1151,17 @@ static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gna
if (match->state == INVALID) {
LOG_DBG("Log not valid yet, storing request");
- tmp_rq = malloc(DM_ULOG_REQUEST_SIZE);
- if (!tmp_rq) {
+ if (!(tmp_rq2 = malloc(DM_ULOG_REQUEST_SIZE))) {
LOG_ERROR("cpg_message_callback: Unable to"
" allocate transfer structs");
r = -ENOMEM; /* FIXME: Better error #? */
goto out;
}
- memcpy(tmp_rq, rq, sizeof(*rq) + rq->u_rq.data_size);
- tmp_rq->pit_server = match->lowest_id;
- dm_list_init(&tmp_rq->u.list);
- dm_list_add(&match->startup_list, &tmp_rq->u.list);
+ memcpy(tmp_rq2, rq, sizeof(*rq) + rq->u_rq.data_size);
+ tmp_rq2->pit_server = match->lowest_id;
+ dm_list_init(&tmp_rq2->u.list);
+ dm_list_add(&match->startup_list, &tmp_rq2->u.list);
goto out;
}
10 years, 10 months
master - cleanup: move string in the use-place
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=450ac7be429701...
Commit: 450ac7be4297012d57880e39261eda726cb75eba
Parent: 17a3ddf89e4148b4fdfe32c2da22beff7b1ca465
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 21:48:33 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:33 2013 +0200
cleanup: move string in the use-place
---
tools/pvremove.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/pvremove.c b/tools/pvremove.c
index cbbf6e2..2c8f5c6 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -15,9 +15,6 @@
#include "tools.h"
-const char _really_wipe[] =
- "Really WIPE LABELS from physical volume \"%s\" of volume group \"%s\" [y/n]? ";
-
/*
* Decide whether it is "safe" to wipe the labels on this device.
* 0 indicates we may not.
@@ -74,7 +71,9 @@ static int pvremove_check(struct cmd_context *cmd, const char *name)
/* prompt */
if (!arg_count(cmd, yes_ARG) &&
- yes_no_prompt(_really_wipe, name, pv_vg_name(pv)) == 'n') {
+ yes_no_prompt("Really WIPE LABELS from physical volume \"%s\" "
+ "of volume group \"%s\" [y/n]? ",
+ name, pv_vg_name(pv)) == 'n') {
log_error("%s: physical volume label not removed", name);
goto bad;
}
10 years, 10 months
master - cleanup: drop unused headers
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17a3ddf89e4148...
Commit: 17a3ddf89e4148b4fdfe32c2da22beff7b1ca465
Parent: 02405219424619a56e7e3a3619e157f942e4fdb4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 09:52:02 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:32 2013 +0200
cleanup: drop unused headers
Drop heades which do not provide any used symbols.
---
lib/activate/activate.c | 1 -
lib/activate/dev_manager.c | 1 -
lib/cache/lvmcache.c | 2 --
lib/device/dev-luks.c | 1 -
lib/device/dev-swap.c | 1 -
lib/filters/filter.c | 4 ----
lib/format1/disk-rep.c | 1 -
lib/format1/import-export.c | 1 -
lib/format_pool/disk_rep.c | 1 -
9 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index a69b725..342a474 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -26,7 +26,6 @@
#include "dev_manager.h"
#include "str_list.h"
#include "config.h"
-#include "filter.h"
#include "segtype.h"
#include "sharedlib.h"
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 9855bc9..e471f95 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -23,7 +23,6 @@
#include "toolcontext.h"
#include "targets.h"
#include "config.h"
-#include "filter.h"
#include "activate.h"
#include "lvm-exec.h"
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index c0b3299..2da09d1 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -19,8 +19,6 @@
#include "dev-cache.h"
#include "locking.h"
#include "metadata.h"
-#include "filter.h"
-#include "filter-persistent.h"
#include "memlock.h"
#include "str_list.h"
#include "format-text.h"
diff --git a/lib/device/dev-luks.c b/lib/device/dev-luks.c
index 2c79a2b..2671d62 100644
--- a/lib/device/dev-luks.c
+++ b/lib/device/dev-luks.c
@@ -14,7 +14,6 @@
#include "lib.h"
#include "dev-type.h"
-#include "metadata.h"
#define LUKS_SIGNATURE "LUKS\xba\xbe"
#define LUKS_SIGNATURE_SIZE 6
diff --git a/lib/device/dev-swap.c b/lib/device/dev-swap.c
index c3b121b..6faa810 100644
--- a/lib/device/dev-swap.c
+++ b/lib/device/dev-swap.c
@@ -14,7 +14,6 @@
#include "lib.h"
#include "dev-type.h"
-#include "metadata.h"
#ifdef linux
diff --git a/lib/filters/filter.c b/lib/filters/filter.c
index cf06f88..56935f9 100644
--- a/lib/filters/filter.c
+++ b/lib/filters/filter.c
@@ -15,10 +15,6 @@
#include "lib.h"
#include "filter.h"
-#include "lvm-string.h"
-#include "config.h"
-#include "metadata.h"
-#include "activate.h"
static int _passes_lvm_type_device_filter(struct dev_filter *f, struct device *dev)
{
diff --git a/lib/format1/disk-rep.c b/lib/format1/disk-rep.c
index bbce317..f42d344 100644
--- a/lib/format1/disk-rep.c
+++ b/lib/format1/disk-rep.c
@@ -16,7 +16,6 @@
#include "lib.h"
#include "disk-rep.h"
#include "xlate.h"
-#include "filter.h"
#include "lvmcache.h"
#include "metadata-exported.h"
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index 5c5d890..5ef19ef 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -20,7 +20,6 @@
#include "lib.h"
#include "disk-rep.h"
#include "lvm-string.h"
-#include "filter.h"
#include "toolcontext.h"
#include "segtype.h"
#include "pv_alloc.h"
diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c
index f696463..fef0451 100644
--- a/lib/format_pool/disk_rep.c
+++ b/lib/format_pool/disk_rep.c
@@ -17,7 +17,6 @@
#include "label.h"
#include "metadata.h"
#include "lvmcache.h"
-#include "filter.h"
#include "xlate.h"
#include "disk_rep.h"
#include "toolcontext.h"
10 years, 10 months
master - cleanup: add extra internal error
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=02405219424619...
Commit: 02405219424619a56e7e3a3619e157f942e4fdb4
Parent: a040dd8cfb8828e07a4df00117d89173562ab8be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 09:51:09 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:32 2013 +0200
cleanup: add extra internal error
Ensure the target line will work only with segment with pool.
---
lib/thin/thin.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index d1ffd27..116b7e1 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -493,6 +493,11 @@ static int _thin_add_target_line(struct dev_manager *dm,
char *pool_dlid, *external_dlid;
uint32_t device_id = seg->device_id;
+ if (!seg->pool_lv) {
+ log_error(INTERNAL_ERROR "Segment %s has no pool.",
+ seg->lv->name);
+ return 0;
+ }
if (!(pool_dlid = build_dm_uuid(mem, seg->pool_lv->lvid.s, lv_layer(seg->pool_lv)))) {
log_error("Failed to build uuid for pool LV %s.",
seg->pool_lv->name);
10 years, 10 months
master - config: skip close of stdin
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a040dd8cfb8828...
Commit: a040dd8cfb8828e07a4df00117d89173562ab8be
Parent: 8fb5f63637ca47ecffdf84c721ff21315df8ef42
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 23:18:29 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:32 2013 +0200
config: skip close of stdin
If the used stream has been stdout, do not close it.
---
lib/config/config.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 2fd8793..cda9b83 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -916,7 +916,7 @@ int config_write(struct dm_config_tree *cft,
argv++;
}
- if (baton.fp && dm_fclose(baton.fp)) {
+ if (baton.fp && baton.fp != stdout && dm_fclose(baton.fp)) {
stack;
r = 0;
}
10 years, 10 months
master - mirror: add missing error message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8fb5f63637ca47...
Commit: 8fb5f63637ca47ecffdf84c721ff21315df8ef42
Parent: 54e062265074766becc06d2fdb0020ade56cf95d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jun 15 18:43:36 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:32 2013 +0200
mirror: add missing error message
When a user has not proceeded with conversion,
print the error message why the command has failed.
---
lib/metadata/mirror.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 6c6554e..4f36e0d 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1726,8 +1726,10 @@ int remove_mirror_log(struct cmd_context *cmd,
"inactive mirror %s to core log. "
"Proceed? [y/n]: ", lv->name) == 'y')
sync_percent = 0;
- else
+ else {
+ log_error("Logical volume %s NOT converted.", lv->name);
return 0;
+ }
if (sync_percent == PERCENT_100)
init_mirror_in_sync(1);
10 years, 10 months
master - lvmetad: add some message for error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=54e06226507476...
Commit: 54e062265074766becc06d2fdb0020ade56cf95d
Parent: c2dc21d89fb1b60fd57fd471e3934132f4f53dc6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 14 23:17:28 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 16 00:07:32 2013 +0200
lvmetad: add some message for error path
Do not leave replay uninitialized for internal error.
---
lib/cache/lvmetad.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 6c8b10b..a107047 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -345,6 +345,7 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
} else {
if (!vgname) {
log_error(INTERNAL_ERROR "VG name required (VGID not available)");
+ reply = _lvmetad_send("vg_lookup", "name = %s", "MISSING", NULL);
goto out;
}
log_debug_lvmetad("Asking lvmetad for VG %s", vgname);
10 years, 10 months
master - text: miscellaneous comments & message tweaks
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c2dc21d89fb1b6...
Commit: c2dc21d89fb1b60fd57fd471e3934132f4f53dc6
Parent: 538acd56f1a3cd439028e0b9c9d6106cb820228c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat Jun 15 01:28:54 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat Jun 15 01:28:54 2013 +0100
text: miscellaneous comments & message tweaks
---
WHATS_NEW | 10 +++++-----
WHATS_NEW_DM | 2 +-
daemons/dmeventd/dmeventd.c | 2 +-
doc/example.conf.in | 2 +-
lib/activate/dev_manager.c | 4 ++++
lib/metadata/mirror.c | 2 +-
libdm/mm/pool-fast.c | 2 +-
man/vgcfgrestore.8.in | 10 +++++-----
.../lvm2_activation_generator_systemd_red_hat.c | 2 +-
9 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a061467..97e3ebf 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -77,14 +77,14 @@ Version 2.02.99 -
Fix missing cleanup of flags when the LV is detached from pool.
Fix check for some forbidden discards conversion of thin pools.
Add pool_is_active() to check for any pool related active LV.
- Report blank field if the LV doesn't have an origin instead of 0.
+ Report blank origin_size field if the LV doesn't have an origin instead of 0.
Do not take a free lv name argument for lvconvert --thinpool option.
- Avoid flushing thin pool when quering for transaction_id.
+ Avoid flushing thin pool when just requesting transaction_id.
Add internal function lv_layer() to obtain layer name for LV.
Report partial and in-sync RAID attribute based on kernel status
Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
- Set locales with LC_ALL instead of lower priority LANG variable.
- Fix a crash-inducing race condition in lvmetad.
+ Use LC_ALL to set locale in daemons and fsadm instead of lower priority LANG.
+ Avoid crash-inducing race in lvmetad when VG disappears during rename.
Add log/debug_classes to lvm.conf to control debug log messages.
Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies.
Fix autoactivation to not autoactivate VG/LV on each change of the PVs used.
@@ -135,7 +135,7 @@ Version 2.02.99 -
Remove dependency on fedora-storage-init.service in lvm2 systemd units.
Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.
Hardcode use_lvmetad=0 if cluster locking used and issue a warning msg.
- Avoid LVM from trying to read a mirror that has a failed device in its mirrored log.
+ Avoid trying to read a mirror that has a failed device in its mirrored log.
Relax ignore_suspended_devices to read from mirrors that don't have a device marked failed.
Change lvs heading Copy% to Cpy%Sync and print RAID4/5/6 sync% there too.
Fix clvmd support for option -d and properly use its argument.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 46ce9b0..c4bdcbf 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -14,7 +14,7 @@ Version 1.02.78 -
Add dm_config_write_{node_out/one_node_out} for enhanced config output.
Add dm_config_value_is_bool to check for boolean value in supported formats.
Fix config node lookup inside empty sections to not return the section itself.
- Extend support for status info of thin pool target.
+ Append discards and read-only fields to exported struct dm_status_thin_pool.
Fix segfault for truncated string token in config file after the first '"'.
Close open dmeventd FIFO file descriptors on exec (FD_CLOEXEC).
Fix resource leak in error path of dmeventd's umount of thin volume.
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 4710910..64e1683 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -37,7 +37,7 @@
#include <unistd.h>
#include <signal.h>
#include <arpa/inet.h> /* for htonl, ntohl */
-#include <fcntl.h>
+#include <fcntl.h> /* for musl libc */
#ifdef linux
/*
diff --git a/doc/example.conf.in b/doc/example.conf.in
index 94c32d5..1620721 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -93,7 +93,7 @@ devices {
# Use anchors if you want to be really specific
# filter = [ "a|^/dev/hda8$|", "r/.*/" ]
- # Since "filter" is often overriden from command line, it is not suitable
+ # Since "filter" is often overridden from command line, it is not suitable
# for system-wide device filtering (udev rules, lvmetad). To hide devices
# from LVM-specific udev processing and/or from lvmetad, you need to set
# global_filter. The syntax is the same as for normal "filter"
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index cd50fa0..9855bc9 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1059,6 +1059,8 @@ int dev_manager_raid_status(struct dev_manager *dm,
goto out;
}
+ /* FIXME Check there's only one target */
+
if (!dm_get_status_raid(dm->mem, params, status))
goto_out;
@@ -1213,6 +1215,8 @@ int dev_manager_thin_pool_status(struct dev_manager *dm,
dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms);
+ /* FIXME Check for thin and check there's exactly one target */
+
if (!dm_get_status_thin_pool(dm->mem, params, status))
goto_out;
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index f4f7b66..6c6554e 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -868,7 +868,7 @@ static int _remove_mirror_images(struct logical_volume *lv,
sub_lv = seg_lv(mirrored_seg, s);
if (!(is_temporary_mirror_layer(sub_lv) && lv_mirror_count(sub_lv) != 1)) {
if (!is_removable) {
- log_error(INTERNAL_ERROR "Test is_removable undefined.");
+ log_error(INTERNAL_ERROR "_remove_mirror_images called incorrectly with is_removable undefined.");
return 0;
}
if (!is_removable(sub_lv, removable_baton))
diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c
index 0e13416..2b494d6 100644
--- a/libdm/mm/pool-fast.c
+++ b/libdm/mm/pool-fast.c
@@ -18,7 +18,7 @@
#endif
#include "dmlib.h"
-#include <stddef.h>
+#include <stddef.h> /* For musl libc */
#include <malloc.h>
struct chunk {
diff --git a/man/vgcfgrestore.8.in b/man/vgcfgrestore.8.in
index a5c8194..ac84300 100644
--- a/man/vgcfgrestore.8.in
+++ b/man/vgcfgrestore.8.in
@@ -35,12 +35,12 @@ Specifies a metadata backup or archive file to be used for restoring
VolumeGroupName. Often this file has been created with \fBvgcfgbackup\fP.
.TP
.B \-\-force
-To restore metadata with thin pool volumes, user currently
-needs to use this flag. The tool DOES NOT perform any validation.
+Necessary to restore metadata with thin pool volumes.
.br
-WARNING: Restoring lvm2 metadata that does not exactly match the
-thin pool kernel metadata may lead to the destruction of the pool content.
-Use with extreme caution.
+\fBWARNING: Use with extreme caution.
+Most changes to thin metadata cannot be reverted.
+You may lose data if you restore metadata that does not match the thin pool
+kernel metadata precisely.\fP
.SH REPLACING PHYSICAL VOLUMES
\fBvgdisplay \-\-partial \-\-verbose\fP will show you the UUIDs and sizes of
any PVs that are no longer present.
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 6fc2865..f3a01a2 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -19,7 +19,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <limits.h> /* for PATH_MAX */
+#include <limits.h> /* For PATH_MAX for musl libc */
#include "lvm2app.h"
#define KMSG_DEV_PATH "/dev/kmsg"
10 years, 10 months