These patches clean up the remaining issues from the tacl_xattr.sh test script (this is easy stuff- Murali did all of the hard work).

tacl-xattr-homedir.patch:
-------------------------
This makes tacl-xattr.sh slightly more portable. Some Linux distributions have adduser utilities that do not create the home directory for you. This patch explicitly does a mkdir -p and chmod after adduser to make sure that required home directories exist.

tacl-xattr-symlink.patch:
-------------------------
This is an important fix to the test script. It was using the -L argument to getfattr to traverse symbolic links when dumping the ACLs from the test directory. This leads to unpredictable results because there was no way to tell whether getfattr would traverse a real directory or its symbolic link first (it depends on the dirent order) and the other would always be left out. ACLs are not supported on symbolic links anyway, so it was just adding noise to the test script.

xattr-symlink.patch:
-------------------------
This is the only change to PVFS2 itself. Like most Linux file systems, PVFS2 does not support xattrs on symbolic links (despite what is implied by man pages). This is due to the fact that symbolic links have 777 permissions by default that would allow anyone on the system to store xattrs in any symbolic link. This patch updates PVFS2 semantics slightly, however, to be more in line with how other file systems implement this. In particular listxattr() is now allowed (it just returns that there are zero entries), and setxattr() is implemented to return EPERM rather than EOPNOTSUPP.

-Phil
Index: pvfs2_src/test/automated/tacl_xattr.sh
===================================================================
--- pvfs2_src/test/automated/tacl_xattr.sh	(revision 2425)
+++ pvfs2_src/test/automated/tacl_xattr.sh	(revision 2426)
@@ -91,9 +91,17 @@
 CUR_PATH=`pwd`
 
 /usr/sbin/adduser -d $CUR_PATH/tacluser1 tacluser1
+mkdir -p $CUR_PATH/tacluser1
+chown tacluser1 $CUR_PATH/tacluser1
 /usr/sbin/adduser -d $CUR_PATH/tacluser2 tacluser2
+mkdir -p $CUR_PATH/tacluser2
+chown tacluser2 $CUR_PATH/tacluser2
 /usr/sbin/adduser -d $CUR_PATH/tacluser3 tacluser3
+mkdir -p $CUR_PATH/tacluser3
+chown tacluser3 $CUR_PATH/tacluser3
 /usr/sbin/adduser -d $CUR_PATH/tacluser4 tacluser4
+mkdir -p $CUR_PATH/tacluser4
+chown tacluser4 $CUR_PATH/tacluser4
 
 if [ ! -e shared ]
 then
Index: pvfs2_src/test/automated/tacl_xattr.sh
===================================================================
--- pvfs2_src/test/automated/tacl_xattr.sh	(revision 2426)
+++ pvfs2_src/test/automated/tacl_xattr.sh	(revision 2427)
@@ -702,10 +702,10 @@
 #
 #####################################################
 
-getfacl -RL shared > tmp1
+getfacl -RP shared > tmp1
 setfacl -m u::--- -m g::--- -m o::--- shared/team1
 setfacl --restore tmp1
-getfacl -RL shared > tmp2
+getfacl -RP shared > tmp2
 
 if [ `diff tmp1 tmp2` ]
 then 
Index: pvfs2_src/src/kernel/linux-2.6/symlink.c
===================================================================
--- pvfs2_src/src/kernel/linux-2.6/symlink.c	(revision 2441)
+++ pvfs2_src/src/kernel/linux-2.6/symlink.c	(revision 2442)
@@ -52,11 +52,15 @@
     follow_link : pvfs2_follow_link,
     setattr : pvfs2_setattr,
     revalidate : pvfs2_revalidate,
+#ifdef HAVE_XATTR
+    listxattr: pvfs2_listxattr,
+#endif
 #else
     .readlink = pvfs2_readlink,
     .follow_link = pvfs2_follow_link,
     .setattr = pvfs2_setattr,
     .getattr = pvfs2_getattr,
+    .listxattr = pvfs2_listxattr,
 #if defined(HAVE_GENERIC_GETXATTR) && defined(CONFIG_FS_POSIX_ACL)
     .permission = pvfs2_permission,
 #endif
Index: pvfs2_src/src/kernel/linux-2.6/xattr-default.c
===================================================================
--- pvfs2_src/src/kernel/linux-2.6/xattr-default.c	(revision 2442)
+++ pvfs2_src/src/kernel/linux-2.6/xattr-default.c	(revision 2443)
@@ -26,6 +26,11 @@
 
     if (strcmp(name, "") == 0)
         return -EINVAL;
+    if ( !S_ISREG(inode->i_mode) &&
+       (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
+    {
+       return -EPERM;
+    }
     gossip_debug(GOSSIP_XATTR_DEBUG, "pvfs2_setxattr_default %s\n", name);
     internal_flag = convert_to_internal_xattr_flags(flags);
     return pvfs2_inode_setxattr(inode, PVFS2_XATTR_NAME_DEFAULT_PREFIX,
Index: pvfs2_src/src/kernel/linux-2.6/symlink.c
===================================================================
--- pvfs2_src/src/kernel/linux-2.6/symlink.c	(revision 2442)
+++ pvfs2_src/src/kernel/linux-2.6/symlink.c	(revision 2443)
@@ -53,6 +53,7 @@
     setattr : pvfs2_setattr,
     revalidate : pvfs2_revalidate,
 #ifdef HAVE_XATTR
+    setxattr: pvfs2_setxattr,
     listxattr: pvfs2_listxattr,
 #endif
 #else
@@ -62,6 +63,11 @@
     .getattr = pvfs2_getattr,
     .listxattr = pvfs2_listxattr,
 #if defined(HAVE_GENERIC_GETXATTR) && defined(CONFIG_FS_POSIX_ACL)
+    .setxattr = generic_setxattr,
+#else
+    .setxattr = pvfs2_setxattr,
+#endif
+#if defined(HAVE_GENERIC_GETXATTR) && defined(CONFIG_FS_POSIX_ACL)
     .permission = pvfs2_permission,
 #endif
 #endif
_______________________________________________
Pvfs2-developers mailing list
Pvfs2-developers@beowulf-underground.org
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to