[PATCHES] improved error reporting in ctdbd_init_connection

Michael Adam obnox at samba.org
Fri Jun 26 06:04:59 MDT 2015


attached ... :)

On 2015-06-26 at 14:03 +0200, Michael Adam wrote:
> On 2015-06-26 at 13:39 +0200, Volker Lendecke wrote:
> > On Fri, Jun 26, 2015 at 01:36:11PM +0200, Guenther Deschner wrote:
> > > RB+ and pushed to autobuild.
> > 
> > Ok, sorry for the noise. I need to be MUCH quicker if I want
> > a chance to comment :-(((
> 
> Luckily, we have autobuild... and hence the chance to amend. :-)
> 
> I was undecided between 0 and 1.
> 
> So attached is an updated patchset that does 1 instead of 0.
> 
> Volker, Günther - should we use that instead of the original
> patch?
> 
> Thanks - Michael


-------------- next part --------------
From 23894fa93d20ab0bd5fe5955009f6868a19820fb Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 26 Jun 2015 13:14:39 +0200
Subject: [PATCH 1/2] ctdbd_conn: lower the debug level 1 for failing
 connection to ctdbd.

If e.g. samba fails to start because it can not open the
connection to ctdbd, we want to see some indication in the
logs about this.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/lib/ctdbd_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 7a95b79c..962ab43 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -459,7 +459,7 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
 	ret = ctdbd_connect(&conn->fd);
 	if (ret != 0) {
 		status = map_nt_error_from_unix(errno);
-		DEBUG(10, ("ctdbd_connect failed: %s\n", strerror(errno)));
+		DEBUG(1, ("ctdbd_connect failed: %s\n", strerror(errno)));
 		goto fail;
 	}
 	talloc_set_destructor(conn, ctdbd_connection_destructor);
-- 
2.4.3


From 43c59f8e17e1d71bf321fe4e59ac2c12a6cad681 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 26 Jun 2015 13:17:01 +0200
Subject: [PATCH 2/2] ctdbd_conn: use the right error code from ctdbd_connect
 for debug and return

ctdbd_connect() explicitly returns the errno.
Using errno instead of ret misses some important
manually set return values and might use the
errno that is changed by close(fd).

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/lib/ctdbd_conn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 962ab43..fae086a 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -458,8 +458,8 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
 
 	ret = ctdbd_connect(&conn->fd);
 	if (ret != 0) {
-		status = map_nt_error_from_unix(errno);
-		DEBUG(1, ("ctdbd_connect failed: %s\n", strerror(errno)));
+		status = map_nt_error_from_unix(ret);
+		DEBUG(1, ("ctdbd_connect failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 	talloc_set_destructor(conn, ctdbd_connection_destructor);
-- 
2.4.3

-------------- 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/20150626/394ed129/attachment.pgp>


More information about the samba-technical mailing list