? src/kernel/linux-2.6/.dcache.c.swp
? src/kernel/linux-2.6/.pvfs2-utils.c.swp
Index: src/kernel/linux-2.6/dcache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/dcache.c,v
retrieving revision 1.38
diff -u -a -p -r1.38 dcache.c
--- src/kernel/linux-2.6/dcache.c	1 Feb 2008 17:03:41 -0000	1.38
+++ src/kernel/linux-2.6/dcache.c	25 Mar 2008 19:00:50 -0000
@@ -17,105 +17,125 @@
 static int pvfs2_d_revalidate_common(struct dentry* dentry)
 {
     int ret = 0;
-    struct inode *inode = (dentry ? dentry->d_inode : NULL);
+    struct inode *inode;
     struct inode *parent_inode = NULL; 
     pvfs2_kernel_op_t *new_op = NULL;
     pvfs2_inode_t *parent = NULL;
 
-    gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: called on dentry %p.\n", dentry);
+    gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: called on dentry %p.\n",
+                 __func__, dentry);
 
-    /* find parent inode */
-    if(dentry && dentry->d_parent)
+    /* find inode from dentry */
+    if(!dentry || !dentry->d_inode)
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: parent found.\n");
-        parent_inode = dentry->d_parent->d_inode;
+        gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: inode not valid.\n", __func__);
+        return 0;
     }
-    else
+
+    gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: inode valid.\n", __func__);
+    inode = dentry->d_inode;
+
+    /* find parent inode */
+    if(!dentry || !dentry->d_parent)
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: parent not found.\n");
+        gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: parent not found.\n", __func__);
+        return 0; /* not valid */
     }
-    
-    if (inode && parent_inode)
+
+    gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: parent found.\n", __func__);
+    parent_inode = dentry->d_parent->d_inode;
+
+    /* first perform a lookup to make sure that the object not only
+     * exists, but is still in the expected place in the name space 
+     */
+    if (!is_root_handle(inode))
     {
-        /* first perform a lookup to make sure that the object not only
-         * exists, but is still in the expected place in the name space 
-         */
-        if (!is_root_handle(inode))
+        gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__);
+        new_op = op_alloc(PVFS2_VFS_OP_LOOKUP);
+        if (!new_op)
+        {
+            return 0;
+        }
+        new_op->upcall.req.lookup.sym_follow = PVFS2_LOOKUP_LINK_NO_FOLLOW;
+        parent = PVFS2_I(parent_inode);
+        if (parent && parent->refn.handle != PVFS_HANDLE_NULL &&
+            parent->refn.fs_id != PVFS_FS_ID_NULL)
+        {
+            new_op->upcall.req.lookup.parent_refn = parent->refn;
+        }
+        else
         {
-            gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: attempting lookup.\n");
-            new_op = op_alloc(PVFS2_VFS_OP_LOOKUP);
-            if (!new_op)
-            {
-                return 0;
-            }
-            new_op->upcall.req.lookup.sym_follow = PVFS2_LOOKUP_LINK_NO_FOLLOW;
-            parent = PVFS2_I(parent_inode);
-            if (parent && parent->refn.handle != PVFS_HANDLE_NULL && parent->refn.fs_id != PVFS_FS_ID_NULL)
-            {
-                new_op->upcall.req.lookup.parent_refn = parent->refn;
-            }
-            else
-            {
 #if defined(HAVE_IGET4_LOCKED) || defined(HAVE_IGET5_LOCKED)
-                gossip_lerr("Critical error: i_ino cannot be relied upon when using iget5/iget4\n");
-                op_release(new_op);
-                return 0;
-#endif
-                new_op->upcall.req.lookup.parent_refn.handle =
-                    get_handle_from_ino(parent_inode);
-                new_op->upcall.req.lookup.parent_refn.fs_id =
-                    PVFS2_SB(parent_inode->i_sb)->fs_id;
-            }
-            strncpy(new_op->upcall.req.lookup.d_name,
-                    dentry->d_name.name, PVFS2_NAME_LEN);
-
-            ret = service_operation(
-                new_op, "pvfs2_lookup", 
-                get_interruptible_flag(parent_inode));
-
-            if((new_op->downcall.status != 0) || 
-                    !match_handle(new_op->downcall.resp.lookup.refn.handle, inode))
-            {
-                gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: lookup failure or no match.\n");
-                op_release(new_op);
-                /* mark the inode as bad so that d_delete will be aggressive
-                 * about dropping the dentry
-                 */
-                pvfs2_make_bad_inode(inode);
-                return(0);
-            }
-            
+            gossip_lerr("Critical error: i_ino cannot be relied "
+                        "upon when using iget5/iget4\n");
             op_release(new_op);
+            return 0;
+#endif
+            new_op->upcall.req.lookup.parent_refn.handle =
+                get_handle_from_ino(parent_inode);
+            new_op->upcall.req.lookup.parent_refn.fs_id =
+                PVFS2_SB(parent_inode->i_sb)->fs_id;
         }
