From patchwork Fri Feb 1 17:20:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 217530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "aserp1040.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 36E832C0095 for ; Sat, 2 Feb 2013 04:20:28 +1100 (EST) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r11HKOqK024706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Feb 2013 17:20:25 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r11HKOxX005902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 1 Feb 2013 17:20:24 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1U1KHo-0006dH-G3; Fri, 01 Feb 2013 09:20:24 -0800 Received: from acsinet22.oracle.com ([141.146.126.238]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1U1KHl-0006d3-TU for fedfs-utils-devel@oss.oracle.com; Fri, 01 Feb 2013 09:20:21 -0800 Received: from userp1020.oracle.com (userp1020.oracle.com [156.151.31.79]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r11HKLSi017919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 1 Feb 2013 17:20:21 GMT Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by userp1020.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r11HKKei023470 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 1 Feb 2013 17:20:20 GMT Received: by mail-ie0-f180.google.com with SMTP id bn7so2738545ieb.11 for ; Fri, 01 Feb 2013 09:20:20 -0800 (PST) X-Received: by 10.50.40.135 with SMTP id x7mr1728050igk.79.1359739220281; Fri, 01 Feb 2013 09:20:20 -0800 (PST) Received: from seurat.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id fa6sm3291357igb.2.2013.02.01.09.20.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 01 Feb 2013 09:20:19 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Fri, 01 Feb 2013 12:20:18 -0500 Message-ID: <20130201172018.63192.82546.stgit@seurat.1015granger.net> In-Reply-To: <20130201171714.63192.68358.stgit@seurat.1015granger.net> References: <20130201171714.63192.68358.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.223.180 ct-class=R5 ct-vol1=-89 ct-vol2=8 ct-vol3=8 ct-risk=52 ct-spam1=85 ct-spam2=5 ct-bulk=5 rcpts=1 size=3152 X-MM-CT-Classification: not spam X-MM-CT-RefID: str=0001.0A090206.510BF955.001D,ss=1,re=0.000,fgs=0 Subject: [fedfs-utils] [PATCH 04/13] nfsref: FSNs not removed if "nfsref" junction type not specified 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: acsinet21.oracle.com [141.146.126.237] Suppose "foobar" is an nfs-fedfs junction. If I explicitly specify the junction type on the command line with "nfsref remove -t nfs-fedfs foobar", the FSN listed in the junction "foobar" is deleted on the NSDB. If I let "nfsref" guess what kind of junction "foobar is with "nfsref remove foobar", the FSN is not removed. Remove the junction's FSN when the junction type is not specified. nfsref_remove_unspecified() is moved to avoid adding a forward declaration for nfsref_remove_delete_fsn(). Signed-off-by: Chuck Lever --- src/nfsref/remove.c | 78 ++++++++++++++++++++++++++------------------------- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/nfsref/remove.c b/src/nfsref/remove.c index 3e1fad7..b4394c1 100644 --- a/src/nfsref/remove.c +++ b/src/nfsref/remove.c @@ -60,45 +60,6 @@ nfsref_remove_help(const char *progname) } /** - * Remove any NFS junction information - * - * - * @param junct_path NUL-terminated C string containing pathname of junction - * @return program exit status - */ -static int -nfsref_remove_unspecified(const char *junct_path) -{ - FedFsStatus retval; - - xlog(D_GENERAL, "%s: Removing junction from %s", - __func__, junct_path); - - retval = nfs_delete_junction(junct_path); - if (retval != FEDFS_OK) { - if (retval != FEDFS_ERR_NOTJUNCT) - goto out_err; - retval = fedfs_delete_junction(junct_path); - if (retval != FEDFS_OK) - goto out_err; - } - - printf("Removed junction from %s\n", junct_path); - return EXIT_SUCCESS; - -out_err: - switch (retval) { - case FEDFS_ERR_NOTJUNCT: - xlog(L_ERROR, "No junction information found in %s", junct_path); - break; - default: - xlog(L_ERROR, "Failed to delete %s: %s", - junct_path, nsdb_display_fedfsstatus(retval)); - } - return EXIT_FAILURE; -} - -/** * Remove an NFS locations-style junction * * @param junct_path NUL-terminated C string containing pathname of junction @@ -296,6 +257,45 @@ nfsref_remove_nfs_fedfs(const char *junct_path) } /** + * Remove any NFS junction information + * + * @param junct_path NUL-terminated C string containing pathname of junction + * @return program exit status + */ +static int +nfsref_remove_unspecified(const char *junct_path) +{ + FedFsStatus retval; + + xlog(D_GENERAL, "%s: Removing junction from %s", + __func__, junct_path); + + retval = nfs_delete_junction(junct_path); + if (retval != FEDFS_OK) { + if (retval != FEDFS_ERR_NOTJUNCT) + goto out_err; + nfsref_remove_delete_fsn(junct_path); + retval = fedfs_delete_junction(junct_path); + if (retval != FEDFS_OK) + goto out_err; + } + + printf("Removed junction from %s\n", junct_path); + return EXIT_SUCCESS; + +out_err: + switch (retval) { + case FEDFS_ERR_NOTJUNCT: + xlog(L_ERROR, "No junction information found in %s", junct_path); + break; + default: + xlog(L_ERROR, "Failed to delete %s: %s", + junct_path, nsdb_display_fedfsstatus(retval)); + } + return EXIT_FAILURE; +} + +/** * Remove an NFS junction * * @param type type of junction to add