Skip to contentSkip to conversation

InterMezzo Maintenance Patch

PATCH New Yang, Chen 1 participant 1 message Mar 20, 2004 VFS

lore
Share & tools
lore

Yang, Chen

author
#0 lore raw

PATCH 1/1 InterMezzo Maintenance Patch

Hi, All:
Below is the patch of InterMezzo against 2.6.5-rc1.
I can confirm that it's effective.
Main modification:
Chen Yang's fix to work with NGROUPS
Chen Yang's fix to handle file deletion
Remove TCGETS handling and return -ENOTTY for unknown ioctl code. Removed InterMezzo from BROKEN state
Thanks.
--
Yang, Chen

fs/intermezzo/dir.c renamed from fs/intermezzo.orig/dir.c +1 -5
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/dir.c linux-2.6.5-rc1/fs/intermezzo/dir.c
@@ -1300,13 +1300,9 @@
                 return rc;
         }
 
-        case TCGETS:
-                EXIT;
-                return -EINVAL;
-
         default:
                 EXIT;
-                return -EINVAL;
+                return -ENOTTY;
                 
         }
         EXIT;
fs/intermezzo/file.c renamed from fs/intermezzo.orig/file.c +3 -3
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/file.c linux-2.6.5-rc1/fs/intermezzo/file.c
@@ -217,9 +217,9 @@
                 fdata->fd_mode = file->f_dentry->d_inode->i_mode;
                 fdata->fd_uid = file->f_dentry->d_inode->i_uid;
                 fdata->fd_gid = file->f_dentry->d_inode->i_gid;
-                fdata->fd_ngroups = current->ngroups;
-                for (i=0 ; i < current->ngroups ; i++)
-                        fdata->fd_groups[i] = current->groups[i];
+                fdata->fd_ngroups = current->group_info->ngroups;
+                for (i=0 ; i < current->group_info->ngroups ; i++)
+                        fdata->fd_groups[i] = GROUP_AT(current->group_info,i);
                 if (!ISLENTO(minor)) 
                         fdata->fd_info.flags = LENTO_FL_KML; 
                 else { 
fs/intermezzo/fileset.c renamed from fs/intermezzo.orig/fileset.c +1 -1
diff --exclude='*.cmd' --exclude='*.o' -urN linux-2.6.5-rc1/fs/intermezzo.orig/fileset.c linux-2.6.5-rc1/fs/intermezzo/fileset.c
@@ -418,7 +418,7 @@
         new.fsgid = 0;
         new.fs = get_fs(); 
         /* XXX where can we get the groups from? */
-        new.ngroups = 0;
+        new.group_info = groups_alloc(0);
 
         push_ctxt(save, &new); 
 }
fs/intermezzo/intermezzo_fs.h renamed from fs/intermezzo.orig/intermezzo_fs.h +13 -11
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_fs.h linux-2.6.5-rc1/fs/intermezzo/intermezzo_fs.h
@@ -152,14 +152,14 @@
         uid_t            fsuid;
         gid_t            fsgid;
         mm_segment_t     fs;
