diff options
author | Alasdair Kergon <agk@redhat.com> | 2012-01-21 05:31:54 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2012-01-21 05:31:54 +0000 |
commit | cab1c8ade19751830da29afb6298eb4b68094779 (patch) | |
tree | 1b08f640b749db752c7874125534adc937f1b414 /daemons/clvmd/clvmd.c | |
parent | f5bfc8b10d8dfc01425b65b247aa93ed89ea864f (diff) | |
download | lvm2-cab1c8ade19751830da29afb6298eb4b68094779.tar.gz lvm2-cab1c8ade19751830da29afb6298eb4b68094779.tar.xz lvm2-cab1c8ade19751830da29afb6298eb4b68094779.zip |
Add CLVMD_FLAG_REMOTE to skip processing on local node.
Diffstat (limited to 'daemons/clvmd/clvmd.c')
-rw-r--r-- | daemons/clvmd/clvmd.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 3a4de3b1..0d12ef39 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -1396,7 +1396,10 @@ static int distribute_command(struct local_client *thisfd) int len = thisfd->bits.localsock.cmd_len; thisfd->xid = global_xid++; - DEBUGLOG("distribute command: XID = %d\n", thisfd->xid); + DEBUGLOG("distribute command: XID = %d, flags=0x%x (%s%s)\n", + thisfd->xid, inheader->flags, + (inheader->flags & CLVMD_FLAG_LOCAL) ? "LOCAL" : "", + (inheader->flags & CLVMD_FLAG_REMOTE) ? "REMOTE" : ""); /* Forward it to other nodes in the cluster if needed */ if (!(inheader->flags & CLVMD_FLAG_LOCAL)) { @@ -1409,7 +1412,11 @@ static int distribute_command(struct local_client *thisfd) thisfd->bits.localsock.in_progress = TRUE; thisfd->bits.localsock.sent_out = TRUE; - /* Do it here first */ + /* + * Send to local node first, even if CLVMD_FLAG_REMOTE + * is set so we still get a reply if this is the + * only node. + */ add_to_lvmqueue(thisfd, inheader, len, NULL); DEBUGLOG("Sending message to all cluster nodes\n"); @@ -1735,8 +1742,12 @@ static int process_local_command(struct clvm_header *msg, int msglen, if (replybuf == NULL) return -1; - /* FIXME: usage of init_test() is unprotected */ - status = do_command(client, msg, msglen, &replybuf, buflen, &replylen); + /* If remote flag is set, just set a successful status code. */ + if (msg->flags & CLVMD_FLAG_REMOTE) + status = 0; + else + /* FIXME: usage of init_test() is unprotected */ + status = do_command(client, msg, msglen, &replybuf, buflen, &replylen); if (status) client->bits.localsock.all_success = 0; |