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/packet.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/lib/packet.c') diff --git a/source3/lib/packet.c b/source3/lib/packet.c index ef28bf9f62..c131b973bc 100644 --- a/source3/lib/packet.c +++ b/source3/lib/packet.c @@ -101,7 +101,8 @@ NTSTATUS packet_fd_read(struct packet_context *ctx) return NT_STATUS_OK; } -NTSTATUS packet_fd_read_sync(struct packet_context *ctx) +NTSTATUS packet_fd_read_sync(struct packet_context *ctx, + struct timeval *timeout) { int res; fd_set r_fds; @@ -109,7 +110,12 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx) FD_ZERO(&r_fds); FD_SET(ctx->fd, &r_fds); - res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, NULL); + res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, timeout); + + if (res == 0) { + DEBUG(10, ("select timed out\n")); + return NT_STATUS_IO_TIMEOUT; + } if (res == -1) { DEBUG(10, ("select returned %s\n", strerror(errno))); -- cgit