[fedfs-utils] [PATCH 2/9] nsdbparams: Fall back to old-style NCE when pinging old-style NSDB

Chuck Lever chuck.lever at oracle.com
Fri Jun 27 11:42:29 PDT 2014


Rob Thurlow reports:

nsdbparams: nsdb_new_get_ncedn_s:
 ldapsearch -H ldap://nfsmpit2-02:389 -b "dc=cthon,dc=org" -s sub '(objectClass=fedfsNsdbContainerEntry)' *
nsdbparams: nsdb_new_get_ncedn_s: received 1 messages
nsdbparams: nsdb_parse_result: Search completed successfully

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ba5cbf in ldap_unbind_ext () from /lib64/libldap-2.4.so.2
Missing separate debuginfos, use: debuginfo-install fedfs-utils-nsdbparams-0.10.0-2.fc20.x86_64

(gdb) backtrace
#0  0x00007ffff7ba5cbf in ldap_unbind_ext () from /lib64/libldap-2.4.so.2
#1  0x000055555555fba1 in nsdb_close_nsdb (host=0x55555578ace0) at nsdb.c:1562
#2  0x000055555555d0d8 in nsdb_ping_s (
   hostname=hostname at entry=0x7fffffffe876 "nfsmpit2-02", port=port at entry=389,
   ldap_err=ldap_err at entry=0x7fffffffe464) at fileserver.c:1954
#3  0x00005555555593be in nsdbparams_test_nsdb (nsdbport=389,
   nsdbname=0x7fffffffe876 "nfsmpit2-02") at update.c:111
#4  nsdbparams_update (progname=0x7fffffffe830 "nsdbparams",
   argc=<optimized out>, argv=0x7fffffffe5d0) at update.c:406
#5  0x00005555555578df in main (argc=8, argv=0x7fffffffe5c8) at main.c:212

His old-style NSDB returned just one LDAP message in reply to the
query to see if the NSDB had a new-style NCE.

Fixes: ea9cadee (libnsdb: simplify NCE discovery)
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---
 src/libnsdb/fileserver.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/libnsdb/fileserver.c b/src/libnsdb/fileserver.c
index 965f1a1249a5..be5c8f796967 100644
--- a/src/libnsdb/fileserver.c
+++ b/src/libnsdb/fileserver.c
@@ -539,12 +539,20 @@ nsdb_new_get_ncedn_s(nsdb_t host, const char *naming_context, char **dn)
 	}
 
 	entries = ldap_count_messages(ld, response);
-	if (entries == -1) {
-		xlog(D_GENERAL, "%s: Empty LDAP response\n", __func__);
+	switch (entries) {
+	case -1:
+		xlog(D_GENERAL, "%s: Empty LDAP response", __func__);
 		retval = FEDFS_ERR_NSDB_FAULT;
 		goto out;
+	case 1:
+		xlog(D_GENERAL, "%s: %s does not contain a new-style NCE",
+			__func__, naming_context);
+		retval = FEDFS_ERR_NSDB_NONCE;
+		goto out;
+	default:
+		xlog(D_CALL, "%s: received %d messages", __func__, entries);
+		break;
 	}
-	xlog(D_CALL, "%s: received %d messages", __func__, entries);
 
 	retval = FEDFS_OK;
 	for (message = ldap_first_message(ld, response), count = 0;




More information about the fedfs-utils-devel mailing list