public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/cache lvmetad.c
@ 2012-02-28 11:09 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2012-02-28 11:09 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-28 11:09:06
Modified files:
lib/cache : lvmetad.c
Log message:
Check result of export_vg_to_buffer
and avoid usage of failed buffer.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8
--- LVM2/lib/cache/lvmetad.c 2012/02/27 11:32:48 1.7
+++ LVM2/lib/cache/lvmetad.c 2012/02/28 11:09:06 1.8
@@ -518,7 +518,11 @@
* formatted and has no conflicting keys with the rest of the
* request.
*/
- export_vg_to_buffer(vg, &buf);
+ if (!export_vg_to_buffer(vg, &buf)) {
+ dm_free(pvmeta);
+ return_0;
+ }
+
reply = daemon_send_simple(_lvmetad,
"pv_found",
"pvmeta = %b", pvmeta,
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-03-14 17:15 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2012-03-14 17:15 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-14 17:15:22
Modified files:
lib/cache : lvmetad.c
Log message:
Just move declaration
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
--- LVM2/lib/cache/lvmetad.c 2012/03/03 18:32:54 1.18
+++ LVM2/lib/cache/lvmetad.c 2012/03/14 17:15:22 1.19
@@ -609,13 +609,14 @@
int lvmetad_pv_gone(dev_t device, const char *pv_name)
{
+ daemon_reply reply;
int result;
int found;
if (!_using_lvmetad)
return 1;
- daemon_reply reply = daemon_send_simple(_lvmetad, "pv_gone", "device = %d", device, NULL);
+ reply = daemon_send_simple(_lvmetad, "pv_gone", "device = %d", device, NULL);
result = _lvmetad_handle_reply(reply, "drop PV", pv_name, &found);
/* We don't care whether or not the daemon had the PV cached. */
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-03-02 22:44 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2012-03-02 22:44 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2012-03-02 22:44:32
Modified files:
lib/cache : lvmetad.c
Log message:
a fixme
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
--- LVM2/lib/cache/lvmetad.c 2012/03/02 21:24:37 1.16
+++ LVM2/lib/cache/lvmetad.c 2012/03/02 22:44:31 1.17
@@ -654,6 +654,7 @@
struct _pvscan_lvmetad_baton *b = baton;
struct volume_group *this = mda->ops->vg_read(b->fid, "", mda, 1);
+ /* FIXME Also ensure contents match etc. */
if (!b->vg || this->seqno > b->vg->seqno)
b->vg = this;
else if (b->vg)
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-03-02 21:24 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2012-03-02 21:24 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2012-03-02 21:24:38
Modified files:
lib/cache : lvmetad.c
Log message:
missing reply frees
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
--- LVM2/lib/cache/lvmetad.c 2012/03/02 20:46:37 1.15
+++ LVM2/lib/cache/lvmetad.c 2012/03/02 21:24:37 1.16
@@ -208,7 +208,7 @@
log_error(INTERNAL_ERROR
"We do not know the format (%s) reported by lvmetad.",
fmt_name);
- return NULL;
+ goto out;
}
fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
@@ -216,7 +216,7 @@
fic.context.vg_ref.vg_id = vgid;
if (!(fid = fmt->ops->create_instance(fmt, &fic)))
- return_NULL;
+ goto_out;
if ((pvcn = dm_config_find_node(top, "metadata/physical_volumes")))
for (pvcn = pvcn->child; pvcn; pvcn = pvcn->sib)
@@ -224,21 +224,25 @@
top->key = name;
if (!(vg = import_vg_from_config_tree(reply.cft, fid)))
- return_NULL;
+ goto_out;
dm_list_iterate_items(pvl, &vg->pvs) {
if ((info = lvmcache_info_from_pvid((const char *)&pvl->pv->id, 0))) {
pvl->pv->label_sector = lvmcache_get_label(info)->sector;
pvl->pv->dev = lvmcache_device(info);
- if (!lvmcache_fid_add_mdas_pv(info, fid))
- return_NULL; /* FIXME error path */
+ if (!lvmcache_fid_add_mdas_pv(info, fid)) {
+ vg = NULL;
+ goto_out; /* FIXME error path */
+ }
} /* else probably missing */
}
lvmcache_update_vg(vg, 0);
}
+out:
daemon_reply_destroy(reply);
+
return vg;
}
@@ -285,8 +289,7 @@
}
reply = daemon_send_simple(_lvmetad, "vg_update", "vgname = %s", vg->name,
- "metadata = %b", strchr(buf, '{'),
- NULL);
+ "metadata = %b", strchr(buf, '{'), NULL);
dm_free(buf);
if (!_lvmetad_handle_reply(reply, "update VG", vg->name, NULL)) {
@@ -294,6 +297,8 @@
return 0;
}
+ daemon_reply_destroy(reply);
+
n = (vg->fid && vg->fid->metadata_areas_index) ?
dm_hash_get_first(vg->fid->metadata_areas_index) : NULL;
while (n) {
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-03-01 20:04 mornfall
0 siblings, 0 replies; 10+ messages in thread
From: mornfall @ 2012-03-01 20:04 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-03-01 20:04:44
Modified files:
lib/cache : lvmetad.c
Log message:
Use 64 bit integers for device size & label sector in _pv_populate_lvmcache in
lvmetad client code. Fixes RHBZ 798267.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/lib/cache/lvmetad.c 2012/02/29 02:35:35 1.10
+++ LVM2/lib/cache/lvmetad.c 2012/03/01 20:04:44 1.11
@@ -85,8 +85,8 @@
*vgname = dm_config_find_str(cn->child, "vgname", NULL),
*fmt_name = dm_config_find_str(cn->child, "format", NULL);
dev_t devt = dm_config_find_int(cn->child, "device", 0);
- uint64_t devsize = dm_config_find_int(cn->child, "dev_size", 0),
- label_sector = dm_config_find_int(cn->child, "label_sector", 0);
+ uint64_t devsize = dm_config_find_int64(cn->child, "dev_size", 0),
+ label_sector = dm_config_find_int64(cn->child, "label_sector", 0);
struct format_type *fmt = fmt_name ? get_format_by_name(cmd, fmt_name) : NULL;
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-02-28 18:23 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2012-02-28 18:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2012-02-28 18:23:56
Modified files:
lib/cache : lvmetad.c
Log message:
Invert some return codes (which used to get ignored anyway) in cases when
lvmetad is not being used.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
--- LVM2/lib/cache/lvmetad.c 2012/02/28 11:09:06 1.8
+++ LVM2/lib/cache/lvmetad.c 2012/02/28 18:23:56 1.9
@@ -1,3 +1,17 @@
+/*
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "lib.h"
#include "toolcontext.h"
#include "metadata.h"
@@ -360,7 +374,7 @@
struct dm_config_node *cn;
if (!_using_lvmetad)
- return_0;
+ return 1;
reply = daemon_send_simple(_lvmetad, "pv_list", NULL);
@@ -388,7 +402,7 @@
struct dm_config_node *cn;
if (!_using_lvmetad)
- return_0;
+ return 1;
reply = daemon_send_simple(_lvmetad, "vg_list", NULL);
if (reply.error || strcmp(daemon_reply_str(reply, "response", ""), "OK")) {
@@ -678,4 +692,3 @@
"It is strongly recommended that you restart lvmetad immediately.");
return 0;
}
-
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-02-27 11:32 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2012-02-27 11:32 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-27 11:32:48
Modified files:
lib/cache : lvmetad.c
Log message:
Check id_write_format result
Currently we never fail with 64byte uuid buffer,
but just stay consitent with rest of the code and check for result.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
--- LVM2/lib/cache/lvmetad.c 2012/02/26 13:42:50 1.6
+++ LVM2/lib/cache/lvmetad.c 2012/02/27 11:32:48 1.7
@@ -153,7 +153,8 @@
return NULL;
if (vgid) {
- id_write_format((const struct id*)vgid, uuid, 64);
+ if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
+ return_0;
reply = daemon_send_simple(_lvmetad, "vg_lookup", "uuid = %s", uuid, NULL);
} else {
if (!vgname)
@@ -293,7 +294,9 @@
if (!_using_lvmetad)
return 1; /* just fake it */
- id_write_format(&vg->id, uuid, 64);
+ if (!id_write_format(&vg->id, uuid, sizeof(uuid)))
+ return_0;
+
reply = daemon_send_simple(_lvmetad, "vg_remove", "uuid = %s", uuid, NULL);
return _lvmetad_handle_reply(reply, "remove VG", vg->name);
@@ -309,7 +312,8 @@
if (!_using_lvmetad)
return_0;
- id_write_format(&pvid, uuid, 64);
+ if (!id_write_format(&pvid, uuid, sizeof(uuid)))
+ return_0;
reply = daemon_send_simple(_lvmetad, "pv_lookup", "uuid = %s", uuid, NULL);
@@ -482,7 +486,8 @@
if (!_using_lvmetad)
return 1;
- id_write_format(&pvid, uuid, 64);
+ if (!id_write_format(&pvid, uuid, sizeof(uuid)))
+ return_0;
/* FIXME A more direct route would be much preferable. */
if ((info = lvmcache_info_from_pvid((const char *)&pvid, 0)))
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-02-26 13:42 mornfall
0 siblings, 0 replies; 10+ messages in thread
From: mornfall @ 2012-02-26 13:42 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-02-26 13:42:50
Modified files:
lib/cache : lvmetad.c
Log message:
Fix a possible SEGV in lvmetad client code, and a minor leak in pvscan
--lvmetad.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6
--- LVM2/lib/cache/lvmetad.c 2012/02/26 08:49:40 1.5
+++ LVM2/lib/cache/lvmetad.c 2012/02/26 13:42:50 1.6
@@ -566,9 +566,10 @@
{
struct _pvscan_lvmetad_baton *b = baton;
struct volume_group *this = mda->ops->vg_read(b->fid, "", mda);
- if ((this && !b->vg) || this->seqno > b->vg->seqno)
+ if (!b->vg || this->seqno > b->vg->seqno)
b->vg = this;
- else release_vg(this);
+ else if (b->vg)
+ release_vg(this);
return 1;
}
@@ -647,6 +648,8 @@
&fic);
lvmcache_foreach_mda(info, _pvscan_lvmetad_single, &baton);
+ if (!baton.vg)
+ lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
/*
* NB. If this command failed and we are relying on lvmetad to have an
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-02-26 8:49 mornfall
0 siblings, 0 replies; 10+ messages in thread
From: mornfall @ 2012-02-26 8:49 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-02-26 08:49:40
Modified files:
lib/cache : lvmetad.c
Log message:
- Improve error reporting on lvmetad connection failure.
- Fix a couple of memory leaks in the lvmetad client code.
- Avoid an error in lvmetad_pv_gone when we aren't using lvmetad.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5
--- LVM2/lib/cache/lvmetad.c 2012/02/23 22:24:47 1.4
+++ LVM2/lib/cache/lvmetad.c 2012/02/26 08:49:40 1.5
@@ -16,8 +16,8 @@
const char *socket = getenv("LVM_LVMETAD_SOCKET");
if (_using_lvmetad) { /* configured by the toolcontext */
_lvmetad = lvmetad_open(socket ?: DEFAULT_RUN_DIR "/lvmetad.socket");
- if (_lvmetad.socket_fd < 0) {
- log_warn("Failed to connect to lvmetad. Falling back to scanning.");
+ if (_lvmetad.socket_fd < 0 || _lvmetad.error) {
+ log_warn("Failed to connect to lvmetad: %s. Falling back to scanning.", strerror(_lvmetad.error));
_using_lvmetad = 0;
}
}
@@ -251,6 +251,7 @@
reply = daemon_send_simple(_lvmetad, "vg_update", "vgname = %s", vg->name,
"metadata = %b", strchr(buf, '{'),
NULL);
+ dm_free(buf);
if (!_lvmetad_handle_reply(reply, "update VG", vg->name))
return 0;
@@ -496,8 +497,12 @@
" %s"
"}", device->dev,
info ? lvmcache_device_size(info) : 0,
- fmt->name, label_sector, uuid, mdas ?: ""))
+ fmt->name, label_sector, uuid, mdas ?: "")) {
+ dm_free((char *)mdas);
return_0;
+ }
+
+ dm_free((char *)mdas);
if (vg) {
/*
@@ -529,6 +534,9 @@
int lvmetad_pv_gone(dev_t device)
{
+ if (!_using_lvmetad)
+ return 1;
+
daemon_reply reply =
daemon_send_simple(_lvmetad, "pv_gone", "device = %d", device, NULL);
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2/lib/cache lvmetad.c
@ 2012-02-23 19:03 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2012-02-23 19:03 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-23 19:03:48
Modified files:
lib/cache : lvmetad.c
Log message:
Fix regression from cleanup commit
baton is being modified, so needs to be cleared before each use.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
--- LVM2/lib/cache/lvmetad.c 2012/02/23 17:59:32 1.2
+++ LVM2/lib/cache/lvmetad.c 2012/02/23 19:03:48 1.3
@@ -229,7 +229,7 @@
char mda_id[128], *num;
struct pv_list *pvl;
struct lvmcache_info *info;
- struct _fixup_baton baton = { .i = 0 };
+ struct _fixup_baton baton;
if (!vg)
return 0;
@@ -264,6 +264,7 @@
*num = 0;
++num;
if ((info = lvmcache_info_from_pvid(mda_id, 0))) {
+ memset(&baton, 0, sizeof(baton));
baton.find = atoi(num);
baton.ignore = mda_is_ignored(mda);
lvmcache_foreach_mda(info, _fixup_ignored, &baton);
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-03-14 17:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28 11:09 LVM2/lib/cache lvmetad.c zkabelac
-- strict thread matches above, loose matches on Subject: below --
2012-03-14 17:15 zkabelac
2012-03-02 22:44 agk
2012-03-02 21:24 agk
2012-03-01 20:04 mornfall
2012-02-28 18:23 agk
2012-02-27 11:32 zkabelac
2012-02-26 13:42 mornfall
2012-02-26 8:49 mornfall
2012-02-23 19:03 zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).