From patchwork Fri Feb 1 17:20:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04/13] nfsref: FSNs not removed if "nfsref" junction type not specified From: Chuck Lever X-Patchwork-Id: 217530 Message-Id: <20130201172018.63192.82546.stgit@seurat.1015granger.net> To: fedfs-utils-devel@oss.oracle.com Date: Fri, 01 Feb 2013 12:20:18 -0500 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