Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c9d8d22224f5516f…
Commit: c9d8d22224f5516f364bd66ce41aa506a39801a6
Parent: 764195207d4773cf6f1674a2fb16e9a0acda304a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 19 21:11:32 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Apr 21 22:54:42 2013 +0200
clmvd: fix responce status
Failing status code is expected to be 0.
Also do not return '*response' as pointer which has been already free().
---
WHATS_NEW | 1 +
daemons/clvmd/refresh_clvmd.c | 15 ++++++---------
lib/locking/cluster_locking.c | 10 ++++------
3 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 76347e9..95b6e13 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix clvmd _cluster_request() return code in memory fail path.
Add writemostly/writebehind support for RAID1
Add lv_change_activate() for common activation code in vg/lvchange.
Revert change that allowed identical table reload for RAID.
diff --git a/daemons/clvmd/refresh_clvmd.c b/daemons/clvmd/refresh_clvmd.c
index 28b5625..42c3958 100644
--- a/daemons/clvmd/refresh_clvmd.c
+++ b/daemons/clvmd/refresh_clvmd.c
@@ -225,16 +225,14 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
* With an extra pair of INTs on the front to sanity
* check the pointer when we are given it back to free
*/
- *response = dm_malloc(sizeof(lvm_response_t) * num_responses +
- sizeof(int) * 2);
- if (!*response) {
+ *response = NULL;
+ if (!(rarray = dm_malloc(sizeof(lvm_response_t) * num_responses +
+ sizeof(int) * 2))) {
errno = ENOMEM;
status = 0;
goto out;
}
- rarray = *response;
-
/* Unpack the response into an lvm_response_t array */
inptr = head->args;
i = 0;
@@ -251,9 +249,9 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
int j;
for (j = 0; j < i; j++)
dm_free(rarray[i].response);
- free(*response);
+ dm_free(rarray);
errno = ENOMEM;
- status = -1;
+ status = 0;
goto out;
}
@@ -266,8 +264,7 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
*response = rarray;
out:
- if (retbuf)
- dm_free(retbuf);
+ dm_free(retbuf);
return status;
}
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c
index 01a47b0..3169f0d 100644
--- a/lib/locking/cluster_locking.c
+++ b/lib/locking/cluster_locking.c
@@ -241,15 +241,13 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
* With an extra pair of INTs on the front to sanity
* check the pointer when we are given it back to free
*/
- *response = dm_malloc(sizeof(lvm_response_t) * num_responses);
- if (!*response) {
+ *response = NULL;
+ if (!(rarray = dm_malloc(sizeof(lvm_response_t) * num_responses))) {
errno = ENOMEM;
status = 0;
goto out;
}
- rarray = *response;
-
/* Unpack the response into an lvm_response_t array */
inptr = head->args;
i = 0;
@@ -266,9 +264,9 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
int j;
for (j = 0; j < i; j++)
dm_free(rarray[i].response);
- free(*response);
+ dm_free(rarray);
errno = ENOMEM;
- status = -1;
+ status = 0;
goto out;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=764195207d4773cf…
Commit: 764195207d4773cf6f1674a2fb16e9a0acda304a
Parent: 2ccb9eb861c3b65ffc1aac024425e2cc10950077
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Apr 19 12:17:53 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Apr 19 12:43:36 2013 +0200
udev: also autoactivate on coldplug
Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 fixed autoactivation
to not trigger on each uevent for a PV that appeared in the system
most notably the events that are triggered artificially (udevadm
trigger or as the result of the WATCH udev rule being applied that
consequently generates CHANGE uevents). This fixed a situation in
which VGs/LVs were activated when they should not.
BUT we still need to care about the coldplug used at boot to
retrigger the ADD events - the "udevadm trigger --action=add"!
For non-DM-based PVs, this is already covered as for these we
run the autoactivation on ADD event only.
However, for DM-based PVs, we still need to run the
autoactivation even for the artificial ADD event, reusing
the udev DB content from previous proper CHANGE event that
came with the DM device activation.
Simply, this patch fixes a situation in which we run extra
"udevadm trigger --action=add" (or echo add > /sys/block/<dev>/uevent)
for DM-based PVs (cryptsetup devices, multipath devices, any
other DM devices...).
Without this patch, while using lvmetad + autoactivation,
any VG/LV that has a DM-based PV and for which we do not
call the activation directly, the VG/LV is not activated.
For example a VG with an LV with root FS on it which is directly
activated in initrd and then missing activation of the rest
of the LVs in the VG because of unhandled uevent retrigger on
boot after switching to root FS (the "coldplug").
(No WHATS_NEW here as this fixes the commit mentioned
above and which was not released yet.)
---
udev/10-dm.rules.in | 5 ++++-
udev/69-dm-lvm-metad.rules.in | 1 +
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index cfee145..512d156 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -77,7 +77,10 @@ LABEL="dm_flags_done"
# before (e.g. in initrd). If udev is used in initrd, we require the udev init
# script to not remove the existing udev database so we can reuse the information
# stored at the time of device activation in the initrd.
-ACTION=="add", ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
+ACTION!="add", GOTO="dm_no_coldplug"
+ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
+ENV{DM_ACTIVATION}="1"
+LABEL="dm_no_coldplug"
# "dm" sysfs subdirectory is available in newer versions of DM
# only (kernels >= 2.6.29). We have to check for its existence
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index b16a27a..66c58b3 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -26,6 +26,7 @@ ACTION=="remove", GOTO="lvm_scan"
KERNEL!="dm-[0-9]*", ACTION!="add", GOTO="lvm_end"
# If the PV is a dm device, scan only after proper mapping activation (CHANGE event + DM_ACTIVATION=1)
+# or after a coldplug (event retrigger) with "add" event (ADD event + DM_ACTIVATION=1)
KERNEL=="dm-[0-9]*", ENV{DM_ACTIVATION}!="1", GOTO="lvm_end"
LABEL="lvm_scan"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2ccb9eb861c3b65f…
Commit: 2ccb9eb861c3b65ffc1aac024425e2cc10950077
Parent: 2e0740f7ef420c7b981bc67cb606d180701b8c1d
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Apr 16 10:42:03 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 16 10:45:37 2013 +0200
config_def_check: fix memory leak
There is no need to strdup a key when inserting into
the hash table as the table allocates memory and copies
the string. This was causing memory to be lost.
---
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 009eb5f..2c77f30 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -577,7 +577,7 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_
cmd->cft_def_hash = NULL;
r = 0; goto out;
}
- dm_hash_insert(cmd->cft_def_hash, dm_strdup(vp), def);
+ dm_hash_insert(cmd->cft_def_hash, vp, def);
}
}