diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/dir.c linux-2.6.5-rc1/fs/intermezzo/dir.c
--- linux-2.6.5-rc1/fs/intermezzo.orig/dir.c	2004-03-15 21:52:49.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/dir.c	2004-03-16 22:26:24.000000000 +0800
@@ -1300,13 +1300,9 @@
                 return rc;
         }
 
-        case TCGETS:
-                EXIT;
-                return -EINVAL;
-
         default:
                 EXIT;
-                return -EINVAL;
+                return -ENOTTY;
                 
         }
         EXIT;
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/file.c linux-2.6.5-rc1/fs/intermezzo/file.c
--- linux-2.6.5-rc1/fs/intermezzo.orig/file.c	2004-02-18 11:58:34.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/file.c	2004-03-15 22:25:09.000000000 +0800
@@ -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 { 
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
--- linux-2.6.5-rc1/fs/intermezzo.orig/fileset.c	2004-02-18 11:57:24.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/fileset.c	2004-03-15 22:29:48.000000000 +0800
@@ -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); 
 }
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_fs.h linux-2.6.5-rc1/fs/intermezzo/intermezzo_fs.h
--- linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_fs.h	2004-02-18 11:57:45.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/intermezzo_fs.h	2004-03-16 00:10:20.000000000 +0800
@@ -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;
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_kml.h linux-2.6.5-rc1/fs/intermezzo/intermezzo_kml.h
--- linux-2.6.5-rc1/fs/intermezzo.orig/intermezzo_kml.h	2004-02-18 12:00:00.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/intermezzo_kml.h	2004-03-16 00:10:35.000000000 +0800
@@ -41,7 +41,7 @@
         u32 fsgid;
         u32 opcode;
         u32 ngroups;
