[OpenAFS] 1.3.84 oops & kernel panic

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Fri, 10 Jun 2005 11:07:17 -0400


In message <Pine.LNX.4.62.0506100956370.496@tassadar.physics.auth.gr>,Dimitris Zilaskos writes:
>Jun 10 05:00:07 system kernel: kernel BUG at inode.c:1204!

lets try again.  i forgot why the fix worked for 2.6.  this should
get it.  AFS_GLOCK needs to held during the i_state/I_CLEAR changes
so that another afs hold/rele cycle cant jump in and see the i_state
flag changing.

Index: src/afs/LINUX/osi_machdep.h
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_machdep.h,v
retrieving revision 1.22.2.9
diff -u -u -r1.22.2.9 osi_machdep.h
--- src/afs/LINUX/osi_machdep.h	8 May 2005 05:48:40 -0000	1.22.2.9
+++ src/afs/LINUX/osi_machdep.h	10 Jun 2005 14:56:48 -0000
@@ -82,7 +82,7 @@
 #define VN_HOLD(V) ((vnode_t *) V)->i_count++
 #endif
 
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX24_ENV)
 #define VN_RELE(V) iput((struct inode *) V)
 #else
 #define VN_RELE(V) osi_iput((struct inode *) V)
Index: src/afs/LINUX/osi_misc.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_misc.c,v
retrieving revision 1.34.2.8
diff -u -u -r1.34.2.8 osi_misc.c
--- src/afs/LINUX/osi_misc.c	28 Apr 2005 03:11:51 -0000	1.34.2.8
+++ src/afs/LINUX/osi_misc.c	10 Jun 2005 14:56:48 -0000
@@ -363,6 +363,7 @@
     }
 }
 
+#if !defined(AFS_LINUX24_ENV)
 void
 osi_clear_inode(struct inode *ip)
 {
@@ -390,7 +391,6 @@
     crfree(credp);
 }
 
-#if !defined(AFS_LINUX26_ENV)
 /* iput an inode. Since we still have a separate inode pool, we don't want
  * to call iput on AFS inodes, since they would then end up on Linux's
  * inode_unsed list.
Index: src/afs/LINUX/osi_vfsops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v
retrieving revision 1.29.2.4
diff -u -u -r1.29.2.4 osi_vfsops.c
--- src/afs/LINUX/osi_vfsops.c	5 Jun 2005 15:34:42 -0000	1.29.2.4
+++ src/afs/LINUX/osi_vfsops.c	10 Jun 2005 14:56:48 -0000
@@ -287,19 +287,17 @@
 #endif
 }
 
-#if defined(AFS_LINUX26_ENV)
-static void
-afs_drop_inode(struct inode *ip)
-{
-	generic_delete_inode(ip);
-	AFS_GUNLOCK();		/* locked by afs_delete_inode() */
-}
-#endif
-
 static void
 afs_destroy_inode(struct inode *ip)
 {
+    cred_t *credp = crref();
+
+    /* locked by clear_inode() */
+    put_inode_on_dummy_list(ip);
     ip->i_state = 0;
+    afs_InactiveVCache(ITOAFS(ip), credp);		/* afs_FlushVCache()? */
+    AFS_GUNLOCK();
+    crfree(credp);
 }
 
 
@@ -310,19 +308,21 @@
  * That will trigger the call to delete routine.
  */
 
+#if defined(AFS_LINUX24_ENV)
 static void
-afs_delete_inode(struct inode *ip)
+afs_clear_inode(struct inode *ip)
 {
-#if defined(AFS_LINUX26_ENV)
-    AFS_GLOCK();		/* after spin_unlock(inode_lock) */
-    put_inode_on_dummy_list(ip);
-    osi_clear_inode(ip);
+    AFS_GLOCK();	/* unlocked by destroy_inode() */
+}
 #else
+static void
+afs_delete_inode(struct inode *ip)
+{
     AFS_GLOCK();
     osi_clear_inode(ip);
     AFS_GUNLOCK();
-#endif
 }
+#endif
 
 
 /* afs_put_super
@@ -413,11 +413,12 @@
 }
 
 struct super_operations afs_sops = {
-#if defined(AFS_LINUX26_ENV)
-  .drop_inode =		afs_drop_inode,
+#if defined(AFS_LINUX24_ENV)
   .destroy_inode =	afs_destroy_inode,
-#endif
+  .clear_inode =	afs_clear_inode,
+#else
   .delete_inode =	afs_delete_inode,
+#endif
   .write_inode =	afs_write_inode,
   .put_super =		afs_put_super,
   .statfs =		afs_statfs,
Index: src/afs/LINUX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.81.2.23
diff -u -u -r1.81.2.23 osi_vnodeops.c
--- src/afs/LINUX/osi_vnodeops.c	31 May 2005 21:12:51 -0000	1.81.2.23
+++ src/afs/LINUX/osi_vnodeops.c	10 Jun 2005 14:56:48 -0000
@@ -950,7 +950,7 @@
     goto done;
 }
 
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX24_ENV)
 /* afs_dentry_iput */
 static void
 afs_dentry_iput(struct dentry *dp, struct inode *ip)
@@ -971,7 +971,7 @@
 struct dentry_operations afs_dentry_operations = {
   .d_revalidate =	afs_linux_dentry_revalidate,
   .d_delete =		afs_dentry_delete,
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX24_ENV)
   .d_iput =		afs_dentry_iput,
 #endif
 };