Skip to contentSkip to conversation

small intermezzo fixes

PATCH New Peter J. Braam 1 participant 1 message Nov 13, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 small intermezzo fixes

Hi Linus,

Can you apply the following small fixes against 2.4.14-pre4?

[They are fixes for a few error conditions which were handled wrongly.]

Thanks - and thanks for patching us in the tree!

- Peter -

fs/intermezzo/dcache.c renamed from fs/intermezzo.orig/dcache.c +8 -5
diff -ur linux/fs/intermezzo.orig/dcache.c linux/fs/intermezzo/dcache.c
@@ -52,9 +52,8 @@
 static void presto_d_release(struct dentry *dentry)
 {
         if (!presto_d2d(dentry)) {
-                printk("VERY BAD: dentry: %p\n", dentry);
-                if (dentry->d_inode)
-                        printk("    inode: %ld\n", dentry->d_inode->i_ino);
+                /* This should really only happen in the case of a dentry
+                 * with no inode. */
                 return;
         }
 
@@ -78,14 +77,18 @@
 void presto_set_dd(struct dentry * dentry)
 {
         ENTRY;
+        if (dentry == NULL)
+                BUG();
+
         if (dentry->d_fsdata) {
                 printk("VERY BAD: dentry: %p\n", dentry);
                 if (dentry->d_inode)
                         printk("    inode: %ld\n", dentry->d_inode->i_ino);
+                EXIT;
                 return;
         }
 
-        if (! dentry->d_inode) {
+        if (dentry->d_inode == NULL) {
                 dentry->d_fsdata = kmem_cache_alloc(presto_dentry_slab,
                                                     SLAB_KERNEL);
                 memset(dentry->d_fsdata, 0, sizeof(struct presto_dentry_data));
@@ -125,7 +128,7 @@
         presto_dentry_slab =
                 kmem_cache_create("presto_cache",
                                   sizeof(struct presto_dentry_data), 0,
-                                  SLAB_HWCACHE_ALIGN|SLAB_POISON, NULL,
+                                  SLAB_HWCACHE_ALIGN, NULL,
                                   NULL);
         EXIT;
 }
fs/intermezzo/dir.c renamed from fs/intermezzo.orig/dir.c +10 -1
diff -ur linux/fs/intermezzo.orig/dir.c linux/fs/intermezzo/dir.c
@@ -163,13 +163,20 @@
                 return ERR_PTR(-EPERM);
         }
         inode = iget(dir->i_sb, ino);
-        if (!inode || !inode->i_nlink || is_bad_inode(inode)) {
+        if (!inode || is_bad_inode(inode)) {
                 CDEBUG(D_PIOCTL, "fatal: invalid inode %ld (%s).\n",
                        ino, inode ? inode->i_nlink ? "bad inode" :
                        "no links" : "NULL");
                 error = -ENOENT;
                 EXIT;
                 goto cleanup_iput;
+        } else if (inode->i_nlink == 0) {
+                /* This is quite evil, but we have little choice.  If we were
+                 * to iput() again with i_nlink == 0, delete_inode would get
+                 * called again, which ext3 really Does Not Like. */
+                atomic_dec(&inode->i_count);
+                EXIT;
+                return ERR_PTR(-ENOENT);
         }
 
         /* We need to make sure we have the right inode (by checking the
@@ -185,6 +192,8 @@
         }
 
         d_instantiate(dentry, inode);
+        dentry->d_flags |= DCACHE_NFSD_DISCONNECTED; /* NFS hack */
+
         EXIT;
         return NULL;
 
fs/intermezzo/journal.c renamed from fs/intermezzo.orig/journal.c +2 -1
diff -ur linux/fs/intermezzo.orig/journal.c linux/fs/intermezzo/journal.c
@@ -106,7 +106,8 @@
         lock_kernel();
         
         if (size_check != inode->i_size) { 
-                fs_up(&inode->i_sem); 
+                unlock_kernel();
+                fs_up(&inode->i_sem);
                 EXIT;
                 return -EALREADY; 
         }
fs/intermezzo/journal_xfs.c renamed from fs/intermezzo.orig/journal_xfs.c +1 -1
diff -ur linux/fs/intermezzo.orig/journal_xfs.c linux/fs/intermezzo/journal_xfs.c
@@ -24,7 +24,7 @@
 #include <linux/intermezzo_kml.h>
 #include <linux/intermezzo_journal.h>
 
-#if defined(CONFIG_XFS_FS)
+#if 0
 
 /* XFS has journalling, but these functions do nothing yet... */
 
fs/intermezzo/methods.c renamed from fs/intermezzo.orig/methods.c +2 -1
diff -ur linux/fs/intermezzo.orig/methods.c linux/fs/intermezzo/methods.c
@@ -163,7 +163,8 @@
 
         if ( strlen(cache_type) == strlen("xfs") &&
              memcmp(cache_type, "xfs", strlen("xfs")) == 0 ) {
-#if defined(CONFIG_XFS_FS) || defined (CONFIG_XFS_FS_MODULE)
+#if 0
+                //#if defined(CONFIG_XFS_FS) || defined (CONFIG_XFS_FS_MODULE)
                 ops->o_trops = &presto_xfs_journal_ops;
 #else
                 ops->o_trops = NULL;
fs/intermezzo/presto.c renamed from fs/intermezzo.orig/presto.c +1 -0
diff -ur linux/fs/intermezzo.orig/presto.c linux/fs/intermezzo/presto.c
@@ -1035,6 +1035,7 @@
                 goto put_out;
         }
 
+	error = 0;
         cache = fset->fset_cache;
         cache->cache_flags &= ~CACHE_FSETROOT_SET;
 
fs/intermezzo/vfs.c renamed from fs/intermezzo.orig/vfs.c +7 -63

106 lines not on this page · raw message

include/linux/intermezzo_fs.h renamed from include/linux/intermezzo_fs.h.orig +0 -2
@@ -362,8 +362,6 @@
 int presto_do_rename(struct presto_file_set *fset, struct dentry *old_dir,
                      struct dentry *old_dentry, struct dentry *new_dir,
                      struct dentry *new_dentry, struct lento_vfs_context *info);
-int presto_do_statfs (struct presto_file_set *fset, 
-                      struct statfs * buf);
 
 int lento_setattr(const char *name, struct iattr *iattr,
                   struct lento_vfs_context *info);