diff options
author | Patrick Caulfield <pcaulfie@redhat.com> | 2005-01-21 11:35:24 +0000 |
---|---|---|
committer | Patrick Caulfield <pcaulfie@redhat.com> | 2005-01-21 11:35:24 +0000 |
commit | 6f4d25ec7f4af5baf0eae250e22840b2cad54f11 (patch) | |
tree | f948bccb3cff33a2ec1e216683a0a02dbba89aab /daemons/clvmd | |
parent | eaafeaaa0904c5f688825486727218fe804468ed (diff) | |
download | lvm2-6f4d25ec7f4af5baf0eae250e22840b2cad54f11.tar.gz lvm2-6f4d25ec7f4af5baf0eae250e22840b2cad54f11.tar.xz lvm2-6f4d25ec7f4af5baf0eae250e22840b2cad54f11.zip |
Fix clvmd startup bug introduced in cman/gulm amalgamation. bz#145729
Improve reporting of node-specific locking errors so you'll get
somthing a little more helpfiul than "host is down" - it will now tell
you /which/ host it thinks is down.
Diffstat (limited to 'daemons/clvmd')
-rw-r--r-- | daemons/clvmd/clvm.h | 1 | ||||
-rw-r--r-- | daemons/clvmd/clvmd-cman.c | 7 | ||||
-rw-r--r-- | daemons/clvmd/clvmd-gulm.c | 7 | ||||
-rw-r--r-- | daemons/clvmd/clvmd.c | 30 |
4 files changed, 25 insertions, 20 deletions
diff --git a/daemons/clvmd/clvm.h b/daemons/clvmd/clvm.h index dd20bfd3..7997b482 100644 --- a/daemons/clvmd/clvm.h +++ b/daemons/clvmd/clvm.h @@ -43,6 +43,7 @@ struct clvm_header { /* Flags */ #define CLVMD_FLAG_LOCAL 1 /* Only do this on the local node */ #define CLVMD_FLAG_SYSTEMLV 2 /* Data in system LV under my node name */ +#define CLVMD_FLAG_NODEERRS 4 /* Reply has errors in node-specific portion */ /* Name of the local socket to communicate between libclvm and clvmd */ //static const char CLVMD_SOCKNAME[]="/var/run/clvmd"; diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c index 3f8c7027..d441b4eb 100644 --- a/daemons/clvmd/clvmd-cman.c +++ b/daemons/clvmd/clvmd-cman.c @@ -104,6 +104,11 @@ static int _init_cluster(void) return 0; } +static void _cluster_init_completed(void) +{ + clvmd_cluster_init_completed(); +} + static int _get_main_cluster_fd() { return cluster_sock; @@ -507,7 +512,7 @@ static int _sync_unlock(const char *resource /* UNUSED */, int lockid) } static struct cluster_ops _cluster_cman_ops = { - .cluster_init_completed = NULL, + .cluster_init_completed = _cluster_init_completed, .cluster_send_message = _cluster_send_message, .name_from_csid = _name_from_csid, .csid_from_name = _csid_from_name, diff --git a/daemons/clvmd/clvmd-gulm.c b/daemons/clvmd/clvmd-gulm.c index 235bceb9..a6e0a1b6 100644 --- a/daemons/clvmd/clvmd-gulm.c +++ b/daemons/clvmd/clvmd-gulm.c @@ -913,11 +913,6 @@ static int get_all_cluster_nodes() return 0; } -static void _cluster_init_completed(void) -{ - clvmd_cluster_init_completed(); -} - static int _get_main_cluster_fd(void) { return get_main_gulm_cluster_fd(); @@ -934,7 +929,7 @@ static int _cluster_send_message(void *buf, int msglen, char *csid, const char * } static struct cluster_ops _cluster_gulm_ops = { - .cluster_init_completed = _cluster_init_completed, + .cluster_init_completed = NULL, .cluster_send_message = _cluster_send_message, .name_from_csid = gulm_name_from_csid, .csid_from_name = _csid_from_name, diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 032671be..013fd520 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -785,7 +785,7 @@ static int read_from_local_sock(struct local_client *thisfd) if (thisfd->bits.localsock.in_progress) { struct clvm_header reply; reply.cmd = CLVMD_CMD_REPLY; - reply.status = -EBUSY; + reply.status = EBUSY; reply.arglen = 0; reply.flags = 0; send_message(&reply, sizeof(reply), our_csid, @@ -808,7 +808,7 @@ static int read_from_local_sock(struct local_client *thisfd) if (!thisfd->bits.localsock.cmd) { struct clvm_header reply; reply.cmd = CLVMD_CMD_REPLY; - reply.status = -ENOMEM; + reply.status = ENOMEM; reply.arglen = 0; reply.flags = 0; send_message(&reply, sizeof(reply), our_csid, @@ -855,7 +855,7 @@ static int read_from_local_sock(struct local_client *thisfd) DEBUGLOG("Unknown node: '%s'\n", inheader->node); reply.cmd = CLVMD_CMD_REPLY; - reply.status = -ENOENT; + reply.status = ENOENT; reply.flags = 0; reply.arglen = 0; send_message(&reply, sizeof(reply), our_csid, @@ -886,7 +886,7 @@ static int read_from_local_sock(struct local_client *thisfd) close(comms_pipe[1]); reply.cmd = CLVMD_CMD_REPLY; - reply.status = -ENOMEM; + reply.status = ENOMEM; reply.arglen = 0; reply.flags = 0; send_message(&reply, sizeof(reply), our_csid, @@ -1076,7 +1076,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd, /* Return a failure response */ head.cmd = CLVMD_CMD_REPLY; - head.status = -EFBIG; + head.status = EFBIG; head.flags = 0; head.clientid = msg->clientid; head.arglen = 0; @@ -1093,7 +1093,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd, msg->arglen); /* Return a failure response */ head.cmd = CLVMD_CMD_REPLY; - head.status = -ENOMEM; + head.status = ENOMEM; head.flags = 0; head.clientid = msg->clientid; head.arglen = 0; @@ -1156,7 +1156,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd, do_command(NULL, msg, msglen, &replyargs, buflen, &replylen); } else { - status = -ENOMEM; + status = ENOMEM; } /* If it wasn't a reply, then reply */ @@ -1191,7 +1191,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd, (aggreply, replylen + sizeof(struct clvm_header)) < 0 && replylen > 0) - agghead->status = -EFBIG; + agghead->status = EFBIG; send_message(agghead, sizeof(struct clvm_header), csid, @@ -1216,7 +1216,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd, DEBUGLOG("Error attempting to realloc return buffer\n"); /* Return a failure response */ head.cmd = CLVMD_CMD_REPLY; - head.status = -ENOMEM; + head.status = ENOMEM; head.flags = 0; head.clientid = msg->clientid; head.arglen = 0; @@ -1254,7 +1254,7 @@ static void add_reply_to_list(struct local_client *client, int status, if (len > 0) { reply->replymsg = malloc(len); if (!reply->replymsg) { - reply->status = -ENOMEM; + reply->status = ENOMEM; } else { memcpy(reply->replymsg, buf, len); } @@ -1445,9 +1445,10 @@ static void send_local_reply(struct local_client *client, int status, int fd) replybuf = malloc(message_len); clientreply = (struct clvm_header *) replybuf; - clientreply->status = -status; + clientreply->status = status; clientreply->cmd = CLVMD_CMD_REPLY; clientreply->node[0] = '\0'; + clientreply->flags = 0; ptr = clientreply->args; @@ -1459,6 +1460,9 @@ static void send_local_reply(struct local_client *client, int status, int fd) strcpy(ptr, thisreply->node); ptr += strlen(thisreply->node) + 1; + if (thisreply->status) + clientreply->flags |= CLVMD_FLAG_NODEERRS; + *(int *) ptr = thisreply->status; ptr += sizeof(int); @@ -1627,7 +1631,7 @@ static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg, cmd = malloc(sizeof(struct lvm_thread_cmd)); if (!cmd) - return -ENOMEM; + return ENOMEM; cmd->msg = malloc(msglen); if (!cmd->msg) { @@ -1709,7 +1713,7 @@ static void check_all_callback(struct local_client *client, char *csid, int node_up) { if (!node_up) - add_reply_to_list(client, -EHOSTDOWN, csid, "CLVMD not running", + add_reply_to_list(client, EHOSTDOWN, csid, "CLVMD not running", 18); } |