[OpenAFS-devel] linux 2.4 stat failures

Chas Williams chas@cmf.nrl.navy.mil
Sat, 31 Mar 2001 13:31:20 -0500


ok, i think i finally got a handle on this stat problem last night.
looking at afs_linux_dentry_revalidate, it seems a little confused.
it seems to be basically a copy of afs_linux_revalidate which uses
slightly different semantics.  for dentry_revalidate 1 valid,
while 0 means failure.  but for revalidate_inode, 0 is success.
i was first puzzled by this when dentry->d_inode, 'negative dentry',
returned 0 when it should return 1 (look at the coda code for reference)
in order to clarify the code, i added the out_valid and out_bad tags.
also, the 'fast path' returned 0 as well.  i suppose it should return
valid, if the vnode state is Cstatd that means its in the cache right?  the
vcache2inode updates the attributes and everything is happy right?
another things that puzzles me though is that this routine prbobaly
should return 0 somtimes.  the result from afs_VerifyCache isnt checked
etc etc.  in fact, i suspect that this routine should just return 
out_bad instead of making the afs upcalls.  or at a mininum check
the returns codes and decide is out_valid or out_bad is ok.

comments anyone?

Index: osi_vnodeops.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.17
diff -u -u -r1.17 osi_vnodeops.c
--- osi_vnodeops.c	2001/02/23 12:26:48	1.17
+++ osi_vnodeops.c	2001/03/31 18:19:01
@@ -671,44 +681,46 @@
     struct vrequest treq;
     struct vcache *vcp = (struct vcache*)dp->d_inode;
 
+    /* If it's a negative dentry, then there's nothing to do. */
+    if (!vcp)
+	return 1;
+
     AFS_GLOCK();
 #ifdef AFS_LINUX24_ENV
     lock_kernel();
 #endif
 
-    /* If it's a negative dentry, then there's nothing to do. */
-    if (!vcp) {
-#ifdef AFS_LINUX24_ENV
-	unlock_kernel();
-#endif
-	AFS_GUNLOCK();
-	return 0;
-    }
 
     /* Make this a fast path (no crref), since it's called so often. */
     if (vcp->states & CStatd) {
         if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
 	    check_bad_parent(dp); /* check and correct mvid */
 	vcache2inode(vcp);
-#ifdef AFS_LINUX24_ENV
-	unlock_kernel();
-#endif
-	AFS_GUNLOCK();
-	return 0;
+	goto out_valid;
     }
 
     credp = crref();
     code = afs_InitReq(&treq, credp);
     if (!code)
 	code = afs_VerifyVCache(vcp, &treq);
+    crfree(credp);
 
+out_valid:
 #ifdef AFS_LINUX24_ENV
     unlock_kernel();
 #endif
     AFS_GUNLOCK();
-    crfree(credp);
-
     return 1;
+
+out_bad:
+#ifdef AFS_LINUX24_ENV
+    unlock_kernel();
+#endif
+    AFS_GUNLOCK();
+    return 0;
 }
 
 /* afs_dentry_iput */