Patchwork [01/13] libjunction: Restore mode bits when deleting junction metadata

login
register
mail settings
Submitter Chuck Lever
Date Feb. 1, 2013, 5:19 p.m.
Message ID <20130201171951.63192.91952.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/217528/
State Accepted
Headers show

Comments

Chuck Lever - Feb. 1, 2013, 5:19 p.m.
Deleting junction metadata is supposed to restore a directory's
previous mode bits.  Or at the very least, the sticky bit should be
removed to prevent the kernel from treating this directory like a
junction.

"nfsref remove" currently doesn't do this.  The problem is that
the {fedfs,nfs}_delete_junction() twins do not restore the previous
mode bits.  These should both call junction_restore_mode().

This breakage was introduced in 0.9-devel by commit b01b24fd
"libjunction: Deprecate trusted.junction.type xattr", Thu Oct 11
14:59:50 2012, which incorrectly removed call sites for the
junction_restore_mode() function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/libjunction/fedfs.c |    4 ++++
 src/libjunction/nfs.c   |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

Patch

diff --git a/src/libjunction/fedfs.c b/src/libjunction/fedfs.c
index eed51b3..a06298a 100644
--- a/src/libjunction/fedfs.c
+++ b/src/libjunction/fedfs.c
@@ -352,6 +352,10 @@  fedfs_delete_junction(const char *pathname)
 	if (retval != FEDFS_OK)
 		return retval;
 
+	retval = junction_restore_mode(pathname);
+	if (retval != FEDFS_OK)
+		return retval;
+
 	return fedfs_remove_fsn(pathname);
 }
 
diff --git a/src/libjunction/nfs.c b/src/libjunction/nfs.c
index b6bac49..42c1015 100644
--- a/src/libjunction/nfs.c
+++ b/src/libjunction/nfs.c
@@ -802,6 +802,10 @@  nfs_delete_junction(const char *pathname)
 	if (retval != FEDFS_OK)
 		return retval;
 
+	retval = junction_restore_mode(pathname);
+	if (retval != FEDFS_OK)
+		return retval;
+
 	return nfs_remove_locations(pathname);
 }