[SSI] openssi/kernel/fs fs-writeback.c, 1.10, 1.11 namespace.c, 1.22, 1.23 read_write.c, 1.2, 1.3 select.c, 1.7, 1.8

Roger Tsang <[email protected]>
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/fs
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29491/fs

Modified Files:
      Tag: OPENSSI-FC
	fs-writeback.c namespace.c read_write.c select.c 
Log Message:
Bug fixes and enhancements (see ChangeLog)


Index: select.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/fs/select.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- select.c	7 Aug 2007 03:06:13 -0000	1.7
+++ select.c	24 Mar 2009 04:26:29 -0000	1.8
@@ -217,7 +217,11 @@
 	ssidev_poll_node_t *pnp;
 	int ucount = 0;
 
+#ifdef RCU_SSIDEV_POLL_CLI_LIST
+	pcp->pc_state = 0;
+#else
 	pcp->pc_wakeup = 0;
+#endif
 	for (i = 0; i < NSC_MAX_NODE_VALUE; i++) {
 		pnp = pcp->pc_node[i];
 		if (pnp != NULL)

Index: namespace.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/fs/namespace.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- namespace.c	10 Oct 2008 08:10:32 -0000	1.22
+++ namespace.c	24 Mar 2009 04:26:29 -0000	1.23
@@ -135,7 +135,11 @@
 			if (p->mnt_uniqueid == uniqueid)
 				break;
 		}
+#ifdef CFS_VFSMOUNT_RACE_FIX
+		if (mntget(p))
+#else
 		if (p)
+#endif
 			break;
 	}
 	spin_unlock(&vfsmount_lock);
@@ -145,16 +149,26 @@
 void mnt_fix_devname(struct super_block *sb, const char *name)
 {
 	struct vfsmount *mnt = NULL;
+	struct list_head *head, *tmp;
+#ifdef CFS_VFSMOUNT_RACE_FIX
+	caddr_t old_devname = NULL;
+	char *newname;
+	int size;
+#endif
 	int i;
 	unsigned int nr_hash = 1UL << hash_bits;
 
 	if (!name)
 		return;
 
+#ifdef CFS_VFSMOUNT_RACE_FIX
+	size = strlen(name) + 1;
+	newname = kmalloc_nofail(size);
+	memcpy(newname, name, size);
+#endif
 	spin_lock(&vfsmount_lock);
 	for (i = 0; i < nr_hash ; i++) {
-		struct list_head * head = &mount_hashtable[i];
-		struct list_head * tmp = head;
+		tmp = head = &mount_hashtable[i];
 		for (;;) {
 			tmp = tmp->next;
 			mnt = NULL;
@@ -163,6 +177,11 @@
 			mnt = list_entry(tmp, struct vfsmount, mnt_hash);
 			if (mnt->mnt_sb != sb)
 				continue;
+#ifdef CFS_VFSMOUNT_RACE_FIX
+			old_devname = mnt->mnt_devname;
+			mb();
+			mnt->mnt_devname = newname;
+#else
 			if (mnt->mnt_devname)
 				kfree(mnt->mnt_devname);
 			{
@@ -173,11 +192,18 @@
 					mnt->mnt_devname = newname;
 				}
 			}
+#endif
 			goto out;
 		}
 	}
 out:
 	spin_unlock(&vfsmount_lock);
+#ifdef CFS_VFSMOUNT_RACE_FIX
+	if (!mnt)
+		kfree(newname);
+	if (old_devname)
+		kfree(old_devname);
+#endif
 }
 
 #if defined(DEBUG) || defined(DEBUG_TOOLS)

Index: read_write.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/fs/read_write.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- read_write.c	4 Aug 2007 21:02:56 -0000	1.2
+++ read_write.c	24 Mar 2009 04:26:29 -0000	1.3
@@ -191,11 +191,8 @@
 	if (unlikely(count > file->f_maxcount))
 		goto Einval;
 	pos = *ppos;
-#ifndef SSI_SKIP_RW_VERIFY_AREA
-	/* SSI_XXX: Remote read fails here */
-	if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) 
+	if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
 		goto Einval;
-#endif
 
 	inode = file->f_dentry->d_inode;
 	if (inode->i_flock && MANDATORY_LOCK(inode))

Index: fs-writeback.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/fs/fs-writeback.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- fs-writeback.c	3 Feb 2009 06:18:13 -0000	1.10
+++ fs-writeback.c	24 Mar 2009 04:26:29 -0000	1.11
@@ -391,13 +391,10 @@
 	return;		/* Leave any unwritten inodes on s_io */
 }
 
+#ifdef CONFIG_CFS
 /* Taken from writeback_inodes() */
 static inline int