-	int              ngroups;
-	gid_t	         groups[NGROUPS];
+        struct group_info * group_info;
+/*	int              ngroups;
+	gid_t	         groups[NGROUPS];*/
 
 };
 
 static inline void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
 {
-        int i;
         save->fs = get_fs();
         save->pwd = dget(current->fs->pwd);
         save->pwdmnt = mntget(current->fs->pwdmnt);
@@ -167,9 +167,10 @@
         save->fsuid = current->fsuid;
         save->root = current->fs->root;
         save->rootmnt = current->fs->rootmnt;
-        save->ngroups = current->ngroups;
+        save->group_info = current->group_info;
+/*      save->ngroups = current->ngroups;
         for (i = 0; i< current->ngroups; i++) 
-                save->groups[i] = current->groups[i];
+                save->groups[i] = current->groups[i];*/
 
         set_fs(new->fs);
         lock_kernel();
@@ -179,18 +180,17 @@
         unlock_kernel();
         current->fsuid = new->fsuid;
         current->fsgid = new->fsgid;
-        if (new->ngroups > 0) {
+        /*if (new->ngroups > 0) {
                 current->ngroups = new->ngroups;
                 for (i = 0; i< new->ngroups; i++) 
                         current->groups[i] = new->groups[i];
-        }
+        }*/
+        current->group_info = new->group_info;
         
 }
 
 static inline void pop_ctxt(struct run_ctxt *saved)
 {
-        int i;
-
         set_fs(saved->fs);
         lock_kernel();
         set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
@@ -199,10 +199,12 @@
         unlock_kernel();
         current->fsuid = saved->fsuid;
         current->fsgid = saved->fsgid;
+        current->group_info = saved->group_info;
+/*
         current->ngroups = saved->ngroups;
         for (i = 0; i< saved->ngroups; i++) 
                 current->groups[i] = saved->groups[i];
-
+*/
         mntput(saved->pwdmnt);
         dput(saved->pwd);
 }
@@ -392,7 +394,7 @@
         uid_t fd_fsuid;
         gid_t fd_fsgid;
         int fd_ngroups;
-        gid_t fd_groups[NGROUPS_MAX];
+        gid_t fd_groups[NGROUPS_SMALL];
         /* information how to complete the close operation */
         struct lento_vfs_context fd_info;
         struct presto_version fd_version;
fs/intermezzo/intermezzo_kml.h renamed from fs/intermezzo.orig/intermezzo_kml.h +1 -1
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_kml.h linux-2.6.5-rc1/fs/intermezzo/intermezzo_kml.h
@@ -41,7 +41,7 @@
         u32 fsgid;
         u32 opcode;
         u32 ngroups;
-        u32 groups[NGROUPS_MAX];
+        u32 groups[NGROUPS_SMALL];
 };
 
 enum kml_opcode {
fs/intermezzo/journal.c renamed from fs/intermezzo.orig/journal.c +22 -22

151 lines not on this page · raw message

fs/intermezzo/kml_reint.c renamed from fs/intermezzo.orig/kml_reint.c +4 -4
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/kml_reint.c linux-2.6.5-rc1/fs/intermezzo/kml_reint.c
@@ -53,11 +53,11 @@
         ctxt.root = ctxt.pwd;
         ctxt.rootmnt = ctxt.pwdmnt;
         if (rec->prefix.hdr->ngroups > 0) {
-                ctxt.ngroups = rec->prefix.hdr->ngroups;
-                for (i = 0; i< ctxt.ngroups; i++) 
-                        ctxt.groups[i] = rec->prefix.groups[i];
+                ctxt.group_info = groups_alloc(rec->prefix.hdr->ngroups);
+                for (i = 0; i< ctxt.group_info->ngroups; i++) 
+                        GROUP_AT(ctxt.group_info,i)= rec->prefix.groups[i];
         } else
-                ctxt.ngroups = 0;
+                ctxt.group_info = groups_alloc(0);
 
         push_ctxt(saved, &ctxt);
 }
fs/intermezzo/vfs.c renamed from fs/intermezzo.orig/vfs.c +2 -6
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/vfs.c linux-2.6.5-rc1/fs/intermezzo/vfs.c
@@ -965,8 +965,6 @@
                 do_rcvd = presto_do_rcvd(info, dir);
                 error = iops->unlink(dir->d_inode, dentry);
                 unlock_kernel();
-                if (!error)
-                        d_delete(dentry);
         }
 
         if (linkno > 1) { 
@@ -988,10 +986,6 @@
         }
 
         //        up(&dir->d_inode->i_zombie);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
 
         presto_debug_fail_blkdev(fset, KML_OPCODE_UNLINK | 0x10);
         if ( do_kml )
@@ -1048,6 +1042,8 @@
                 if (nd.last.name[nd.last.len])
                         goto slashes;
                 error = presto_do_unlink(fset, nd.dentry, dentry, info);
+                if (!error)
+                        d_delete(dentry);
         exit2:
                 EXIT;
                 dput(dentry);
fs/Kconfig renamed from fs/Kconfig.orig +1 -1
@@ -1585,7 +1587,7 @@
 #
 config INTERMEZZO_FS
 	tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)"
-	depends on INET && EXPERIMENTAL && BROKEN
+	depends on INET && EXPERIMENTAL 
 	help
 	  InterMezzo is a networked file system with disconnected operation
 	  and kernel level write back caching.  It is most often used for