kernel-lookup-err.patch:
------------------------
This updates the kernel module to allow other error messages besides ENOENT to propigate out of the lookup function. This is particularly helpful if the file system goes down- some access that would previously report "no such file or directory" on the client side are now more likely to report "connection refused" or something along those lines. ENOENT is only used when the server actually confirms that the entry isn't there.

kernel-ro-2.4.patch:
--------------------
The mount.pvfs2 utility (only used on 2.4 kernel systems) was failing to parse and use the "ro" mount option.

kernel-root-chmod.patch:
---------------------
The current PVFS2 semantics make the root directory of the file system "sticky" automatically. However, an error code was returned if you issued a chmod that tried to set the root directory sticky. That means that you would need to issue a chmod 777 (for example) to get the permissions to 1777. Some chmod command line programs balk at this because they confirm the correct permissions after setting them. This patch fixes it by allowing the sticky bit to be set on the root directory (and the root only) so there is no mismatch between the set permissions and the resulting permissions. The sticky bit is hidden in the kernel module since the server's don't typically understand this mode.

mount-pvfs2-dup-mnt.patch:
----------------------
This is another fix to the mount command that only affects 2.4 kernel systems. The setup is to mount a PVFS2 file system on a particular directory, and then mount another PVFS2 file system (or the same one) on top of the same directory. That much works fine. However, when you unmount the outermost file system, both disappear from the mount listing, although the second one is really still there. This is actually a bug that is present in PVFS1 and just came along for the ride when the mount.pvfs command was ported to mount.pvfs2.



Index: pvfs2_src/src/kernel/linux-2.6/namei.c
===================================================================
--- pvfs2_src/src/kernel/linux-2.6/namei.c	(revision 1560)
+++ pvfs2_src/src/kernel/linux-2.6/namei.c	(revision 1561)
@@ -224,7 +224,14 @@
     }
 
     op_release(new_op);
-    return NULL;
+    if(ret != -ENOENT)
+    {
+        return ERR_PTR(ret);
+    }
+    else
+    {
+        return NULL;
+    }
 }
 
 /* return 0 on success; non-zero otherwise */
Index: pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c
===================================================================
--- pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c	(revision 1588)
+++ pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c	(revision 1589)
@@ -43,6 +43,7 @@
 static int parse_args(
     int argc,
     char *argv[],
+    int* flags,
     char **dev,
     char **mntpnt,
     char **kern_options,
@@ -66,7 +67,7 @@
         return (-1);
     }
 
-    if ((ret = parse_args(argc, argv, &dev, &tmp_mntpnt, &kern_options,
+    if ((ret = parse_args(argc, argv, &flags, &dev, &tmp_mntpnt, &kern_options,
         &orig_options)))
     {
         fprintf(stderr, "Error: could not parse command line arguments.\n");
@@ -138,6 +139,7 @@
 static int parse_args(
     int argc,
     char *argv[],
+    int *flags,
     char **dev,
     char **mntpnt,
     char **kern_options,
@@ -145,6 +147,8 @@
 {
     int opt;
     int opts_set_flag = 0;
+    char mopts[256] = "";
+    char* index;
 
     /* safety */
     *dev = NULL;
@@ -158,6 +162,12 @@
         switch (opt)
         {
         case 'o':
+
+            if(strlen(optarg) > 255)
+            {
+                fprintf(stderr, "Error: options string is too long.\n");
+                return(-1);
+            }
             if(opts_set_flag)
             {
                 fprintf(stderr, "Error: please use only one -o argument.\n");
@@ -171,6 +181,20 @@
             }
             opts_set_flag = 1;
             strcpy(*orig_options, optarg);
+
+            /* copy into another temporary buffer for strtok */
+            strcpy(mopts, optarg);
+            index = strtok(mopts, ",");
+            while(index != NULL)
+            {
+                /* find out if "ro" was specified and set flag appropriately */
+                if(!strcmp(index, "ro"))
+                {
+                    *flags |= MS_RDONLY;
+                }
+                index = strtok(NULL, ",");
+            }
+
             break;
         default:
             fprintf(stderr, "Error: argument format is incorrect.\n");
Index: pvfs2_src/src/kernel/linux-2.6/pvfs2-utils.c
===================================================================
--- pvfs2_src/src/kernel/linux-2.6/pvfs2-utils.c	(revision 1583)
+++ pvfs2_src/src/kernel/linux-2.6/pvfs2-utils.c	(revision 1584)
@@ -256,6 +256,7 @@
     struct iattr *iattr)
 {
     int ret = -1;
+    umode_t tmp_mode;
 
     if (inode && attrs)
     {
@@ -296,29 +297,40 @@
 
         if (iattr && (iattr->ia_valid & ATTR_MODE))
         {
-            pvfs2_print("[1] converting attr mode %d\n", iattr->ia_mode);
-            if((iattr->ia_mode & (S_ISUID|S_ISVTX)) != 0)
-            {
-                pvfs2_print("User attempted to set setuid or sticky bit; "
-                    "returning EINVAL.\n");
-                return(-EINVAL);
-            }
-            convert_attribute_mode_to_pvfs_sys_attr(
-                iattr->ia_mode, attrs);
+            tmp_mode = iattr->ia_mode;
         }
         else
         {
-            pvfs2_print("[2] converting attr mode %d\n", inode->i_mode); 
-            if((inode->i_mode & (S_ISUID|S_ISVTX)) != 0)
+            tmp_mode = inode->i_mode;
+        }
+
+        if (tmp_mode & (S_ISVTX))
+        {
+            if(inode->i_ino == PVFS2_SB(inode->i_sb)->root_handle)
             {
-                pvfs2_print("User attempted to set setuid or sticky bit; "
-                    "returning EINVAL.\n");
+                /* allow sticky bit to be set on root (since it shows up that
+                 * way by default anyhow), but don't show it to
+                 * the server
+                 */
+                tmp_mode -= S_ISVTX;
+            }
+            else
+            {
+                pvfs2_print("User attempted to set sticky bit on non-root "
+                    "directory; returning EINVAL.\n");
                 return(-EINVAL);
             }
-            convert_attribute_mode_to_pvfs_sys_attr(
-                inode->i_mode, attrs);
         }
+        if (tmp_mode & (S_ISUID))
+        {
+            pvfs2_print("User attempted to set setuid bit; "
+                "returning EINVAL.\n");
+            return(-EINVAL);
+        }
 
+        convert_attribute_mode_to_pvfs_sys_attr(
+            tmp_mode, attrs);
+
         /* 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 */
Index: pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c
===================================================================
--- pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c	(revision 1499)
+++ pvfs2_src/src/apps/kernel/linux/mount.pvfs2.c	(revision 1500)
@@ -270,15 +270,12 @@
 
     while ((ment = getmntent(mtab)) != NULL)
     {
-        if (strcmp(myment->mnt_dir, ment->mnt_dir) != 0)
+        if (addmntent(tmp_mtab, ment) == 1)
         {
-            if (addmntent(tmp_mtab, ment) == 1)
-            {
-                fprintf(stderr, "Error: couldn't add entry to" PVFS2_TMP_MTAB "\n");
-                endmntent(mtab);
-                endmntent(tmp_mtab);
-                return -1;
-            }
+            fprintf(stderr, "Error: couldn't add entry to" PVFS2_TMP_MTAB "\n");
+            endmntent(mtab);
+            endmntent(tmp_mtab);
+            return -1;
         }
     }
 
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to