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

Roger Tsang <[email protected]> Sun, 02 Oct 2011 22:21:47 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory vz-cvs-3.sog:/tmp/cvs-serv5418/cluster/ssi/cfs

Modified Files:
      Tag: OPENSSI-FC
	write.c 
Log Message:
- cfs_async_handler_commit, cfs_async_handler_write: fix dereferencing freed cfs_write_data struct. (#ifdef CFS_PAGEVEC)
- cfs_writedata_free: no need to test for NULL element in pagevec array since cfs_write_rpcsetup() already did the test. (#ifdef CFS_PAGEVEC)


Index: write.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/write.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- write.c	17 Jan 2011 06:40:50 -0000	1.48
+++ write.c	2 Oct 2011 22:21:45 -0000	1.49
@@ -162,12 +162,12 @@
 {
 #ifdef CFS_PAGEVEC
 #ifdef CFS_ASYNC_LOCAL_SYNC
-	while (p->is_local && p->npages--) {
-		if (p->pagevec[p->npages])
+	if (p->is_local) {
+		while (p->npages--)
 			__free_page(p->pagevec[p->npages]);
 	}
 #endif
-	if (p && (p->pagevec != &p->page_array[0]))
+	if (p->pagevec != &p->page_array[0])
 		kfree(p->pagevec);
 #endif
 	iput(p->inode);
@@ -1167,8 +1167,6 @@
 		cfs_unlock_request(req);
 #endif
 	}
-
-	cfs_writedata_free(data);
 }
 
 /*
@@ -1224,8 +1222,6 @@
 		}
 
 		UNLOCK_COND_LOCK(&mip->mi_cond_lock);
-
-		cfs_writedata_free(data);
 		return 0;
 	}
 done:
@@ -1361,8 +1357,8 @@
 		cfs_unlock_request(req);
 #endif
 	}
-	cfs_writedata_free(data);
 #endif /* !CFS_PAGEVEC */
+	cfs_writedata_free(data);
 }
 
 /* Don't delete this, keeps fs/nfs/write.c comparison */
@@ -1515,6 +1511,7 @@
 	if (data->is_local) {
 		struct cfs_page *cp;
 		/* Unset is_local, do zero-copy if page cache is not virtual */
+		data->is_local = 0;
 		list_for_each_entry(cp, head, wb_list) {
 			if (PageHighMem(cp->wb_page)) {
 				data->is_local = -1;
@@ -1532,8 +1529,7 @@
 				cfs_writedata_free(data);
 				return -ENOMEM;
 			}
-		} else
-			data->is_local = 0;
+		}
 	}
 #else
 	/* Set the initial flags for the task.  */
@@ -1774,7 +1770,6 @@
 	}
 
 	sub_page_state(nr_unstable,res);
-	cfs_commit_free(data);
 }
 
 /*
@@ -1842,7 +1837,6 @@
 #ifdef CFS_CHARD_SYNC_FIX
 		sub_page_state(nr_unstable,res);
 #endif
-		cfs_commit_free(data);
 		return 0;
 	}
 done:
@@ -1957,8 +1951,8 @@
 		res++;
 	}
 	sub_page_state(nr_unstable,res);
-	cfs_commit_free(data);
 #endif /* !CFS_PAGEVEC */
+	cfs_commit_free(data);
 }
 
 #ifdef SSI_XXX	/* Don't delete this, keeps fs/nfs/write.c comparison */


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2