[PVFS2-CVS] commit by robl in pvfs2-1/src/kernel/linux-2.6: pvfs2-utils.c

CVS commit program cvs at parl.clemson.edu
Wed Jun 8 16:30:30 EDT 2005


Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv10560/src/kernel/linux-2.6

Modified Files:
	pvfs2-utils.c 
Log Message:
Merge in all of phil's patches fixing up permissions checking as described
here:
http://www.parl.clemson.edu/pipermail/pvfs2-developers/2005-June/001258.html


Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -u -w -p -u -r1.95 -r1.96
--- pvfs2-utils.c	3 Dec 2004 19:16:10 -0000	1.95
+++ pvfs2-utils.c	8 Jun 2005 19:30:30 -0000	1.96
@@ -214,21 +214,8 @@ static inline void convert_attribute_mod
     pvfs2_print("mode is %d | translated perms is %d\n", mode,
                 attrs->perms);
 
-    switch(mode & S_IFMT)
-    {
-        case S_IFREG:
-            attrs->objtype = PVFS_TYPE_METAFILE;
-            attrs->mask |= PVFS_ATTR_SYS_TYPE;
-            break;
-        case S_IFDIR:
-            attrs->objtype = PVFS_TYPE_DIRECTORY;
-            attrs->mask |= PVFS_ATTR_SYS_TYPE;
-            break;
-        case S_IFLNK:
-            attrs->objtype = PVFS_TYPE_SYMLINK;
-            attrs->mask |= PVFS_ATTR_SYS_TYPE;
-            break;
-    }
+    /* NOTE: this function only called during setattr.  Setattr must not mess
+     * with object type */
 }
 
 /*
@@ -275,9 +262,9 @@ static inline int copy_attributes_from_i
              pvfs2_convert_time_field((void *)&inode->i_ctime));
         attrs->mask |= PVFS_ATTR_SYS_CTIME;
 
-        attrs->size = ((iattr && (iattr->ia_valid & ATTR_SIZE)) ?
-                       iattr->ia_size : inode->i_size);
-        attrs->mask |= PVFS_ATTR_SYS_SIZE;
+        /* PVFS2 cannot set size with a setattr operation.  Probably not likely
+         * to be requested through the VFS, but just in case, don't worry about
+         * ATTR_SIZE */
 
         if (iattr && (iattr->ia_valid & ATTR_MODE))
         {
@@ -291,7 +278,10 @@ static inline int copy_attributes_from_i
             convert_attribute_mode_to_pvfs_sys_attr(
                 inode->i_mode, attrs);
         }
-        attrs->mask = PVFS_ATTR_SYS_ALL_SETABLE;
+
+        /* we carefully selected which bits to set in attrs->mask above, so
+         * don't undo all that work by setting attrs->mask to
+         * PVFS_ATTR_SYS_ALL_SETABLE */
 
         ret = 0;
     }



More information about the PVFS2-CVS mailing list