-        else
+        strncpy(new_op->upcall.req.lookup.d_name,
+                dentry->d_name.name, PVFS2_NAME_LEN);
+
+        ret = service_operation(
+            new_op, "pvfs2_lookup", 
+            get_interruptible_flag(parent_inode));
+
+        if((new_op->downcall.status != 0) || 
+           !match_handle(new_op->downcall.resp.lookup.refn.handle, inode))
         {
-            gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: root handle, lookup skipped.\n");
+            gossip_debug(
+                GOSSIP_DCACHE_DEBUG,
+                "%s: lookup failure or no match.\n", __func__);
+            op_release(new_op);
+            /* mark the inode as bad so that d_delete will be aggressive
+             * about dropping the dentry
+             */
+            pvfs2_make_bad_inode(inode);
+            return 0;
         }
 
-        /* now perform revalidation */
-        gossip_debug(GOSSIP_DCACHE_DEBUG, " (inode %llu)\n",
-                    llu(get_handle_from_ino(inode)));
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_revalidate_common: calling pvfs2_internal_revalidate().\n");
-        ret = pvfs2_internal_revalidate(inode);
+        op_release(new_op);
     }
     else
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "\n");
+        gossip_debug(GOSSIP_DCACHE_DEBUG,
+                     "%s: root handle, lookup skipped.\n", __func__);
     }
-    return ret;
+
+    /* now perform getattr */
+    gossip_debug(GOSSIP_DCACHE_DEBUG,
+                 "%s: doing getattr: inode: %p, handle: %llu)\n",
+                 __func__, inode, llu(get_handle_from_ino(inode)));
+    mutex_lock(&inode->i_mutex);
+    ret = pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT);
+    mutex_unlock(&inode->i_mutex);
+    gossip_debug(GOSSIP_DCACHE_DEBUG,
+                 "%s: getattr %s (ret = %d), returning %s for dentry\n",
+                 __func__,
+                 (ret == 0 ? "succeeded" : "failed"),
+                 ret,
+                 (ret == 0 ? "valid" : "INVALID"));
+
+    return ((ret == 0) ? 1 : 0);
 }
 
 static int pvfs2_d_delete (struct dentry * dentry)
 {
-    gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_delete: called on dentry %p.\n", dentry);
+    gossip_debug(GOSSIP_DCACHE_DEBUG,
+                 "%s: called on dentry %p.\n", __func__, dentry);
     if(dentry->d_inode && is_bad_inode(dentry->d_inode))
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_delete: returning 1 (bad inode).\n");
+        gossip_debug(GOSSIP_DCACHE_DEBUG,
+                     "%s: returning 1 (bad inode).\n", __func__);
         return 1;
     }
     else
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "pvfs2_d_delete: returning 0 (inode looks ok).\n");
+        gossip_debug(GOSSIP_DCACHE_DEBUG,
+                     "%s: returning 0 (inode looks ok).\n", __func__);
         return 0;
     }
 }
