Patchwork [6/8] libjunction: Deprecate trusted.junction.type xattr

login
register
mail settings
Submitter Chuck Lever
Date Oct. 11, 2012, 7:09 p.m.
Message ID <20121011190931.31447.29718.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/190977/
State Accepted
Headers show

Comments

Chuck Lever - Oct. 11, 2012, 7:09 p.m.
Since fedfs-utils 0.8, we don't read the contents of this extended
attribute, and since Linux kernel 3.0, we no longer even check for the
existence of this xattr.  It's no longer needed, and support for it
can be removed.

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

 src/libjunction/fedfs.c             |   17 +----------
 src/libjunction/junction-internal.h |    7 -----
 src/libjunction/junction.c          |   53 -----------------------------------
 src/libjunction/nfs.c               |   13 ---------
 4 files changed, 1 insertions(+), 89 deletions(-)

Patch

diff --git a/src/libjunction/fedfs.c b/src/libjunction/fedfs.c
index bbd0a65..5acd58e 100644
--- a/src/libjunction/fedfs.c
+++ b/src/libjunction/fedfs.c
@@ -39,9 +39,7 @@ 
  * "trusted.junction.nfs".   The parent object is a directory.
  *
  * To help file servers discover junctions efficiently, the directory
- * has no execute bits, and the sticky bit is set.  In addition, an
- * extended attribute called "trusted.junction.type" is added.  The
- * contents are ignored in user space.
+ * has no execute bits, and the sticky bit is set.
  *
  * Finally, for pre-existing directories that are converted to
  * junctions, their mode bits are saved in an extended attribute called
@@ -291,11 +289,6 @@  fedfs_add_junction(const char *pathname, const char *fsn_uuid, const nsdb_t host
 	if (retval != FEDFS_OK)
 		goto out_err;
 
-	/* The content of this attribute is ignored */
-	retval = junction_add_type(pathname, "nfs");
-	if (retval != FEDFS_OK)
-		return retval;
-
 	return retval;
 
 out_err:
@@ -321,14 +314,6 @@  fedfs_delete_junction(const char *pathname)
 	if (retval != FEDFS_OK)
 		return retval;
 
-	retval = junction_remove_type(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/junction-internal.h b/src/libjunction/junction-internal.h
index f362d0d..e80edf0 100644
--- a/src/libjunction/junction-internal.h
+++ b/src/libjunction/junction-internal.h
@@ -39,11 +39,6 @@ 
 #define JUNCTION_XATTR_NAME_MODE	"trusted.junction.mode"
 
 /**
- * Name of extended attribute containing junction type
- */
-#define JUNCTION_XATTR_NAME_TYPE	"trusted.junction.type"
-
-/**
  * Name of extended attribute containing NFS-related junction data
  */
 #define JUNCTION_XATTR_NAME_NFS		"trusted.junction.nfs"
@@ -84,8 +79,6 @@  FedFsStatus	 junction_remove_xattr(int fd, const char *pathname,
 			const char *name);
 FedFsStatus	 junction_save_mode(const char *pathname);
 FedFsStatus	 junction_restore_mode(const char *pathname);
-FedFsStatus	 junction_add_type(const char *pathname, const char *type);
-FedFsStatus	 junction_remove_type(const char *pathname);
 
 
 /**
diff --git a/src/libjunction/junction.c b/src/libjunction/junction.c
index baf7a90..cd53744 100644
--- a/src/libjunction/junction.c
+++ b/src/libjunction/junction.c
@@ -465,56 +465,3 @@  out:
 	(void)close(fd);
 	return retval;
 }
-
-/**
- * Add the TYPE xattr
- *
- * @param pathname NUL-terminated C string containing pathname of a directory
- * @param type NUL-terminated C string containing the contents of the new xattr
- * @return a FedFsStatus code
- *
- * @note Access to trusted attributes requires CAP_SYS_ADMIN.
- *
- * The TYPE xattr is read by local file servers to know when they should
- * perform junction resolution.
- */
-FedFsStatus
-junction_add_type(const char *pathname, const char *type)
-{
-	FedFsStatus retval;
-	int fd;
-
-	retval = junction_open_path(pathname, &fd);
-	if (retval != FEDFS_OK)
-		return retval;
-
-	retval = junction_set_xattr(fd, pathname, JUNCTION_XATTR_NAME_TYPE,
-						type, strlen(type) + 1);
-
-	(void)close(fd);
-	return retval;
-}
-
-/**
- * Remove the TYPE xattr
- *
- * @param pathname NUL-terminated C string containing pathname of a directory
- * @return a FedFsStatus code
- *
- * @note Access to trusted attributes requires CAP_SYS_ADMIN.
- */
-FedFsStatus
-junction_remove_type(const char *pathname)
-{
-	FedFsStatus retval;
-	int fd;
-
-	retval = junction_open_path(pathname, &fd);
-	if (retval != FEDFS_OK)
-		return retval;
-
-	retval = junction_remove_xattr(fd, pathname, JUNCTION_XATTR_NAME_TYPE);
-
-	(void)close(fd);
-	return retval;
-}
diff --git a/src/libjunction/nfs.c b/src/libjunction/nfs.c
index f47d848..67c434c 100644
--- a/src/libjunction/nfs.c
+++ b/src/libjunction/nfs.c
@@ -813,11 +813,6 @@  nfs_add_junction(const char *pathname, struct nfs_fsloc *fslocs)
 	if (retval != FEDFS_OK)
 		goto out_err;
 
-	/* The content of this attribute is ignored */
-	retval = junction_add_type(pathname, "nfs");
-	if (retval != FEDFS_OK)
-		return retval;
-
 	return retval;
 
 out_err:
@@ -843,14 +838,6 @@  nfs_delete_junction(const char *pathname)
 	if (retval != FEDFS_OK)
 		return retval;
 
-	retval = junction_remove_type(pathname);
-	if (retval != FEDFS_OK)
-		return retval;
-
-	retval = junction_restore_mode(pathname);
-	if (retval != FEDFS_OK)
-		return retval;
-
 	return nfs_remove_locations(pathname);
 }