master - clmvd: fix responce status
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c9d8d22224f5516f364bd66ce41aa506a39801a6 Commit: c9d8d22224f5516f364bd66ce41aa506a39801a6 Parent: 764195207d4773cf6f1674a2fb16e9a0acda304a Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Apr 19 21:11:32 2013 +0200 Committer: Zdenek Kabelac <[email protected]> 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(-)
WHATS_NEW +1 -0
@@ -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.
daemons/clvmd/refresh_clvmd.c +6 -9
@@ -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; }
lib/locking/cluster_locking.c +4 -6
@@ -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 leint 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; }