From: mornfall@sourceware.org <mornfall@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/cache lvmetad.c
Date: 26 Feb 2012 08:49:40 -0000 [thread overview]
Message-ID: <20120226084940.13917.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at 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);
next reply other threads:[~2012-02-26 8:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-26 8:49 mornfall [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-03-14 17:15 LVM2/lib/cache lvmetad.c 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-28 11:09 zkabelac
2012-02-27 11:32 zkabelac
2012-02-26 13:42 mornfall
2012-02-23 19:03 zkabelac
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=20120226084940.13917.qmail@sourceware.org \
--to=mornfall@sourceware.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.