diff mbox

[04/13] nfsref: FSNs not removed if "nfsref" junction type not specified

Message ID 20130201172018.63192.82546.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Feb. 1, 2013, 5:20 p.m. UTC
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 <chuck.lever@oracle.com>
---

 src/nfsref/remove.c |   78 ++++++++++++++++++++++++++-------------------------
 1 files changed, 39 insertions(+), 39 deletions(-)
diff mbox

Patch

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