[Pvfs2-cvs] commit by dbonnie in pvfs2/src/kernel/linux-2.6: dcache.c dir.c file.c inode.c pvfs2-kernel.h super.c

CVS commit program cvs at parl.clemson.edu
Fri May 16 11:15:49 EDT 2008


Update of /anoncvs/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv1762/src/kernel/linux-2.6

Modified Files:
      Tag: cu-security-branch
	dcache.c dir.c file.c inode.c pvfs2-kernel.h super.c 
Log Message:
Updated branch with code from HEAD


Index: dcache.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/dcache.c,v
diff -p -u -r1.40 -r1.40.2.1
--- dcache.c	25 Mar 2008 23:55:43 -0000	1.40
+++ dcache.c	16 May 2008 15:15:48 -0000	1.40.2.1
@@ -109,9 +109,9 @@ static int pvfs2_d_revalidate_common(str
     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);
+    pvfs2_inode_lock(inode);
     ret = pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT);
-    mutex_unlock(&inode->i_mutex);
+    pvfs2_inode_unlock(inode);
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  "%s: getattr %s (ret = %d), returning %s for dentry\n",
                  __func__,

Index: dir.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/dir.c,v
diff -p -u -r1.54 -r1.54.2.1
--- dir.c	4 Feb 2008 16:38:21 -0000	1.54
+++ dir.c	16 May 2008 15:15:48 -0000	1.54.2.1
@@ -294,6 +294,14 @@ static int pvfs2_readdir(
                 }
             }
 
