CTDB could be more helpful to those of us getting CTDB working on a new file system

Michael Adam obnox at samba.org
Thu Jan 8 16:20:01 MST 2015


On 2015-01-08 at 14:08 -0800, Richard Sharpe wrote:
> Hi folks,
> 
> All of a sudden, with a new configuration, we started getting this in
> the ctdb log file:
> 
> 2015/01/08 09:54:25.239333 [recoverd: 5824]: ctdb_recovery_lock:
> Failed to get recovery lock on '/var/hf/hfmp/somedir/ctdb_reclock'
> 2015/01/08 09:54:25.239357 [recoverd: 5824]: Unable to get recovery
> lock - retrying recovery
> 
> Things were working correctly on another two-node setup.
> 
> After testing with ping_pong it turned out that the problem is that
> the file system is returning EBADF when a lock is attempted, which is
> our problem, but it certainly would have been nice for CTDB to tell us
> that.

A patch to improve the helpfulness of the debug message
would have been highly welcome. ;-)

Like the attached (for master) - review appreciated.

Cheers - Michael
-------------- next part --------------
From 5739c8b7d055c05e9a91171a452194d5fc631ede Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 9 Jan 2015 00:10:37 +0100
Subject: [PATCH] ctdb: improve helpfulness of debug message when taking
 reclock fails

Print out the errno if the fcntl call.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/server/ctdb_recover.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index c26a048..10d088b 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -753,10 +753,14 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
 	lock.l_pid = 0;
 
 	if (fcntl(ctdb->recovery_lock_fd, F_SETLK, &lock) != 0) {
+		int saved_errno = errno;
 		close(ctdb->recovery_lock_fd);
 		ctdb->recovery_lock_fd = -1;
 		if (keep) {
-			DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
+			DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get "
+					  "recovery lock on '%s' - (%s)\n",
+					  ctdb->recovery_lock_file,
+					  strerror(saved_errno)));
 		}
 		return false;
 	}
-- 
2.1.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150109/02fc7515/attachment.pgp>


More information about the samba-technical mailing list