From d415d4d32f2e8e61de21abfdfce02e1b1ea1e1d3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 3 Nov 2009 05:41:02 +0100 Subject: s3: Add parameter "ctdb timeout" When something in the cluster blocks, it can happen that we wait indefinitely long for ctdb, just adding to the blocking condition. In theory, nothing should block, but as someone said "In practice the difference between theory and practice is larger than in theory". This adds a timeout parameter in seconds, after which we stop waiting for ctdb and panic. --- source3/lib/ctdbd_conn.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source3/lib/ctdbd_conn.c') diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index ffd79c9fe1..84bba3bea3 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -275,6 +275,17 @@ static struct messaging_rec *ctdb_pull_messaging_rec(TALLOC_CTX *mem_ctx, return result; } +static NTSTATUS ctdb_packet_fd_read_sync(struct packet_context *ctx) +{ + struct timeval timeout; + struct timeval *ptimeout; + + timeout = timeval_set(lp_ctdb_timeout(), 0); + ptimeout = (timeout.tv_sec != 0) ? &timeout : NULL; + + return packet_fd_read_sync(ctx, ptimeout); +} + /* * Read a full ctdbd request. If we have a messaging context, defer incoming * messages that might come in between. @@ -289,7 +300,7 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid, again: - status = packet_fd_read_sync(conn->pkt); + status = ctdb_packet_fd_read_sync(conn->pkt); if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_BUSY)) { /* EAGAIN */ @@ -1156,7 +1167,7 @@ NTSTATUS ctdbd_traverse(uint32 db_id, break; } - status = packet_fd_read_sync(conn->pkt); + status = ctdb_packet_fd_read_sync(conn->pkt); if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { /* -- cgit