1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +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 - Version 2.02.99 -
=================================== ===================================
Fix clvmd _cluster_request() return code in memory fail path.
Add writemostly/writebehind support for RAID1 Add writemostly/writebehind support for RAID1
Add lv_change_activate() for common activation code in vg/lvchange. Add lv_change_activate() for common activation code in vg/lvchange.
Revert change that allowed identical table reload for RAID. 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 * With an extra pair of INTs on the front to sanity
* check the pointer when we are given it back to free * check the pointer when we are given it back to free
*/ */
*response = dm_malloc(sizeof(lvm_response_t) * num_responses + *response = NULL;
sizeof(int) * 2); if (!(rarray = dm_malloc(sizeof(lvm_response_t) * num_responses +
if (!*response) { sizeof(int) * 2))) {
errno = ENOMEM; errno = ENOMEM;
status = 0; status = 0;
goto out; goto out;
} }
rarray = *response;
/* Unpack the response into an lvm_response_t array */ /* Unpack the response into an lvm_response_t array */
inptr = head->args; inptr = head->args;
i = 0; i = 0;
@ -251,9 +249,9 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
int j; int j;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
dm_free(rarray[i].response); dm_free(rarray[i].response);
free(*response); dm_free(rarray);
errno = ENOMEM; errno = ENOMEM;
status = -1; status = 0;
goto out; goto out;
} }
@ -266,7 +264,6 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
*response = rarray; *response = rarray;
out: out:
if (retbuf)
dm_free(retbuf); dm_free(retbuf);
return status; 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 * With an extra pair of INTs on the front to sanity
* check the pointer when we are given it back to free * check the pointer when we are given it back to free
*/ */
*response = dm_malloc(sizeof(lvm_response_t) * num_responses); *response = NULL;
if (!*response) { if (!(rarray = dm_malloc(sizeof(lvm_response_t) * num_responses))) {
errno = ENOMEM; errno = ENOMEM;
status = 0; status = 0;
goto out; goto out;
} }
rarray = *response;
/* Unpack the response into an lvm_response_t array */ /* Unpack the response into an lvm_response_t array */
inptr = head->args; inptr = head->args;
i = 0; i = 0;
@ -266,9 +264,9 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
int j; int j;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
dm_free(rarray[i].response); dm_free(rarray[i].response);
free(*response); dm_free(rarray);
errno = ENOMEM; errno = ENOMEM;
status = -1; status = 0;
goto out; goto out;
} }