[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/kernel/linux-2.6: dcache.c file.c inode.c namei.c pvfs2-kernel.h pvfs2-utils.c super.c xattr-default.c

CVS commit program cvs at parl.clemson.edu
Tue Jun 30 12:25:39 EDT 2009


Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv15117/kernel/linux-2.6

Modified Files:
	dcache.c file.c inode.c namei.c pvfs2-kernel.h pvfs2-utils.c 
	super.c xattr-default.c 
Log Message:
patch from David Metheny:
- corrects several mis-classified gossip debug messages in the kernel module
- adds new gossip debug messages related to make_bad_inode() calls
- bug fix for aggressive make_bad_inode() behavior that could cause
  permission denied errors or kernel oops


Index: dcache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/dcache.c,v
diff -p -u -r1.42 -r1.43
--- dcache.c	30 Jun 2008 13:28:04 -0000	1.42
+++ dcache.c	30 Jun 2009 16:25:38 -0000	1.43
@@ -79,6 +79,9 @@ static int pvfs2_d_revalidate_common(str
         strncpy(new_op->upcall.req.lookup.d_name,
                 dentry->d_name.name, PVFS2_NAME_LEN);
 
+        gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d interrupt flag [%d]\n", 
+            __FILE__, __func__, __LINE__, get_interruptible_flag(parent_inode));
+
         ret = service_operation(
             new_op, "pvfs2_lookup", 
             get_interruptible_flag(parent_inode));
@@ -88,12 +91,28 @@ static int pvfs2_d_revalidate_common(str
         {
             gossip_debug(
                 GOSSIP_DCACHE_DEBUG,
-                "%s: lookup failure or no match.\n", __func__);
+                "%s:%s:%d lookup failure |%s| or no match |%s|.\n", 
+                __FILE__, __func__, __LINE__,
+                (new_op->downcall.status != 0) ? "true" : "false",
+                (!match_handle(new_op->downcall.resp.lookup.refn.handle, inode)) ? "true" : "false");
             op_release(new_op);
+
+            /* Avoid calling make_bad_inode() in this situation.  On 2.4
+             * (RHEL3) kernels, it can cause bogus permission denied errors
+             * on path elements after interrupt signals.  On later 2.6
+             * kernels this causes a kernel oops rather than a permission
+             * error.
+             */
+#if 0
             /* mark the inode as bad so that d_delete will be aggressive
              * about dropping the dentry
              */
             pvfs2_make_bad_inode(inode);
+#endif
+            gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d setting revalidate_failed = 1\n", __FILE__, __func__, __LINE__);
+            /* set a flag that we can detect later in d_delete() */
+            PVFS2_I(inode)->revalidate_failed = 1;
+
             goto invalid_exit;
         }
 
@@ -111,11 +130,12 @@ static int pvfs2_d_revalidate_common(str
                  __func__, inode, llu(get_handle_from_ino(inode)));
     ret = pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT);
     gossip_debug(GOSSIP_DCACHE_DEBUG,
-                 "%s: getattr %s (ret = %d), returning %s for dentry\n",
+                 "%s: getattr %s (ret = %d), returning %s for dentry i_count=%d\n",
                  __func__,
                  (ret == 0 ? "succeeded" : "failed"),
                  ret,
-                 (ret == 0 ? "valid" : "INVALID"));
+                 (ret == 0 ? "valid" : "INVALID"),
+                 atomic_read(&inode->i_count));
     if(ret != 0)
     {
         goto invalid_exit;
@@ -132,7 +152,10 @@ static int pvfs2_d_delete (struct dentry
 {
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  "%s: called on dentry %p.\n", __func__, dentry);
+#if 0
     if(dentry->d_inode && is_bad_inode(dentry->d_inode))
+#endif
+    if(dentry->d_inode && PVFS2_I(dentry->d_inode)->revalidate_failed == 1)
     {
         gossip_debug(GOSSIP_DCACHE_DEBUG,
                      "%s: returning 1 (bad inode).\n", __func__);

Index: file.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/file.c,v
diff -p -u -r1.151 -r1.152
--- file.c	8 Dec 2008 15:54:56 -0000	1.151
+++ file.c	30 Jun 2009 16:25:38 -0000	1.152
@@ -102,6 +102,7 @@ int pvfs2_file_open(
             }
             else
             {
+                gossip_debug(GOSSIP_FILE_DEBUG, "%s:%s:%d calling make bad inode\n", __FILE__,  __func__, __LINE__);
                 pvfs2_make_bad_inode(inode);
                 gossip_debug(GOSSIP_FILE_DEBUG, "pvfs2_file_open returning error: %d\n", ret);
                 return(ret);
@@ -3119,6 +3120,7 @@ loff_t pvfs2_file_llseek(struct file *fi
         ret = pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_SIZE);
         if (ret)
         {
+            gossip_debug(GOSSIP_FILE_DEBUG, "%s:%s:%d calling make bad inode\n", __FILE__,  __func__, __LINE__);
             pvfs2_make_bad_inode(inode);
             return ret;
         }

Index: inode.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/inode.c,v
diff -p -u -r1.87 -r1.88
--- inode.c	1 Apr 2009 21:27:37 -0000	1.87
+++ inode.c	30 Jun 2009 16:25:38 -0000	1.88
@@ -229,6 +229,7 @@ int pvfs2_revalidate(struct dentry *dent
     if (ret)
     {
         /* assume an I/O error and flag inode as bad */
+        gossip_debug(GOSSIP_INODE_DEBUG, "%s:%s:%d calling make bad inode\n", __FILE__,  __func__, __LINE__);
         pvfs2_make_bad_inode(inode);
     }
     return ret;
@@ -281,6 +282,7 @@ int pvfs2_getattr(
     else
     {
         /* assume an I/O error and flag inode as bad */
+        gossip_debug(GOSSIP_INODE_DEBUG, "%s:%s:%d calling make bad inode\n", __FILE__,  __func__, __LINE__);
         pvfs2_make_bad_inode(inode);
     }
     return ret;
@@ -328,6 +330,7 @@ int pvfs2_getattr_lite(
     else
     {
         /* assume an I/O error and flag inode as bad */
+        gossip_debug(GOSSIP_INODE_DEBUG, "%s:%s:%d calling make bad inode\n", __FILE__,  __func__, __LINE__);
         pvfs2_make_bad_inode(inode);
     }
     return ret;

Index: namei.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/namei.c,v
diff -p -u -r1.84 -r1.85
--- namei.c	18 Jul 2008 20:41:17 -0000	1.84
+++ namei.c	30 Jun 2009 16:25:39 -0000	1.85
@@ -112,6 +112,8 @@ static struct dentry *pvfs2_lookup(
         if (parent && parent->refn.handle != PVFS_HANDLE_NULL 
                 && parent->refn.fs_id != PVFS_FS_ID_NULL)
         {
+            gossip_debug(GOSSIP_NAME_DEBUG, "%s:%s:%d using parent %llu\n",
+              __FILE__, __func__, __LINE__, llu(parent->refn.handle));
             new_op->upcall.req.lookup.parent_refn = parent->refn;
         }
         else
@@ -198,6 +200,8 @@ static struct dentry *pvfs2_lookup(
     inode = pvfs2_iget(sb, &new_op->downcall.resp.lookup.refn);
     if (inode && !is_bad_inode(inode))
     {
+        gossip_debug(GOSSIP_NAME_DEBUG, "%s:%s:%d Found good inode [%lu] with count [%d]\n", 
+            __FILE__, __func__, __LINE__, inode->i_ino, (int)atomic_read(&inode->i_count));
         struct dentry *res;
 
         /* update dentry/inode pair into dcache */
@@ -219,6 +223,8 @@ static struct dentry *pvfs2_lookup(
     }
     else if (inode && is_bad_inode(inode))
     {
+        gossip_debug(GOSSIP_NAME_DEBUG, "%s:%s:%d Found bad inode [%lu] with count [%d]. Returning error [%d]", 
+            __FILE__, __func__, __LINE__, inode->i_ino, (int)atomic_read(&inode->i_count), ret);
         ret = -EACCES;
         found_pvfs2_inode = PVFS2_I(inode);
         /* look for an error code, possibly set by pvfs2_read_inode(),
@@ -237,7 +243,7 @@ static struct dentry *pvfs2_lookup(
      * from pvfs2_iget was null...just return EACCESS
      */
     op_release(new_op);
-    gossip_debug(GOSSIP_NAME_DEBUG, "Returning -EACCES\n");
+    gossip_debug(GOSSIP_NAME_DEBUG, "Returning -EACCES for NULL inode\n");
     return ERR_PTR(-EACCES);
 }
 

Index: pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-kernel.h,v
diff -p -u -r1.157 -r1.158
--- pvfs2-kernel.h	1 Apr 2009 21:27:37 -0000	1.157
+++ pvfs2-kernel.h	30 Jun 2009 16:25:39 -0000	1.158
@@ -376,6 +376,7 @@ typedef struct
 #endif
     sector_t last_failed_block_index_read;
     int error_code;
+    int revalidate_failed;
 
     /* State of in-memory attributes not yet flushed to disk associated with this object */
     unsigned long pinode_flags;

Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -p -u -r1.156 -r1.157
--- pvfs2-utils.c	1 Apr 2009 21:27:37 -0000	1.156
+++ pvfs2-utils.c	30 Jun 2009 16:25:39 -0000	1.157
@@ -265,7 +265,7 @@ int copy_attributes_to_inode(
         {
             /* special case: mark the root inode as sticky */
             inode->i_mode |= S_ISVTX;
-            gossip_debug(GOSSIP_ACL_DEBUG, "Marking inode %llu as sticky\n", 
+            gossip_debug(GOSSIP_UTILS_DEBUG, "Marking inode %llu as sticky\n", 
                     llu(get_handle_from_ino(inode)));
         }
 
@@ -443,6 +443,7 @@ int pvfs2_inode_getattr(struct inode *in
         pvfs2_inode = PVFS2_I(inode);
         if (!pvfs2_inode)
         {
+            gossip_debug(GOSSIP_UTILS_DEBUG, "%s:%s:%d failed to resolve to pvfs2_inode\n", __FILE__, __func__, __LINE__);
             return ret;
         }
 
@@ -588,7 +589,7 @@ int pvfs2_inode_setattr(
             new_op, "pvfs2_inode_setattr", 
             get_interruptible_flag(inode));
 
-        gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_inode_setattr: returning %d\n", ret);
+        gossip_debug(GOSSIP_UTILS_DEBUG, "pvfs2_inode_setattr: returning %d\n", ret);
 
         /* when request is serviced properly, free req op struct */
         op_release(new_op);
@@ -1227,7 +1228,7 @@ static inline struct inode *pvfs2_create
         new_op, "pvfs2_create_file", 
         get_interruptible_flag(dir));
 
-    gossip_debug(GOSSIP_ACL_DEBUG, "Create Got PVFS2 handle %llu on fsid %d (ret=%d)\n",
+    gossip_debug(GOSSIP_UTILS_DEBUG, "Create Got PVFS2 handle %llu on fsid %d (ret=%d)\n",
                 llu(new_op->downcall.resp.create.refn.handle),
                 new_op->downcall.resp.create.refn.fs_id, ret);
 
@@ -1252,14 +1253,14 @@ static inline struct inode *pvfs2_create
 
         dentry->d_op = &pvfs2_dentry_operations;
         d_instantiate(dentry, inode);
-        gossip_debug(GOSSIP_ACL_DEBUG, "Inode (Regular File) %llu -> %s\n",
+        gossip_debug(GOSSIP_UTILS_DEBUG, "Inode (Regular File) %llu -> %s\n",
                 llu(get_handle_from_ino(inode)), dentry->d_name.name);
     }
     else
     {
         *error_code = ret;
 
-        gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_create_file: failed with error code %d\n",
+        gossip_debug(GOSSIP_UTILS_DEBUG, "pvfs2_create_file: failed with error code %d\n",
                     *error_code);
     }
 
@@ -1339,7 +1340,7 @@ static inline struct inode *pvfs2_create
 
         dentry->d_op = &pvfs2_dentry_operations;
         d_instantiate(dentry, inode);
-        gossip_debug(GOSSIP_ACL_DEBUG, "Inode (Directory) %llu -> %s\n",
+        gossip_debug(GOSSIP_UTILS_DEBUG, "Inode (Directory) %llu -> %s\n",
                 llu(get_handle_from_ino(inode)), dentry->d_name.name);
     }
     else
@@ -1435,7 +1436,7 @@ static inline struct inode *pvfs2_create
 
         dentry->d_op = &pvfs2_dentry_operations;
         d_instantiate(dentry, inode);
-        gossip_debug(GOSSIP_ACL_DEBUG, "Inode (Symlink) %llu -> %s\n",
+        gossip_debug(GOSSIP_UTILS_DEBUG, "Inode (Symlink) %llu -> %s\n",
                 llu(get_handle_from_ino(inode)), dentry->d_name.name);
     }
     else

Index: super.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/super.c,v
diff -p -u -r1.107 -r1.108
--- super.c	26 Feb 2009 19:42:49 -0000	1.107
+++ super.c	30 Jun 2009 16:25:39 -0000	1.108
@@ -254,6 +254,8 @@ void pvfs2_read_inode(
     if (pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT) != 0)
     {
         /* assume an I/O error and mark the inode as bad */
+        gossip_debug(GOSSIP_SUPER_DEBUG, "%s:%s:%d calling make bad inode - [%p] (inode = %llu | ct = %d)\n",
+                __FILE__, __func__, __LINE__, pvfs2_inode, llu(get_handle_from_ino(inode)), (int)atomic_read(&inode->i_count));
         pvfs2_make_bad_inode(inode);
     }
 }
@@ -296,6 +298,8 @@ void pvfs2_read_inode(
 #endif
         if (pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT) != 0)
         {
+            gossip_debug(GOSSIP_SUPER_DEBUG, "%s:%s:%d calling make bad inode - [%p] (inode = %llu | ct = %d)\n",
+                __FILE__, __func__, __LINE__, pvfs2_inode, llu(get_handle_from_ino(inode)), (int)atomic_read(&inode->i_count));
             pvfs2_make_bad_inode(inode);
         }
         else {
@@ -306,8 +310,9 @@ void pvfs2_read_inode(
     }
     else
     {
-        gossip_err("Could not allocate pvfs2_inode from "
-                    "pvfs2_inode_cache\n");
+        gossip_err("%s:%s:%d Could not allocate pvfs2_inode from pvfs2_inode_cache."
+            "calling make bad inode - [%p] (inode = %llu | ct = %d)\n",
+            __FILE__, __func__, __LINE__, pvfs2_inode, llu(get_handle_from_ino(inode)), (int)atomic_read(&inode->i_count));
         pvfs2_make_bad_inode(inode);
     }
 }

Index: xattr-default.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/xattr-default.c,v
diff -p -u -r1.4 -r1.5
--- xattr-default.c	26 Sep 2006 03:44:17 -0000	1.4
+++ xattr-default.c	30 Jun 2009 16:25:39 -0000	1.5
@@ -29,7 +29,8 @@ int pvfs2_xattr_set_default(struct inode
     if (!S_ISREG(inode->i_mode) &&
        (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
     {
-       return -EPERM;
+        gossip_err("pvfs2_xattr_set_default: Returning EPERM for inode %p.\n", inode);
+        return -EPERM;
     }
     gossip_debug(GOSSIP_XATTR_DEBUG, "pvfs2_setxattr_default %s\n", name);
     internal_flag = convert_to_internal_xattr_flags(flags);



More information about the Pvfs2-cvs mailing list