From patchwork Thu Jan 24 18:35:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 215471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "userp1040.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 01AD42C008C for ; Fri, 25 Jan 2013 05:35:49 +1100 (EST) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0OIZkPB014275 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jan 2013 18:35:47 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0OIZjun018769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Jan 2013 18:35:46 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TyReL-0000Qi-T3; Thu, 24 Jan 2013 10:35:45 -0800 Received: from acsinet21.oracle.com ([141.146.126.237]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TyReJ-0000Qa-OE for fedfs-utils-devel@oss.oracle.com; Thu, 24 Jan 2013 10:35:43 -0800 Received: from aserp1020.oracle.com (aserp1020.oracle.com [141.146.126.67]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0OIZhDR004482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Jan 2013 18:35:43 GMT Received: from mail-ia0-f179.google.com (mail-ia0-f179.google.com [209.85.210.179]) by aserp1020.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0OIZghk003324 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 24 Jan 2013 18:35:43 GMT Received: by mail-ia0-f179.google.com with SMTP id x24so5235399iak.10 for ; Thu, 24 Jan 2013 10:35:42 -0800 (PST) X-Received: by 10.50.10.193 with SMTP id k1mr2078312igb.102.1359052542389; Thu, 24 Jan 2013 10:35:42 -0800 (PST) Received: from seurat.1015granger.net ([99.26.161.222]) by mx.google.com with ESMTPS id u4sm1859445igw.6.2013.01.24.10.35.41 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Jan 2013 10:35:41 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Thu, 24 Jan 2013 13:35:41 -0500 Message-ID: <20130124183540.13601.64348.stgit@seurat.1015granger.net> In-Reply-To: <20130124182619.13601.61251.stgit@seurat.1015granger.net> References: <20130124182619.13601.61251.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Flow-Control-Info: class=Default reputation=ipRepBelow100 ip=209.85.210.179 ct-class=R5 ct-vol1=0 ct-vol2=8 ct-vol3=7 ct-risk=46 ct-spam1=71 ct-spam2=6 ct-bulk=5 rcpts=1 size=2805 X-MM-CT-Classification: not spam X-MM-CT-RefID: str=0001.0A090202.51017EFF.0038,ss=1,re=0.000,fgs=0 Subject: [fedfs-utils] [PATCH 08/11] Report errors from nsdb_open_nsdb() X-BeenThere: fedfs-utils-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: fedfs-utils Developers List-Id: fedfs-utils Developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet22.oracle.com [141.146.126.238] A couple of cases that resolve junctions should attempt to report errors from nsdb_open_nsdb(). Signed-off-by: Chuck Lever --- 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) {