Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
March 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
5 participants
251 discussions
Start a n
N
ew thread
master - cleanup: clvmd update log_error
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8cd435cd83140e2…
Commit: f8cd435cd83140e26d35e17f6fbccc1019f67aed Parent: 4c97ea2ce55134735896967e719db955c9e74161 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 09:21:34 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:26 2014 +0100 cleanup: clvmd update log_error Drop \n from log_error() and add '.' --- daemons/clvmd/clvmd.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 9af528c..bc831d0 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -567,7 +567,7 @@ int main(int argc, char *argv[]) if (!clops) { DEBUGLOG("Can't initialise cluster interface\n"); - log_error("Can't initialise cluster interface\n"); + log_error("Can't initialise cluster interface."); child_init_signal_and_exit(DFAIL_CLUSTER_IF); /* NOTREACHED */ } @@ -1077,7 +1077,7 @@ static int verify_message(char *buf, int len) struct clvm_header *h = (struct clvm_header *)buf; if (len < (int)sizeof(struct clvm_header)) { - log_error("verify_message short len %d", len); + log_error("verify_message short len %d.", len); return -1; } @@ -1099,19 +1099,19 @@ static int verify_message(char *buf, int len) case CLVMD_CMD_SYNC_NAMES: break; default: - log_error("verify_message bad cmd %x", h->cmd); + log_error("verify_message bad cmd %x.", h->cmd); return -1; } /* TODO: we may be able to narrow len/flags/clientid/arglen checks based on cmd */ if (h->flags & ~(CLVMD_FLAG_LOCAL | CLVMD_FLAG_SYSTEMLV | CLVMD_FLAG_NODEERRS | CLVMD_FLAG_REMOTE)) { - log_error("verify_message bad flags %x", h->flags); + log_error("verify_message bad flags %x.", h->flags); return -1; } if (h->arglen > max_cluster_message) { - log_error("verify_message bad arglen %x max %d", h->arglen, max_cluster_message); + log_error("verify_message bad arglen %x max %d.", h->arglen, max_cluster_message); return -1; } @@ -1565,7 +1565,7 @@ static void process_remote_command(struct clvm_header *msg, int msglen, int fd, if (msg->cmd == CLVMD_CMD_GOAWAY) { DEBUGLOG("Told to go away by %s\n", nodename); - log_error("Told to go away by %s\n", nodename); + log_error("Told to go away by %s.", nodename); exit(99); } @@ -1745,7 +1745,7 @@ static __attribute__ ((noreturn)) void *pre_and_post_thread(void *arg) /* Tell the parent process we have finished this bit */ while ((write_status = write(pipe_fd, &status, sizeof(int))) != sizeof(int)) if (write_status >=0 || (errno != EINTR && errno != EAGAIN)) { - log_error("Error sending to pipe: %m\n"); + log_error("Error sending to pipe: %m"); break; } @@ -1771,7 +1771,7 @@ static __attribute__ ((noreturn)) void *pre_and_post_thread(void *arg) while ((write_status = write(pipe_fd, &status, sizeof(int))) != sizeof(int)) if (write_status >=0 || (errno != EINTR && errno != EAGAIN)) { - log_error("Error sending to pipe: %m\n"); + log_error("Error sending to pipe: %m"); break; } next_pre: @@ -1835,7 +1835,7 @@ static int process_reply(const struct clvm_header *msg, int msglen, const char * if (!(client = find_client(msg->clientid))) { DEBUGLOG("Got message for unknown client 0x%x\n", msg->clientid); - log_error("Got message for unknown client 0x%x\n", + log_error("Got message for unknown client 0x%x.", msg->clientid); return -1; } @@ -2105,7 +2105,7 @@ static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg, if (msglen) { if (!(cmd->msg = dm_malloc(msglen))) { - log_error("Unable to allocate buffer space\n"); + log_error("Unable to allocate buffer space."); dm_free(cmd); return -1; } @@ -2238,7 +2238,7 @@ void process_message(struct local_client *client, char *buf, int len, if (rv < 0) { memset(nodename, 0, sizeof(nodename)); clops->name_from_csid(csid, nodename); - log_error("process_message from %s len %d bad verify", nodename, len); + log_error("process_message from %s len %d bad verify.", nodename, len); dump_message(buf, len); return; }
1
0
0
0
master - cleanup: clvmd drop goto
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4c97ea2ce5513473…
Commit: 4c97ea2ce55134735896967e719db955c9e74161 Parent: 7d49c33ffc41d58bd17ab032df23ca1a08f017b9 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 09:18:10 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:25 2014 +0100 cleanup: clvmd drop goto --- daemons/clvmd/clvmd.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 05e5670..9af528c 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -1167,7 +1167,7 @@ static int cleanup_zombie(struct local_client *thisfd) if (thisfd->bits.localsock.in_progress) { pthread_kill(thisfd->bits.localsock.threadid, SIGUSR2); if (pthread_mutex_trylock(&thisfd->bits.localsock.mutex)) - goto bail; + return 1; thisfd->bits.localsock.state = POST_COMMAND; pthread_cond_signal(&thisfd->bits.localsock.cond); pthread_mutex_unlock(&thisfd->bits.localsock.mutex); @@ -1228,8 +1228,6 @@ static int cleanup_zombie(struct local_client *thisfd) safe_close(&(thisfd->fd)); thisfd->bits.localsock.cleanup_needed = 0; return 0; -bail: - return 1; } /* Called when we have a read from the local socket.
1
0
0
0
master - cleanup: clvmd skip reset of null pointer
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7d49c33ffc41d58b…
Commit: 7d49c33ffc41d58bd17ab032df23ca1a08f017b9 Parent: bf19c6be2c57c43ebc6c7ceb85fd7487c7e36799 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Wed Mar 19 23:37:47 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:25 2014 +0100 cleanup: clvmd skip reset of null pointer --- daemons/clvmd/lvm-functions.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index fb3a95c..e523522 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -917,6 +917,6 @@ void destroy_lvm(void) if (cmd) { memlock_dec_daemon(cmd); destroy_toolcontext(cmd); + cmd = NULL; } - cmd = NULL; }
1
0
0
0
master - cleanup: clvmd move destroy_lvhash into main
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf19c6be2c57c43e…
Commit: bf19c6be2c57c43ebc6c7ceb85fd7487c7e36799 Parent: 1ee8688de097968655d98f0f7f266945a92f20a8 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 14:06:16 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:25 2014 +0100 cleanup: clvmd move destroy_lvhash into main Keep destruction code path consistent and simple and destroy lvhash in the place it's been created. Also issue debug message from a single place. --- daemons/clvmd/clvmd-cman.c | 1 - daemons/clvmd/clvmd-corosync.c | 3 --- daemons/clvmd/clvmd-openais.c | 3 --- daemons/clvmd/clvmd-singlenode.c | 2 -- daemons/clvmd/clvmd.c | 2 ++ 5 files changed, 2 insertions(+), 9 deletions(-) diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c index 7e76dc4..e41d0cf 100644 --- a/daemons/clvmd/clvmd-cman.c +++ b/daemons/clvmd/clvmd-cman.c @@ -245,7 +245,6 @@ static void _add_up_node(const char *csid) static void _cluster_closedown() { - destroy_lvhash(); dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1); cman_finish(c_handle); } diff --git a/daemons/clvmd/clvmd-corosync.c b/daemons/clvmd/clvmd-corosync.c index e68cb73..be51b61 100644 --- a/daemons/clvmd/clvmd-corosync.c +++ b/daemons/clvmd/clvmd-corosync.c @@ -345,9 +345,6 @@ static int _init_cluster(void) static void _cluster_closedown(void) { - DEBUGLOG("cluster_closedown\n"); - destroy_lvhash(); - dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1); cpg_finalize(cpg_handle); quorum_finalize(quorum_handle); diff --git a/daemons/clvmd/clvmd-openais.c b/daemons/clvmd/clvmd-openais.c index 77c0482..c91a238 100644 --- a/daemons/clvmd/clvmd-openais.c +++ b/daemons/clvmd/clvmd-openais.c @@ -365,9 +365,6 @@ static int _init_cluster(void) static void _cluster_closedown(void) { - DEBUGLOG("cluster_closedown\n"); - destroy_lvhash(); - saLckFinalize(lck_handle); cpg_finalize(cpg_handle); } diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c index a3a1960..e65ab28 100644 --- a/daemons/clvmd/clvmd-singlenode.c +++ b/daemons/clvmd/clvmd-singlenode.c @@ -121,8 +121,6 @@ static void _cluster_closedown(void) { close_comms(); - DEBUGLOG("cluster_closedown\n"); - destroy_lvhash(); /* If there is any awaited resource, kill it softly */ pthread_mutex_lock(&_lock_mutex); dm_hash_destroy(_locks); diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index dd3548f..05e5670 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -636,6 +636,8 @@ int main(int argc, char *argv[]) dm_free(delfd); } + DEBUGLOG("cluster_closedown\n"); + destroy_lvhash(); clops->cluster_closedown(); ret = 0;
1
0
0
0
master - cleanup: memlock line indent
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1ee8688de0979686…
Commit: 1ee8688de097968655d98f0f7f266945a92f20a8 Parent: 46ae028cd34597cfd54048edd99cb0f27ac542eb Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 13:44:03 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:25 2014 +0100 cleanup: memlock line indent --- lib/mm/memlock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index a83c3ed..70af07e 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -445,7 +445,7 @@ void memlock_inc_daemon(struct cmd_context *cmd) { ++_memlock_count_daemon; if (_memlock_count_daemon == 1 && _critical_section > 0) - log_error(INTERNAL_ERROR "_memlock_inc_daemon used in critical section."); + log_error(INTERNAL_ERROR "_memlock_inc_daemon used in critical section."); log_debug_mem("memlock_count_daemon inc to %d", _memlock_count_daemon); _lock_mem_if_needed(cmd); }
1
0
0
0
master - singlenode: reset pointer when hash is destroyed
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=46ae028cd34597cf…
Commit: 46ae028cd34597cfd54048edd99cb0f27ac542eb Parent: 7041c8bf51844c314fd4ed3b5f20779959524320 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Wed Mar 19 23:34:11 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:25 2014 +0100 singlenode: reset pointer when hash is destroyed Just keep pointer consistent. --- daemons/clvmd/clvmd-singlenode.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c index cad9acb..a3a1960 100644 --- a/daemons/clvmd/clvmd-singlenode.c +++ b/daemons/clvmd/clvmd-singlenode.c @@ -109,6 +109,7 @@ static int _init_cluster(void) r = init_comms(); if (r) { dm_hash_destroy(_locks); + _locks = NULL; return r; }
1
0
0
0
master - clvmd: drop dead code
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7041c8bf51844c31…
Commit: 7041c8bf51844c314fd4ed3b5f20779959524320 Parent: 73978f8d7dd638806f514a7914884a204afd95c1 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Mar 21 16:50:45 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:24 2014 +0100 clvmd: drop dead code Since pipe_client has been already reset to NULL, remove this dead code. --- daemons/clvmd/clvmd.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 572c5b7..dd3548f 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -1223,11 +1223,6 @@ static int cleanup_zombie(struct local_client *thisfd) /* Free the command buffer */ dm_free(thisfd->bits.localsock.cmd); - /* Clear out the cross-link */ - if (thisfd->bits.localsock.pipe_client != NULL) - thisfd->bits.localsock.pipe_client->bits.pipe.client = - NULL; - safe_close(&(thisfd->fd)); thisfd->bits.localsock.cleanup_needed = 0; return 0;
1
0
0
0
master - clvmd: drop unused local_sock parameter
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=73978f8d7dd63880…
Commit: 73978f8d7dd638806f514a7914884a204afd95c1 Parent: 37396e2fe5c451c466f93f852a3559da023fc98c Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Mar 21 11:34:25 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:24 2014 +0100 clvmd: drop unused local_sock parameter --- daemons/clvmd/clvmd.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index c3268a7..572c5b7 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -132,7 +132,7 @@ static int open_local_sock(void); static void close_local_sock(int local_socket); static int check_local_clvmd(void); static struct local_client *find_client(int clientid); -static void main_loop(int local_sock, int cmd_timeout); +static void main_loop(int cmd_timeout); static void be_daemon(int start_timeout); static int check_all_clvmds_running(struct local_client *client); static int local_rendezvous_callback(struct local_client *thisfd, char *buf, @@ -615,7 +615,7 @@ int main(int argc, char *argv[]) signal(SIGINT, sigterm_handler); /* Do some work */ - main_loop(local_sock, cmd_timeout); + main_loop(cmd_timeout); pthread_mutex_lock(&lvm_thread_mutex); lvm_thread_exit = 1; @@ -820,7 +820,7 @@ static void request_timed_out(struct local_client *client) } /* This is where the real work happens */ -static void main_loop(int local_sock, int cmd_timeout) +static void main_loop(int cmd_timeout) { sigset_t ss;
1
0
0
0
master - clvmd: update add_reply_to_list
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=37396e2fe5c451c4…
Commit: 37396e2fe5c451c466f93f852a3559da023fc98c Parent: 28479946249611f7f103c1caa33033a92ea0ce49 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 14:29:42 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:24 2014 +0100 clvmd: update add_reply_to_list Take mutex lock after the allocation just before the structure is merged into reply list. --- daemons/clvmd/clvmd.c | 39 ++++++++++++++++++--------------------- 1 files changed, 18 insertions(+), 21 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index ba3fc84..c3268a7 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -1675,32 +1675,29 @@ static void add_reply_to_list(struct local_client *client, int status, { struct node_reply *reply; - pthread_mutex_lock(&client->bits.localsock.reply_mutex); - /* Add it to the list of replies */ - if ((reply = dm_malloc(sizeof(*reply)))) { - reply->status = status; - clops->name_from_csid(csid, reply->node); - DEBUGLOG("Reply from node %s: %d bytes\n", reply->node, len); - - if (len > 0) { - if (!(reply->replymsg = dm_malloc(len))) - reply->status = ENOMEM; - else { - memcpy(reply->replymsg, buf, len); - } - } else { - reply->replymsg = NULL; - } - /* Hook it onto the reply chain */ - reply->next = client->bits.localsock.replies; - client->bits.localsock.replies = reply; - } else { + if (!(reply = dm_zalloc(sizeof(*reply)))) { /* It's all gone horribly wrong... */ - pthread_mutex_unlock(&client->bits.localsock.reply_mutex); send_local_reply(client, ENOMEM, client->fd); return; } + + reply->status = status; + clops->name_from_csid(csid, reply->node); + DEBUGLOG("Reply from node %s: %d bytes\n", reply->node, len); + + if (len > 0) { + if (!(reply->replymsg = dm_malloc(len))) + reply->status = ENOMEM; + else + memcpy(reply->replymsg, buf, len); + } else + reply->replymsg = NULL; + + pthread_mutex_lock(&client->bits.localsock.reply_mutex); + /* Hook it onto the reply chain */ + reply->next = client->bits.localsock.replies; + client->bits.localsock.replies = reply; DEBUGLOG("Got %d replies, expecting: %d\n", client->bits.localsock.num_replies + 1, client->bits.localsock.expected_replies);
1
0
0
0
master - clvmd: use dm_malloc
by Zdenek Kabelac
21 Mar '14
21 Mar '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28479946249611f7…
Commit: 28479946249611f7f103c1caa33033a92ea0ce49 Parent: c45cd6eb8d0272b6700d0b0c6f2baa82fe67f37d Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Thu Mar 20 09:24:45 2014 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Fri Mar 21 22:29:24 2014 +0100 clvmd: use dm_malloc Use libdm malloc wrapper functions. --- daemons/clvmd/clvmd-openais.c | 4 +-- daemons/clvmd/clvmd.c | 72 +++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/daemons/clvmd/clvmd-openais.c b/daemons/clvmd/clvmd-openais.c index 9ce73d6..77c0482 100644 --- a/daemons/clvmd/clvmd-openais.c +++ b/daemons/clvmd/clvmd-openais.c @@ -197,9 +197,7 @@ static int add_internal_client(int fd, fd_callback_t callback) DEBUGLOG("Add_internal_client, fd = %d\n", fd); - client = calloc(1, sizeof(struct local_client)); - if (!client) - { + if (!(client = dm_zalloc(sizeof(*client)))) { DEBUGLOG("malloc failed\n"); return -1; } diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 3890347..ba3fc84 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -677,7 +677,7 @@ static int local_rendezvous_callback(struct local_client *thisfd, char *buf, return 1; if (client_fd >= 0) { - if (!(newfd = dm_zalloc(sizeof(struct local_client)))) { + if (!(newfd = dm_zalloc(sizeof(*newfd)))) { if (close(client_fd)) log_sys_error("close", "socket"); return 1; @@ -1212,7 +1212,7 @@ static int cleanup_zombie(struct local_client *thisfd) lastfd->next = newfd->next; free_fd = newfd; newfd->next = lastfd; - free(free_fd); + dm_free(free_fd); break; } lastfd = newfd; @@ -1221,7 +1221,7 @@ static int cleanup_zombie(struct local_client *thisfd) } /* Free the command buffer */ - free(thisfd->bits.localsock.cmd); + dm_free(thisfd->bits.localsock.cmd); /* Clear out the cross-link */ if (thisfd->bits.localsock.pipe_client != NULL) @@ -1312,12 +1312,10 @@ static int read_from_local_sock(struct local_client *thisfd) } /* Free any old buffer space */ - free(thisfd->bits.localsock.cmd); + dm_free(thisfd->bits.localsock.cmd); /* Save the message */ - thisfd->bits.localsock.cmd = malloc(len + missing_len); - - if (!thisfd->bits.localsock.cmd) { + if (!(thisfd->bits.localsock.cmd = dm_malloc(len + missing_len))) { struct clvm_header reply = { .cmd = CLVMD_CMD_REPLY, .status = ENOMEM @@ -1349,7 +1347,7 @@ static int read_from_local_sock(struct local_client *thisfd) } else { /* EOF or error on socket */ DEBUGLOG("EOF on local socket\n"); - free(thisfd->bits.localsock.cmd); + dm_free(thisfd->bits.localsock.cmd); thisfd->bits.localsock.cmd = NULL; return 0; } @@ -1415,8 +1413,7 @@ static int read_from_local_sock(struct local_client *thisfd) return len; } - newfd = malloc(sizeof(struct local_client)); - if (!newfd) { + if (!(newfd = dm_malloc(sizeof(*newfd)))) { struct clvm_header reply = { .cmd = CLVMD_CMD_REPLY, .status = ENOMEM @@ -1616,14 +1613,12 @@ static void process_remote_command(struct clvm_header *msg, int msglen, int fd, } /* Allocate a default reply buffer */ - replyargs = malloc(max_cluster_message - sizeof(struct clvm_header)); - - if (replyargs != NULL) { + if ((replyargs = dm_malloc(max_cluster_message - sizeof(struct clvm_header)))) /* Run the command */ /* FIXME: usage of init_test() is unprotected */ status = do_command(NULL, msg, msglen, &replyargs, buflen, &replylen); - } else { + else { status = ENOMEM; } @@ -1631,8 +1626,7 @@ static void process_remote_command(struct clvm_header *msg, int msglen, int fd, if (msg->cmd != CLVMD_CMD_REPLY) { char *aggreply; - aggreply = - realloc(replyargs, replylen + sizeof(struct clvm_header)); + aggreply = dm_realloc(replyargs, replylen + sizeof(struct clvm_header)); if (aggreply) { struct clvm_header *agghead = (struct clvm_header *) aggreply; @@ -1670,7 +1664,7 @@ static void process_remote_command(struct clvm_header *msg, int msglen, int fd, } } - free(replyargs); + dm_free(replyargs); } /* Add a reply to a command to the list of replies for this client. @@ -1684,17 +1678,15 @@ static void add_reply_to_list(struct local_client *client, int status, pthread_mutex_lock(&client->bits.localsock.reply_mutex); /* Add it to the list of replies */ - reply = malloc(sizeof(struct node_reply)); - if (reply) { + if ((reply = dm_malloc(sizeof(*reply)))) { reply->status = status; clops->name_from_csid(csid, reply->node); DEBUGLOG("Reply from node %s: %d bytes\n", reply->node, len); if (len > 0) { - reply->replymsg = malloc(len); - if (!reply->replymsg) { + if (!(reply->replymsg = dm_malloc(len))) reply->status = ENOMEM; - } else { + else { memcpy(reply->replymsg, buf, len); } } else { @@ -1811,17 +1803,17 @@ static int process_local_command(struct clvm_header *msg, int msglen, struct local_client *client, unsigned short xid) { - char *replybuf = malloc(max_cluster_message); + char *replybuf; int buflen = max_cluster_message - sizeof(struct clvm_header) - 1; int replylen = 0; int status; + if (!(replybuf = dm_malloc(max_cluster_message))) + return -1; + DEBUGLOG("process_local_command: %s msg=%p, msglen =%d, client=%p\n", decode_cmd(msg->cmd), msg, msglen, client); - if (!replybuf) - return -1; - /* If remote flag is set, just set a successful status code. */ if (msg->flags & CLVMD_FLAG_REMOTE) status = 0; @@ -1839,7 +1831,7 @@ static int process_local_command(struct clvm_header *msg, int msglen, DEBUGLOG("Local command took too long, discarding xid %d, current is %d\n", xid, client->xid); - free(replybuf); + dm_free(replybuf); return status; } @@ -1895,7 +1887,7 @@ static void send_local_reply(struct local_client *client, int status, int fd) /* Add in the size of our header */ message_len = message_len + sizeof(struct clvm_header); - if (!(replybuf = malloc(message_len))) { + if (!(replybuf = dm_malloc(message_len))) { DEBUGLOG("Memory allocation fails\n"); return; } @@ -1933,8 +1925,8 @@ static void send_local_reply(struct local_client *client, int status, int fd) } thisreply = thisreply->next; - free(tempreply->replymsg); - free(tempreply); + dm_free(tempreply->replymsg); + dm_free(tempreply); } /* Terminate with an empty node name */ @@ -1945,7 +1937,7 @@ static void send_local_reply(struct local_client *client, int status, int fd) /* And send it */ send_message(replybuf, message_len, our_csid, fd, "Error sending REPLY to client"); - free(replybuf); + dm_free(replybuf); /* Reset comms variables */ client->bits.localsock.replies = NULL; @@ -1964,8 +1956,8 @@ static void free_reply(struct local_client *client) thisreply = thisreply->next; - free(tempreply->replymsg); - free(tempreply); + dm_free(tempreply->replymsg); + dm_free(tempreply); } client->bits.localsock.replies = NULL; } @@ -2040,7 +2032,7 @@ static int process_work_item(struct lvm_thread_cmd *cmd) if (cmd->msg == NULL) { DEBUGLOG("process_work_item: free fd %d\n", cmd->client->fd); cmd_client_cleanup(cmd->client); - free(cmd->client); + dm_free(cmd->client); return 0; } @@ -2094,8 +2086,8 @@ static void *lvm_thread_fn(void *arg) pthread_mutex_unlock(&lvm_thread_mutex); process_work_item(cmd); - free(cmd->msg); - free(cmd); + dm_free(cmd->msg); + dm_free(cmd); pthread_mutex_lock(&lvm_thread_mutex); } @@ -2116,15 +2108,13 @@ static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg, if (lvm_thread_exit) return -1; /* We are about to exit */ - cmd = malloc(sizeof(struct lvm_thread_cmd)); - if (!cmd) + if (!(cmd = dm_malloc(sizeof(*cmd)))) return ENOMEM; if (msglen) { - cmd->msg = malloc(msglen); - if (!cmd->msg) { + if (!(cmd->msg = dm_malloc(msglen))) { log_error("Unable to allocate buffer space\n"); - free(cmd); + dm_free(cmd); return -1; } memcpy(cmd->msg, msg, msglen);
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
26
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Results per page:
10
25
50
100
200