-        u32 groups[NGROUPS_MAX];
+        u32 groups[NGROUPS_SMALL];
 };
 
 enum kml_opcode {
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/journal.c linux-2.6.5-rc1/fs/intermezzo/journal.c
--- linux-2.6.5-rc1/fs/intermezzo.orig/journal.c	2004-02-18 11:57:12.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/journal.c	2004-03-16 00:11:06.000000000 +0800
@@ -309,7 +309,7 @@
                                        __u32 fsuid, __u32 fsgid)
 {
         struct kml_prefix_hdr p;
-        u32 loggroups[NGROUPS_MAX];
+        u32 loggroups[NGROUPS_SMALL];
 
         int i; 
 
@@ -332,15 +332,15 @@
 static inline char *
 journal_log_prefix(char *buf, int opcode, struct rec_info *rec)
 {
-        __u32 groups[NGROUPS_MAX]; 
+        __u32 groups[NGROUPS_SMALL]; 
         int i; 
 
         /* convert 16 bit gid's to 32 bit gid's */
-        for (i=0; i<current->ngroups; i++) 
-                groups[i] = (__u32) current->groups[i];
+        for (i=0; i<current->group_info->ngroups; i++) 
+                groups[i] = GROUP_AT(current->group_info,i);
         
         return journal_log_prefix_with_groups_and_ids(buf, opcode, rec,
-                                                      (__u32)current->ngroups,
+                                                      (__u32)current->group_info->ngroups,
                                                       groups,
                                                       (__u32)current->fsuid,
                                                       (__u32)current->fsgid);
@@ -1319,7 +1319,7 @@
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
         ino = cpu_to_le64(dentry->d_inode->i_ino);
         generation = cpu_to_le32(dentry->d_inode->i_generation);
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + sizeof(*new_file_ver) +
                 sizeof(ino) + sizeof(generation) + sizeof(pathlen) +
                 sizeof(remote_ino) + sizeof(remote_generation) + 
@@ -1529,7 +1529,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + sizeof(*old_ver) +
                 sizeof(valid) + sizeof(mode) + sizeof(uid) + sizeof(gid) +
                 sizeof(fsize) + sizeof(mtime) + sizeof(ctime) + sizeof(flags) +
@@ -1600,7 +1600,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + sizeof(pathlen) +
                 size_round(le32_to_cpu(pathlen)) +
                 sizeof(struct kml_suffix);
@@ -1659,7 +1659,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
                 sizeof(struct kml_suffix);
@@ -1715,7 +1715,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
                 sizeof(targetlen) + sizeof(struct kml_suffix);
@@ -1773,7 +1773,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->ngroups + 
+        size = sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
                 sizeof(struct kml_suffix);
@@ -1828,7 +1828,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dir, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
                 sizeof(struct kml_suffix);
@@ -1891,7 +1891,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dentry, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->ngroups + 
+        size = sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(lmajor) +
                 sizeof(lminor) + sizeof(pathlen) +
@@ -1951,7 +1951,7 @@
         BUFF_ALLOC(buffer, srcbuffer);
         path = presto_path(tgt, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(srcpathlen) + sizeof(pathlen) +
                 sizeof(struct kml_suffix);
@@ -2009,7 +2009,7 @@
         BUFF_ALLOC(buffer, srcbuffer);
         path = presto_path(tgt, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 4 * sizeof(*src_dir_ver) +
                 sizeof(srcpathlen) + sizeof(pathlen) +
                 sizeof(struct kml_suffix);
@@ -2069,7 +2069,7 @@
         BUFF_ALLOC(buffer, NULL);
         path = presto_path(dir, root, buffer, PAGE_SIZE);
         pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->ngroups + 
+        size = sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
                 sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
                 sizeof(old_targetlen) + sizeof(struct kml_suffix);
@@ -2116,7 +2116,7 @@
         __u32 open_fsuid;
         __u32 open_fsgid;
         __u32 open_ngroups;
-        __u32 open_groups[NGROUPS_MAX];
+        __u32 open_groups[NGROUPS_SMALL];
         __u32 open_mode;
         __u32 open_uid;
         __u32 open_gid;
@@ -2146,9 +2146,9 @@
                 open_fsuid = fd->fd_fsuid;
                 open_fsgid = fd->fd_fsgid;
         } else {
-                open_ngroups = current->ngroups;
-                for (i=0; i<current->ngroups; i++)
-                        open_groups[i] =  (__u32) current->groups[i]; 
+                open_ngroups = current->group_info->ngroups;
+                for (i=0; i<current->group_info->ngroups; i++)
+                        open_groups[i] =  (__u32) GROUP_AT(current->group_info,i); 
                 open_mode = dentry->d_inode->i_mode;
                 open_uid = dentry->d_inode->i_uid;
                 open_gid = dentry->d_inode->i_gid;
@@ -2246,7 +2246,7 @@
 /* write closes for the local close records in the LML */ 
 int presto_complete_lml(struct presto_file_set *fset)
 {
-        __u32 groups[NGROUPS_MAX];
+        __u32 groups[NGROUPS_SMALL];
         loff_t lml_offset;
         loff_t read_offset; 
         char *buffer;
@@ -2408,7 +2408,7 @@
          */
         mode=cpu_to_le32(dentry->d_inode->i_mode);
 
-        size =  sizeof(__u32) * current->ngroups + 
+        size =  sizeof(__u32) * current->group_info->ngroups + 
                 sizeof(struct kml_prefix_hdr) + 
                 2 * sizeof(struct presto_version) +
                 sizeof(flags) + sizeof(mode) + sizeof(namelen) + 
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/kml_reint.c linux-2.6.5-rc1/fs/intermezzo/kml_reint.c
--- linux-2.6.5-rc1/fs/intermezzo.orig/kml_reint.c	2004-02-18 11:59:20.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/kml_reint.c	2004-03-16 00:08:48.000000000 +0800
@@ -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);
 }
diff -urN linux-2.6.5-rc1/fs/intermezzo.orig/vfs.c linux-2.6.5-rc1/fs/intermezzo/vfs.c
--- linux-2.6.5-rc1/fs/intermezzo.orig/vfs.c	2004-02-18 11:57:22.000000000 +0800
+++ linux-2.6.5-rc1/fs/intermezzo/vfs.c	2004-03-16 22:30:04.000000000 +0800
@@ -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);
--- linux-2.6.5-rc1/fs/Kconfig.orig	2004-03-15 21:52:48.000000000 +0800
+++ linux-2.6.5-rc1/fs/Kconfig	2004-03-16 22:17:55.000000000 +0800
@@ -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