1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

clmvd: fix responce status

Failing status code is expected to be 0.
Also do not return '*response' as pointer which has been already free().
This commit is contained in:
Zdenek Kabelac 2013-04-19 21:11:32 +02:00
parent 764195207d
commit c9d8d22224
3 changed files with 11 additions and 15 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}