[SSI] openssi/kernel/cluster/ssi/cfs write.c,1.47,1.48

Roger Tsang <[email protected]> Mon, 17 Jan 2011 06:40:52 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv28957/cluster/ssi/cfs

Modified Files:
      Tag: OPENSSI-FC
	write.c 
Log Message:
(#ifdef CFS_CHARD_SYNC_FIX)
- cfs_commit_result: when inserting into dirty_down list grab the inode reference before calling cfs_commit_free() which does iput() on the inode. fix possible memory corruption since without holding the inode reference CFS failover can lose the race with invalidate_inodes(), prune_icache() or iput_final().
- cfs_writeback_done: when inserting into dirty_down list grab the inode reference before calling cfs_writedata_free() which does iput() on the inode. fix possible memory corruption since without holding the inode reference CFS failover can lose the race with invalidate_inodes(), prune_icache() or iput_final().
- cfs_sync_all_data: no need to call igrab() since the dirty_down list already has the inode reference.


Index: write.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/write.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- write.c	25 Oct 2010 05:56:23 -0000	1.47
+++ write.c	17 Jan 2011 06:40:50 -0000	1.48
@@ -1208,6 +1208,7 @@
 #endif
 #ifdef CFS_CHARD_SYNC_FIX
 		if (list_empty(itoc_down(data->inode))) {
+			atomic_inc(&data->inode->i_count); /* for dirty_down */
 			list_add_tail(itoc_down(data->inode),
 					&CFS_SERVER(data->inode)->dirty_down);
 		}
@@ -1815,6 +1816,7 @@
 
 #ifdef CFS_CHARD_SYNC_FIX
 		if (list_empty(itoc_down(data->inode))) {
+			atomic_inc(&data->inode->i_count); /* for dirty_down */
 			list_add_tail(itoc_down(data->inode),
 					&CFS_SERVER(data->inode)->dirty_down);
 		}
@@ -2450,7 +2452,6 @@
 {
 #ifdef CFS_ASYNC_QUEUE
 #ifdef CFS_CHARD_SYNC_FIX
-	struct inode *inode;
 	cnode_t *cnode, *tmp;
 	int err;
 
@@ -2459,18 +2460,14 @@
 	 */
 	list_for_each_entry_safe(cnode, tmp, &server->dirty_down, c_down_list) {
 		list_del_init(&cnode->c_down_list);
-
-		inode = igrab(ctoi(cnode));
 		err = cfs_flush_list(&cnode->c_dirty_down, server->wpages, 0);
 		if (err > 0) {
-			(void) cfs_wait_on_requests(inode, 0, 0);
-			err = cfs_commit_inode(inode, 0, 0, 0);
+			(void) cfs_wait_on_requests(ctoi(cnode), 0, 0);
+			err = cfs_commit_inode(ctoi(cnode), 0, 0, 0);
 		}
-		iput(inode);
-
-		if (err < 0)
-			printk(KERN_ERR "%s: error %d\n",
-				__FUNCTION__, err);
+		if (unlikely(err < 0))
+			printk(KERN_ERR "%s: error %d\n", __FUNCTION__, err);
+		iput(ctoi(cnode)); /* held by dirty_down list */
 	}
 #else /* CFS_CHARD_SYNC_FIX */
 	int err = 0;


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl