From: Petr Rockai <mornfall@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - lvmetad: Give inconsistent metadata warnings in pvscan --cache.
Date: Wed, 26 Sep 2012 17:56:03 +0000 (UTC) [thread overview]
Message-ID: <20120926175603.9939BA33AB@fedorahosted.org> (raw)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1ff2245c23247a1d3f9a03be66d3d186c824f03f
Commit: 1ff2245c23247a1d3f9a03be66d3d186c824f03f
Parent: c731bb1ee13565763cc1ac77ed1a01ccea0337ac
Author: Petr Rockai <prockai@redhat.com>
AuthorDate: Wed Sep 19 23:45:51 2012 +0200
Committer: Petr Rockai <prockai@redhat.com>
CommitterDate: Wed Sep 26 17:26:23 2012 +0200
lvmetad: Give inconsistent metadata warnings in pvscan --cache.
---
daemons/lvmetad/lvmetad-core.c | 21 ++++++++++++++++-----
lib/cache/lvmetad.c | 5 +++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index c6cc3d9..f796e33 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -636,7 +636,7 @@ static int vg_remove_if_missing(lvmetad_state *s, const char *vgid)
* this function, so they can be safely destroyed after update_metadata returns
* (anything that might have been retained is copied). */
static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid,
- struct dm_config_node *metadata)
+ struct dm_config_node *metadata, int64_t *oldseq)
{
struct dm_config_tree *cft;
struct dm_config_tree *old;
@@ -665,6 +665,13 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
filter_metadata(metadata); /* sanitize */
+ if (oldseq) {
+ if (old)
+ *oldseq = haveseq;
+ else
+ *oldseq = seq;
+ }
+
if (seq == haveseq) {
retval = 1;
if (compare_config(metadata, old->root))
@@ -786,6 +793,7 @@ static response pv_found(lvmetad_state *s, request r)
const char *old;
const char *pvid_dup;
int complete = 0, orphan = 0;
+ int64_t seqno = -1, seqno_old = -1;
if (!pvid)
return reply_fail("need PV UUID");
@@ -830,7 +838,7 @@ static response pv_found(lvmetad_state *s, request r)
if (daemon_request_int(r, "metadata/seqno", -1) < 0)
return reply_fail("need VG seqno");
- if (!update_metadata(s, vgname, vgid, metadata))
+ if (!update_metadata(s, vgname, vgid, metadata, &seqno_old))
return reply_fail("metadata update failed");
} else {
lock_pvid_to_vgid(s);
@@ -839,9 +847,10 @@ static response pv_found(lvmetad_state *s, request r)
}
if (vgid) {
- if ((cft = lock_vg(s, vgid)))
+ if ((cft = lock_vg(s, vgid))) {
complete = update_pv_status(s, cft, cft->root, 0);
- else if (!strcmp(vgid, "#orphan"))
+ seqno = dm_config_find_int(cft->root, "metadata/seqno", -1);
+ } else if (!strcmp(vgid, "#orphan"))
orphan = 1;
else {
unlock_vg(s, vgid);
@@ -854,6 +863,8 @@ static response pv_found(lvmetad_state *s, request r)
"status = %s", orphan ? "orphan" :
(complete ? "complete" : "partial"),
"vgid = %s", vgid ? vgid : "#orphan",
+ "seqno_before = %"PRId64, seqno_old,
+ "seqno_after = %"PRId64, seqno,
NULL);
}
@@ -872,7 +883,7 @@ static response vg_update(lvmetad_state *s, request r)
/* TODO defer metadata update here; add a separate vg_commit
* call; if client does not commit, die */
- if (!update_metadata(s, vgname, vgid, metadata))
+ if (!update_metadata(s, vgname, vgid, metadata, NULL))
return reply_fail("metadata update failed");
}
return daemon_reply_simple("OK", NULL);
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 8ac5732..24a6b16 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -720,6 +720,11 @@ int lvmetad_pv_found(struct id pvid, struct device *device, const struct format_
result = _lvmetad_handle_reply(reply, "update PV", uuid, NULL);
+ if (vg && result &&
+ (daemon_reply_int(reply, "seqno_after", -1) != vg->seqno ||
+ daemon_reply_int(reply, "seqno_after", -1) != daemon_reply_int(reply, "seqno_before", -1)))
+ log_warn("WARNING: Inconsistent metadata found for VG %s", vg->name);
+
if (result && handler) {
status = daemon_reply_str(reply, "status", "<missing>");
if (!strcmp(status, "partial"))
reply other threads:[~2012-09-26 17:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120926175603.9939BA33AB@fedorahosted.org \
--to=mornfall@fedoraproject.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.