From 6cfe6e92a1f962040a22f107086b19159bb7c605 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 16 Jul 2012 16:18:19 +0200 Subject: s3-ctdb: Fix ctdb_serverids_exist for target nodes that died Signed-off-by: Christian Ambach --- source3/lib/ctdbd_conn.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index dddb41285e..0fa2f9040c 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1190,6 +1190,7 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn, struct ctdb_reply_control *reply = NULL; struct ctdb_vnn_list *vnn; uint32_t reqid; + uint8_t *reply_data; status = ctdb_read_req(conn, 0, talloc_tos(), (void *)&reply); if (!NT_STATUS_IS_OK(status)) { @@ -1227,13 +1228,26 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn, (unsigned)vnn->vnn, vnn->num_srvids, (unsigned)reply->datalen)); - if (reply->datalen < ((vnn->num_srvids+7)/8)) { - DEBUG(1, ("Received short reply len %d, status %u," + if (reply->datalen >= ((vnn->num_srvids+7)/8)) { + /* + * Got a real reply + */ + reply_data = reply->data; + } else { + /* + * Got an error reply + */ + DEBUG(1, ("Received short reply len %d, status %u, " "errorlen %u\n", (unsigned)reply->datalen, (unsigned)reply->status, (unsigned)reply->errorlen)); - goto fail; + dump_data(1, reply->data, reply->errorlen); + + /* + * This will trigger everything set to false + */ + reply_data = NULL; } for (i=0; inum_srvids; i++) { @@ -1244,7 +1258,9 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn, results[idx] = true; continue; } - results[idx] = ((reply->data[i/8] & (1<<(i%8))) != 0); + results[idx] = + (reply_data != NULL) && + ((reply_data[i/8] & (1<<(i%8))) != 0); } TALLOC_FREE(reply); -- cgit