A couple of cases that resolve junctions should attempt to report
errors from nsdb_open_nsdb().

Signed-off-by: Chuck Lever <[email protected]>
---

 src/nfsref/lookup.c       |   24 +++++++++++++++++++++++-
 src/plug-ins/nfs-plugin.c |   23 ++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/nfsref/lookup.c b/src/nfsref/lookup.c
index 5d1817e..3e3d1f4 100644
--- a/src/nfsref/lookup.c
+++ b/src/nfsref/lookup.c
@@ -348,8 +348,30 @@ nfsref_lookup_resolve_fsn(const char *fsn_uuid, nsdb_t 
host)
                __func__, fsn_uuid, nsdb_hostname(host), nsdb_port(host));
 
 again:
-       if (nsdb_open_nsdb(host, NULL, NULL, &ldap_err) != FEDFS_OK)
+       retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+       switch (retval) {
+       case FEDFS_OK:
+               break;
+       case FEDFS_ERR_NSDB_CONN:
+               xlog(L_ERROR, "Failed to connect to NSDB %s:%u",
+                       nsdb_hostname(host), nsdb_port(host));
+               return status;
+       case FEDFS_ERR_NSDB_AUTH:
+               xlog(L_ERROR, "Failed to establish secure connection to "
+                       "NSDB %s:%u", nsdb_hostname(host), nsdb_port(host));
+               return status;
+       case FEDFS_ERR_NSDB_LDAP_VAL:
+               xlog(L_ERROR, "Failed to bind to NSDB %s:%u: %s",
+                       nsdb_hostname(host), nsdb_port(host),
+                       ldap_err2string(ldap_err));
                return status;
+       default:
+               xlog(L_ERROR, "Failed to open NSDB %s:%u: %s",
+                       nsdb_hostname(host), nsdb_port(host),
+                       nsdb_display_fedfsstatus(retval));
+               return status;
+       }
+
 
        retval = nsdb_get_fsn_s(host, NULL, fsn_uuid, &fsn, &ldap_err);
        switch (retval) {
diff --git a/src/plug-ins/nfs-plugin.c b/src/plug-ins/nfs-plugin.c
index 7f0127f..dbe84d9 100644
--- a/src/plug-ins/nfs-plugin.c
+++ b/src/plug-ins/nfs-plugin.c
@@ -395,8 +395,29 @@ nfs_jp_resolve_fsn(const char *fsn_uuid, nsdb_t host,
        int fsn_ttl;
 
 again:
-       if (nsdb_open_nsdb(host, NULL, NULL, &ldap_err) != FEDFS_OK)
+       retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+       switch (retval) {
+       case FEDFS_OK:
+               break;
+       case FEDFS_ERR_NSDB_CONN:
+               nfs_jp_debug("%s: Failed to connect to NSDB %s:%u\n",
+                       nsdb_hostname(host), nsdb_port(host));
+               return JP_NSDBREMOTE;
+       case FEDFS_ERR_NSDB_AUTH:
+               nfs_jp_debug("%s: Failed to establish secure connection to "
+                       "NSDB %s:%u\n", nsdb_hostname(host), nsdb_port(host));
+               return JP_NSDBLOCAL;
+       case FEDFS_ERR_NSDB_LDAP_VAL:
+               nfs_jp_debug("%s: Failed to bind to NSDB %s:%u: %s\n",
+                       nsdb_hostname(host), nsdb_port(host),
+                       ldap_err2string(ldap_err));
                return JP_NSDBLOCAL;
+       default:
+               nfs_jp_debug("%s: Failed to open NSDB %s:%u: %s\n",
+                       nsdb_hostname(host), nsdb_port(host),
+                       nsdb_display_fedfsstatus(retval));
+               return JP_NSDBLOCAL;
+       }
 
        retval = nsdb_get_fsn_s(host, NULL, fsn_uuid, &fsn, &ldap_err);
        switch (retval) {


_______________________________________________
fedfs-utils-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel

Reply via email to