+            /* did we hit the end of the directory? */
+            if(rhandle.readdir_response.token == PVFS_READDIR_END)
+            {
+                gossip_debug(GOSSIP_DIR_DEBUG,
+                    "End of dir detected; setting f_pos to PVFS_READDIR_END.\n");
+                file->f_pos = PVFS_READDIR_END;
+            }
+
             gossip_debug(GOSSIP_DIR_DEBUG, 
                          "pos = %llu, file->f_pos should have been %ld\n",
                          llu(pos),

Index: file.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/file.c,v
diff -p -u -r1.146 -r1.146.2.1
--- file.c	26 Feb 2008 16:29:15 -0000	1.146
+++ file.c	16 May 2008 15:15:49 -0000	1.146.2.1
@@ -1130,7 +1130,7 @@ out:
 static ssize_t wait_for_cached_io(struct rw_options *old_rw, struct iovec *vec, 
         int nr_segs, size_t total_size)
 {
-    ssize_t err = 0, total_actual_io;
+    ssize_t err = 0, total_actual_io = 0;
     struct rw_options rw;
     loff_t isize, offset;
 

Index: inode.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/inode.c,v
diff -p -u -r1.81 -r1.81.2.1
--- inode.c	26 Feb 2008 16:29:15 -0000	1.81
+++ inode.c	16 May 2008 15:15:49 -0000	1.81.2.1
@@ -133,7 +133,7 @@ static int pvfs2_releasepage(struct page
 
 struct backing_dev_info pvfs2_backing_dev_info =
 {
-    .ra_pages = 1024,
+    .ra_pages = 0,
 #ifdef HAVE_BDI_MEMORY_BACKED
     /* old interface, up through 2.6.11 */
     .memory_backed = 1 /* does not contribute to dirty memory */

Index: pvfs2-kernel.h
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/pvfs2-kernel.h,v
diff -p -u -r1.150 -r1.150.2.1
--- pvfs2-kernel.h	25 Mar 2008 19:21:22 -0000	1.150
+++ pvfs2-kernel.h	16 May 2008 15:15:49 -0000	1.150.2.1
@@ -459,6 +459,8 @@ typedef struct
     struct super_block *sb;
     int    mount_pending;
     struct list_head list;
+    atomic_t pvfs2_inode_alloc_count;
+    atomic_t pvfs2_inode_dealloc_count;
 } pvfs2_sb_info_t;
 
 /** a temporary structure used only for sb mount time that groups the
@@ -1225,17 +1227,29 @@ static inline int dcache_dir_close(struc
 
 #endif /* PVFS2_LINUX_KERNEL_2_4 */
 
+#ifdef HAVE_I_SEM_IN_STRUCT_INODE
+#define pvfs2_inode_lock(__i) do \
+{ down(&(__i)->i_sem); } while (0)
+#define pvfs2_inode_unlock(__i) do \
+{ up(&(__i)->i_sem); } while (0)
+#else
+#define pvfs2_inode_lock(__i) do \
+{ mutex_lock(&(__i)->i_mutex); } while (0)
+#define pvfs2_inode_unlock(__i) do \
+{ mutex_unlock(&(__i)->i_mutex); } while (0)
+#endif /* HAVE_I_SEM_IN_STRUCT_INODE */
+
 static inline void pvfs2_i_size_write(struct inode *inode, loff_t i_size)
 {
 #ifndef HAVE_I_SIZE_WRITE
     inode->i_size = i_size;
 #else
     #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
-    mutex_lock(&inode->i_mutex);
+    pvfs2_inode_lock(inode);
     #endif
     i_size_write(inode, i_size);
     #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
-    mutex_unlock(&inode->i_mutex);
+    pvfs2_inode_unlock(inode);
     #endif
 #endif
     return;

Index: super.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/super.c,v
diff -p -u -r1.97 -r1.97.2.1
--- super.c	19 Feb 2008 17:38:09 -0000	1.97
+++ super.c	16 May 2008 15:15:49 -0000	1.97.2.1
@@ -17,7 +17,6 @@ spinlock_t pvfs2_superblocks_lock = SPIN
 #ifdef HAVE_GET_FS_KEY_SUPER_OPERATIONS
 static void pvfs2_sb_get_fs_key(struct super_block *sb, char **ppkey, int *keylen);
 #endif
-static atomic_t pvfs2_inode_alloc_count, pvfs2_inode_dealloc_count;
 
 static char *keywords[] = {"intr", "acl", "suid", "noatime", "nodiratime"};
 static int num_possible_keywords = sizeof(keywords)/sizeof(char *);
@@ -149,6 +148,7 @@ static int parse_mount_options(
             /* option string did not match any of the known keywords */
             if (j == num_possible_keywords)
             {
+#ifdef PVFS2_LINUX_KERNEL_2_4
                 /* assume we have a device name */
                 if (got_device == 0)
                 {
@@ -167,6 +167,13 @@ static int parse_mount_options(
                     gossip_debug(GOSSIP_SUPER_DEBUG, "pvfs2: multiple device names specified: "
                                 "ignoring %s\n", options[i]);
                 }
+#else
+                /* in the 2.6 kernel, we don't pass device name through this
+                 * path; we must have gotten an unsupported option.
+                 */
+                gossip_err("Error: mount option [%s] is not supported.\n", options[i]);
+                return(-EINVAL);
+#endif
             }
         }
     }
@@ -193,7 +200,7 @@ static struct inode *pvfs2_alloc_inode(s
     {
         new_inode = &pvfs2_inode->vfs_inode;
         gossip_debug(GOSSIP_SUPER_DEBUG, "pvfs2_alloc_inode: allocated %p\n", pvfs2_inode);
-        atomic_inc(&pvfs2_inode_alloc_count);
+        atomic_inc(&(PVFS2_SB(sb)->pvfs2_inode_alloc_count));
         new_inode->i_flags &= ~(S_APPEND|S_IMMUTABLE|S_NOATIME);
     }
     return new_inode;
@@ -208,7 +215,7 @@ static void pvfs2_destroy_inode(struct i
         gossip_debug(GOSSIP_SUPER_DEBUG, "pvfs2_destroy_inode: deallocated %p destroying inode %llu\n",
                     pvfs2_inode, llu(get_handle_from_ino(inode)));
 
-        atomic_inc(&pvfs2_inode_dealloc_count);
+        atomic_inc(&(PVFS2_SB(inode->i_sb)->pvfs2_inode_dealloc_count));
         pvfs2_inode_finalize(pvfs2_inode);
         pvfs2_inode_release(pvfs2_inode);
     }
@@ -536,7 +543,7 @@ int pvfs2_remount(
 
     if (sb && PVFS2_SB(sb))
     {
-        if (data)
+        if (data && data[0] != '\0')
         {
             ret = parse_mount_options(data, sb, 1);
             if (ret)
@@ -1307,8 +1314,8 @@ void pvfs2_kill_sb(
 #endif
         {
             int count1, count2;
-            count1 = atomic_read(&pvfs2_inode_alloc_count);
-            count2 = atomic_read(&pvfs2_inode_dealloc_count);
+            count1 = atomic_read(&(PVFS2_SB(sb)->pvfs2_inode_alloc_count));
+            count2 = atomic_read(&(PVFS2_SB(sb)->pvfs2_inode_dealloc_count));
             if (count1 != count2) 
             {
                 gossip_err("pvfs2_kill_sb: (WARNING) number of inode allocs (%d) != number of inode deallocs (%d)\n",



More information about the Pvfs2-cvs mailing list