[SSI] openssi/kernel/cluster/ssi/vproc dvp_init.c, 1.12, 1.13 vp_subr.c, 1.17, 1.18

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

Modified Files:
      Tag: OPENSSI-FC
	dvp_init.c vp_subr.c 
Log Message:
VPROC:
- Regression:
  - VPROC_LOCATE_PID() race could corrupt vproc hash table. (#ifdef VPROC_RCU_LIST)

 dvp_init.c |   29 +++++++++++++----------------
 vp_subr.c  |    1 +
 2 files changed, 14 insertions(+), 16 deletions(-)


Index: vp_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/vp_subr.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- vp_subr.c	9 Feb 2009 05:00:36 -0000	1.17
+++ vp_subr.c	9 Feb 2009 06:06:34 -0000	1.18
@@ -188,6 +188,7 @@
 #endif
 	vp->vp_magic = 0;
 	dpvproc_struct_deinit(vp);
+	VPROC_REFCNT_LOCK_DEINIT(vp);
 #ifdef VPROC_KMEM_CACHE
 	kmem_cache_free(vproc_cachep, vp);
 #else

Index: dvp_init.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_init.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dvp_init.c	9 Feb 2009 05:00:36 -0000	1.12
+++ dvp_init.c	9 Feb 2009 06:06:34 -0000	1.13
@@ -159,12 +159,9 @@
 		return NULL;
 
 #ifndef VPROC_RCU_LIST
-	if (!(flags & LVP_NOLOCK)) {
-#ifndef VPROC_HASH_LIST
+	if (!(flags & LVP_NOLOCK))
 		VPROC_LIST_LOCK();
 #endif
-	}
-#endif
 
 	vp = VPROCPTR_NOLOCK(pid);
 
@@ -173,6 +170,10 @@
 	 * checking.
 	 */
 	if (vp == NULL){
+#ifndef VPROC_RCU_LIST
+		if (!(flags & LVP_NOLOCK))
+			VPROC_LIST_UNLOCK();
+#endif
 		/*
 		 * If this is the origin node of the pid, we just return
 		 * 0 because the origin should always retain a vproc
@@ -180,10 +181,6 @@
 		 */
 		if (!(flags & LVP_NOFAIL) &&
 		     ((flags & LVP_ORIGIN) || PID_IS_AT_ORIGIN(pid))) {
-#ifndef VPROC_HASH_LIST
-			if (!(flags & LVP_NOLOCK))
-				VPROC_LIST_UNLOCK();
-#endif
 			vp = NULL;
 			goto out;
 		}
@@ -205,6 +202,9 @@
 		 * Make sure here that during the last vproc_alloc()
 		 * call, nobody has created a new vproc for this pid.
 		 */
+		if (!(flags & LVP_NOLOCK))
+			VPROC_LIST_LOCK();
+
 		vp = VPROCPTR_NOLOCK(pid);
 		if (vp == NULL) {
 			vp = nvp;
@@ -215,20 +215,15 @@
 			vp->vp_pid = pid;
 #ifdef VPROC_HASH_LIST
 #ifdef VPROC_RCU_LIST
-			VPROC_LIST_LOCK();
 			list_add_rcu(&vp->vp_list, &vproc_hash[VPROCPIDHASH(pid)]);
 			VPROC_HOLD(vp, str);
-			VPROC_LIST_UNLOCK();
 #else
-			/* SSI_XXX: support LVP_NOLOCK */
-			/* SSI: LVP_NOLOCK not used. */
-			SSI_ASSERT(!(flags & LVP_NOLOCK));
 			list_add(&vp->vp_list, &vproc_hash[VPROCPIDHASH(pid)]);
 #ifdef VPROC_RELEASE__REFCNT_RACE_FIX
 			VPROC_HOLD(vp, str);
 #endif
 #endif
-#else
+#else /* !VPROC_HASH_LIST */
 			w = vproc_hash[hashidx = VPROCPIDHASH(pid)];
 			vp->vp_hashbwd = NULL;
 			vp->vp_hashfwd = w;
@@ -238,6 +233,10 @@
 #endif
 			nvp = NULL;
 		}
+#ifdef VPROC_RCU_LIST
+		if (!(flags & LVP_NOLOCK))
+			VPROC_LIST_UNLOCK();
+#endif
 	}
 
 #ifndef VPROC_RCU_LIST
@@ -245,9 +244,7 @@
 	VPROC_HOLD(vp, str);
 #endif
 	if (!(flags & LVP_NOLOCK))
-#ifndef VPROC_HASH_LIST
 		VPROC_LIST_UNLOCK();
-#endif
 #endif /* !VPROC_RCU_LIST */
 #ifdef VPROC_DEBUG
 	vproc_db4(vp, "LOCATE HOLD", str, 0);


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/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.