-#ifdef CONFIG_CFS
 __writeback_inodes(struct super_block *sb, struct writeback_control *wbc, int sb_is_cfs)
-#else
-__writeback_inodes(struct super_block *sb, struct writeback_control *wbc)
-#endif
 {
 	/* we're making our own get_super here */
 	sb->s_count++;
@@ -408,7 +405,6 @@
 	 * be unmounted by the time it is released.
 	 */
 	if (down_read_trylock(&sb->s_umount)) {
-#ifdef CONFIG_CFS
 		if (sb_is_cfs) {
 			struct super_block *psb;
 
@@ -420,7 +416,6 @@
 			}
 		} else
 		/* flush CFS */
-#endif
 		if (sb->s_root) {
 			spin_lock(&inode_lock);
 			sync_sb_inodes(sb, wbc);
@@ -433,7 +428,6 @@
 	return __put_super_and_need_restart(sb);
 }
 
-#ifdef CONFIG_CFS
 int cfs_writeback_inodes(struct super_block *sb, struct writeback_control *wbc)
 {
 	if (wbc->nr_to_write <= 0)
@@ -454,7 +448,7 @@
 	}
 	return 0;
 }
-#endif
+#endif /* CONFIG_CFS */
 
 /*
  * Start writeback of dirty pagecache data against all unlocked inodes.
@@ -500,7 +494,24 @@
 		}
 #else
 		if (!list_empty(&sb->s_dirty) || !list_empty(&sb->s_io)) {
-			if (__writeback_inodes(sb, wbc))
+			/* we're making our own get_super here */
+			sb->s_count++;
+			spin_unlock(&sb_lock);
+			/*
+			 * If we can't get the readlock, there's no sense in
+			 * waiting around, most of the time the FS is going to
+			 * be unmounted by the time it is released.
+			 */
+			if (down_read_trylock(&sb->s_umount)) {
+				if (sb->s_root) {
+					spin_lock(&inode_lock);
+					sync_sb_inodes(sb, wbc);
+					spin_unlock(&inode_lock);
+				}
+				up_read(&sb->s_umount);
+			}
+			spin_lock(&sb_lock);
+			if (__put_super_and_need_restart(sb))
 				goto restart;
 		}
 #endif /* !CONFIG_CFS */
@@ -566,6 +577,7 @@
  */
 static struct super_block *get_super_to_sync(void)
 {
+#ifdef CONFIG_CFS
 	struct super_block *s;
 restart:
 	spin_lock(&sb_lock);
@@ -573,16 +585,22 @@
 	for (; s != sb_entry(&super_blocks); s = sb_entry(s->s_list.prev)) {
 		struct super_block *sb = s;
 		if (sb->s_syncing) {
-#ifdef CONFIG_CFS
-			if (cfs_sb_is_cfs(sb) && sbtocmi(sb) &&
-			   CFS_AT_SERVER_SB(sb)) {
+			if (cfs_sb_is_cfs(sb) && sbtocmi(sb) && CFS_AT_SERVER_SB(sb)) {
 				sb = sbtocmi(sb)->mi_pfs_sb;
 				if (sb->s_syncing)
 					continue;
 			} else
-#endif
-			continue;
+				continue;
 		}
+#else
+	struct super_block *sb;
+restart:
+	spin_lock(&sb_lock);
+	sb = sb_entry(super_blocks.prev);
+	for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
+		if (sb->s_syncing)
+			continue;
+#endif
 		sb->s_syncing = 1;
 		sb->s_count++;
 		spin_unlock(&sb_lock);
@@ -695,22 +713,22 @@
  
 int write_inode_now(struct inode *inode, int sync)
 {
-       int ret;
-       struct writeback_control wbc = {
-               .nr_to_write = LONG_MAX,
-               .sync_mode = WB_SYNC_ALL,
-       };
+	int ret;
+	struct writeback_control wbc = {
+		.nr_to_write = LONG_MAX,
+		.sync_mode = WB_SYNC_ALL,
+	};
 
-       if (inode->i_mapping->backing_dev_info->memory_backed)
-               return 0;
+	if (inode->i_mapping->backing_dev_info->memory_backed)
+		return 0;
 
-       might_sleep();
-       spin_lock(&inode_lock);
-       ret = __writeback_single_inode(inode, &wbc);
-       spin_unlock(&inode_lock);
-       if (sync)
-               wait_on_inode(inode);
-       return ret;
+	might_sleep();
+	spin_lock(&inode_lock);
+	ret = __writeback_single_inode(inode, &wbc);
+	spin_unlock(&inode_lock);
+	if (sync)
+		wait_on_inode(inode);
+	return ret;
 }
 EXPORT_SYMBOL(write_inode_now);
 


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.