@@ -141,8 +161,8 @@ static int pvfs2_d_revalidate(
     if (nd && (nd->flags & LOOKUP_FOLLOW) &&
         (!nd->flags & LOOKUP_CREATE))
     {
-        gossip_debug(GOSSIP_DCACHE_DEBUG, "\npvfs2_d_revalidate: Trusting intent; "
-                    "skipping getattr\n");
+        gossip_debug(GOSSIP_DCACHE_DEBUG,
+                     "\n%s: Trusting intent; skipping getattr\n", __func__);
         return 1;
     }
     return(pvfs2_d_revalidate_common(dentry));
Index: src/kernel/linux-2.6/pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-kernel.h,v
retrieving revision 1.149
diff -u -a -p -r1.149 pvfs2-kernel.h
--- src/kernel/linux-2.6/pvfs2-kernel.h	20 Mar 2008 03:21:26 -0000	1.149
+++ src/kernel/linux-2.6/pvfs2-kernel.h	25 Mar 2008 19:00:50 -0000
@@ -1175,37 +1175,6 @@ do                                      
 
 #endif /* PVFS2_LINUX_KERNEL_2_4 */
 
-
-/************************************
- * misc convenience functions
- ************************************/
-static inline int pvfs2_internal_revalidate(
-    struct inode *inode)
-{
-    int ret = -EINVAL;
-    if (inode)
-    {
-        /*
-         * The dentry revalidating function expects that all fields of the inode
-         * would be refreshed, so we dont have much of a choice here too.
-         */
-        ret = ((pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT) == 0) ? 1 : 0);
-#if 0
-/* Calling make_bad_inode() here results in a bad reference count on the
- * inode.  It therefore gets cached until the module is unloaded, when we get 
- * a "VFS: Busy inodes after unmount. Self-destruct in 5 seconds." error
- * message.  It is better to just let it be cleaned up naturally after 
- * validation failure. -Phil
- */
-        if (ret == 0)
-        {
-            pvfs2_make_bad_inode(inode);
-        }
-#endif
-    }
-    return ret;
-}
-
 #ifdef PVFS2_LINUX_KERNEL_2_4
 /*
   based on code from 2.6.x's fs/libfs.c with required macro support
Index: src/kernel/linux-2.6/pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-utils.c,v
retrieving revision 1.150
diff -u -a -p -r1.150 pvfs2-utils.c
--- src/kernel/linux-2.6/pvfs2-utils.c	26 Feb 2008 16:29:15 -0000	1.150
+++ src/kernel/linux-2.6/pvfs2-utils.c	25 Mar 2008 19:00:50 -0000
@@ -129,7 +129,7 @@ int copy_attributes_to_inode(
     char *symname)
 {
     int ret = -1;
-    int perm_mode = 0, old_mode = 0;
+    int perm_mode = 0;
     pvfs2_inode_t *pvfs2_inode = NULL;
     loff_t inode_size = 0, rounded_up_size = 0;
 
@@ -227,9 +227,6 @@ int copy_attributes_to_inode(
         inode->i_mtime.tv_nsec = 0;
         inode->i_ctime.tv_nsec = 0;
 #endif
-        old_mode = inode->i_mode;
-        inode->i_mode = 0;
-
         if (attrs->perms & PVFS_O_EXECUTE)
             perm_mode |= S_IXOTH;
         if (attrs->perms & PVFS_O_WRITE)
@@ -257,7 +254,7 @@ int copy_attributes_to_inode(
         if (get_suid_flag(inode) == 1 && (attrs->perms & PVFS_U_SUID))
             perm_mode |= S_ISUID;
 
-        inode->i_mode |= perm_mode;
+        inode->i_mode = perm_mode;
 
         if (is_root_handle(inode))
         {
