[SSI] openssi/kernel/cluster/ssi/vproc dvp_init.c, 1.15, 1.16 dvp_misc.c, 1.15, 1.16 dvp_pvpops.c, 1.39, 1.40 dvp_pvpsops.c, 1.17, 1.18 dvp_vpops.c, 1.39, 1.40 nd_carelist.c, 1.7, 1.8 nd_cleanup.c, 1.8, 1.9 nd_origin.c, 1.10, 1.11 nd_setup.c, 1.9, 1.10 nd_slave.c, 1.10, 1.11 nd_subr.c, 1.6, 1.7 nsc_initproc.c, 1.22, 1.23 procfs_mount.c, 1.11, 1.12 procfs_subr.c, 1.14, 1.15 reopen.c, 1.31, 1.32 rproc_server_pproc.c, 1.12, 1.13 rproc_svr_pproc.c, 1.24, 1.25 rproc_svr_vproc.c, 1.15, 1.16 vp_subr.c, 1.19, 1.20

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-serv29491/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	dvp_init.c dvp_misc.c dvp_pvpops.c dvp_pvpsops.c dvp_vpops.c 
	nd_carelist.c nd_cleanup.c nd_origin.c nd_setup.c nd_slave.c 
	nd_subr.c nsc_initproc.c procfs_mount.c procfs_subr.c reopen.c 
	rproc_server_pproc.c rproc_svr_pproc.c rproc_svr_vproc.c 
	vp_subr.c 
Log Message:
Bug fixes and enhancements (see ChangeLog)


Index: vp_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/vp_subr.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- vp_subr.c	22 Feb 2009 04:15:37 -0000	1.19
+++ vp_subr.c	24 Mar 2009 04:26:28 -0000	1.20
@@ -39,27 +39,38 @@
 	int			hold)
 #endif
 {
+	register struct vproc	*v;
 #ifdef VPROC_HASH_LIST
-	register struct vproc	*v = NULL;
+#ifdef VPROC_RCU_LIST
+	rcu_read_lock();
+
+	list_for_each_entry_rcu(v, &vproc_hash[VPROCPIDHASH(pid)], vp_list) {
+		if (v->vp_pid == pid) {
+#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
+			/* [ ssic-linux-Bugs-1842982 ] vproc dealloc'ed */
+			if (hold)
+#endif
+			if (!VPROC_HOLD_AND_CHECK(v, "vprocptr"))
+				v = NULL;
+			rcu_read_unlock();
+			return v;
+		}
+	}
+	rcu_read_unlock();
+	return NULL;
+#else /* !VPROC_RCU_LIST */
 	int found = 0;
 
-#ifndef VPROC_RCU_LIST
 	if (needlock)
 		VPROC_LIST_LOCK();
 
 	list_for_each_entry(v, &vproc_hash[VPROCPIDHASH(pid)], vp_list) {
-#else
-	rcu_read_lock();
-
-	list_for_each_entry_rcu(v, &vproc_hash[VPROCPIDHASH(pid)], vp_list) {
-#endif
 		if (v->vp_pid == pid) {
 			found = 1;
 			break;
 		}
 	}
 
-#ifndef VPROC_RCU_LIST
 	if (needlock) {
 #ifdef VPROC_RELEASE__REFCNT_RACE_FIX
 		/* [ ssic-linux-Bugs-1842982 ] vproc dealloc'ed */
@@ -70,20 +81,10 @@
 #endif
 		VPROC_LIST_UNLOCK();
 	}
-#else /* VPROC_RCU_LIST */
-#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
-	/* [ ssic-linux-Bugs-1842982 ] vproc dealloc'ed */
-	if (found && hold != -1 && !VPROC_HOLD_AND_CHECK(v, "vprocptr"))
-		found = 0;
-#endif
-
-	rcu_read_unlock();
-#endif /* VPROC_RCU_LIST */
 
 	return found ? v : NULL;
+#endif /* !VPROC_RCU_LIST */
 #else
-	register struct vproc	*v;
-
 	if (needlock)
 		VPROC_LIST_LOCK();
 
@@ -165,17 +166,29 @@
 	v->vp_index = 0;
 	v->vp_next = NULL;
 #endif
+#if __SSI_LOCK_DEBUG
+	VPROC_REFCNT_LOCK_INIT(v);
+#endif
 #else
 	v = kzmalloc_nofail(size);
 	v->vp_data = ((char *)v) + sizeof(struct vproc);
 	VPROC_REFCNT_LOCK_INIT(v);
 #endif /* !VPROC_KMEM_CACHE */
 
+#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
+	/* VPROC_HOLD(v, "vproc_new(active)"); */
+#ifndef ATOMIC_VPROC_REFCNT
+	v->vp_ref_cnt = 1;
+#else
+	INIT_ATOMIC_INT(&v->vp_ref_cnt, 1);
+#endif
+#else /* !VPROC_RELEASE__REFCNT_RACE_FIX */
 #ifndef ATOMIC_VPROC_REFCNT
 	v->vp_ref_cnt = 0;
 #else
 	INIT_ATOMIC_INT(&v->vp_ref_cnt, 0);
 #endif
+#endif /* !VPROC_RELEASE__REFCNT_RACE_FIX */
 #ifdef VPROC_HASH_LIST
 	INIT_LIST_HEAD(&v->vp_list);
 #endif
@@ -247,9 +260,7 @@
 #else
 	extern void vproc_dealloc(struct vproc	*);
 #endif
-#ifndef VPROC_LIST_SPINLOCK
 	int giveback = 0;	/* dealloc vproc */
-#endif
 #ifndef VPROC_HASH_LIST
 	int locked = 0;		/* tncvpd_scan() has lock ? */
 #endif
@@ -354,9 +365,7 @@
 	else
 		vproc_hash[VPROCPIDHASH(v->vp_pid)] = v->vp_hashfwd;
 #endif
-#ifndef VPROC_LIST_SPINLOCK
 	giveback = 1;
-#endif
 
 out_unlock:
 #ifndef VPROC_HASH_LIST
@@ -371,9 +380,7 @@
 	/*
 	 * Give back vproc storage
 	 */
-#ifndef VPROC_LIST_SPINLOCK
 	if (giveback) {
-#endif
 #ifdef VPROC_HOLD_ZERO_GET_TASK
 		if (PVP(v)->pvp_pproc) {
 			WARN_ON(PV_IS_ALIVE(PVP(v)));
@@ -386,14 +393,16 @@
 #else
 		vproc_dealloc(v);
 #endif
-#ifndef VPROC_LIST_SPINLOCK
 	}
-#endif
 
 	return(ESUCCESS);
 }
 
+#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
+struct vproc *
+#else
 int
+#endif
 vproc_hold(
 	struct vproc *v,
 	int check)
@@ -404,7 +413,7 @@
 		if (!VPROCPTR_VALID(v)) {
 			/* Lost the race */
 			VPROC_REFCNT_UNLOCK(v);
-			return -ESRCH;
+			return NULL;
 		}
 #ifdef ATOMIC_VPROC_REFCNT
 		INCR_ATOMIC_INT(&v->vp_ref_cnt);
@@ -412,7 +421,7 @@
 		v->vp_ref_cnt++;
 #endif
 		VPROC_REFCNT_UNLOCK(v);
-		return (ESUCCESS);
+		return v;
 	}
 #endif /* VPROC_RELEASE__REFCNT_RACE_FIX */
 	BUG_ON(!VPROCPTR_VALID(v));
@@ -426,7 +435,11 @@
 #ifdef NSCVPD_DEBUG
 	PVP(v)->pvp_lasthold = TICKS();
 #endif
+#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
+	return v;
+#else
 	return(ESUCCESS);
+#endif
 }
 
 pid_t ssi_get_ppid(pid_t pid)

Index: nd_setup.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_setup.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- nd_setup.c	9 Feb 2009 05:00:36 -0000	1.9
+++ nd_setup.c	24 Mar 2009 04:26:28 -0000	1.10
@@ -547,7 +547,6 @@
 
 	vproc_carelist_release(vchp);
 #else /* VPROC_LIST_SPINLOCK */
-	struct list_head *pos, *n;
 	struct vproc *vp;
 	int i, holds;
 
@@ -559,12 +558,8 @@
 #error not supported
 #endif
 	for (i=0; i < vprochsz; i++) {
-
 		rcu_read_lock();
-
-		list_for_each_safe_rcu(pos, n, &vproc_hash[i]) {
-			vp = list_entry(pos, struct vproc, vp_list);
-
+		list_for_each_entry_rcu(vp, &vproc_hash[i], vp_list) {
 			if (VPROCNODE(vp->vp_pid) != node)
 				continue;
 
@@ -602,7 +597,6 @@
 			while (holds--)
 				VPROC_RELE(vp, "vproc_release_origin_vprocs");
 		}
-
 		rcu_read_unlock();
 	}
 #endif /* VPROC_LIST_SPINLOCK */

Index: nd_origin.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_origin.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- nd_origin.c	19 Feb 2009 08:01:02 -0000	1.10
+++ nd_origin.c	24 Mar 2009 04:26:28 -0000	1.11
@@ -129,7 +129,11 @@
 		}
 
 #ifdef ND_ORIGIN_DEADLOCK_FIX
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+		VOD_PUT(vodp);
+#else
 		UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 #else
 		UNLOCK_EXCL_RW_LOCK(&vodp->vod_rwlock);
 #endif
@@ -144,7 +148,9 @@
 	/* atomic_set(&vodp->vod_refcnt, 0); */
 #endif
 #endif
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	INIT_RW_LOCK(&vodp->vod_rwlock);
+#endif
 
 	vodp->vod_node = node;
 
@@ -179,14 +185,21 @@
 	INIT_COND_LOCK(&vodp->vod_response_mutex);
 
 	LOCK_SHR_RW_LOCK(&vproc_origin_deactivate_lock);
-#ifdef RCU_VPROC_ORIGIN_LIST
-	spin_lock(&vproc_origin_list_lock);
-#else
+#ifndef RCU_VPROC_ORIGIN_LIST
 	LOCK_EXCL_RW_LOCK(&vproc_origin_list_lock);
 #endif
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	LOCK_COND_LOCK(&vproc_origin_create_mutex);
+#endif
 
 #ifdef VOD_HLIST
+#ifdef RCU_VPROC_ORIGIN_LIST
+	spin_lock(&vproc_origin_list_lock);
+	hlist_add_head_rcu(&vodp->vod_list, &vproc_origin_list);
+	spin_unlock(&vproc_origin_list_lock);
+#else
 	hlist_add_head(&vodp->vod_list, &vproc_origin_list);
+#endif
 #else
 	vodp->vod_next = vproc_origin_list;
 	vodp->vod_prev = NULL;
@@ -195,12 +208,12 @@
 		vproc_origin_list->vod_prev = vodp;
 
 	vproc_origin_list = vodp;
-#endif
+#endif /* !VOD_HLIST */
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	LOCK_COND_LOCK(&vproc_origin_create_mutex);
-#ifdef RCU_VPROC_ORIGIN_LIST
-	spin_unlock(&vproc_origin_list_lock);
-#else
+#endif
+#ifndef RCU_VPROC_ORIGIN_LIST
 	UNLOCK_EXCL_RW_LOCK(&vproc_origin_list_lock);
 #endif
 	UNLOCK_SHR_RW_LOCK(&vproc_origin_deactivate_lock);
@@ -280,12 +293,17 @@
 	}
 #else
 found:
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	/* Wait for lookups that won the race to obtain shared vod_rwlock */
+#endif
+	/* NB: expect zero vod_refcnt most of the time */
 	while (atomic_read(&vodp->vod_refcnt))
 		idelay(HZ/10);
-#endif
+#endif /* RCU_VPROC_ORIGIN_LIST */
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	LOCK_EXCL_RW_LOCK(&vodp->vod_rwlock);
+#endif
 
 	/*
 	 * Remove the vproc origin node data structure from the
@@ -309,7 +327,9 @@
 		vodp->vod_next->vod_prev = vodp->vod_prev;
 #endif
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	UNLOCK_EXCL_RW_LOCK(&vodp->vod_rwlock);
+#endif
 
 #ifndef RCU_VPROC_ORIGIN_LIST
 	UNLOCK_EXCL_RW_LOCK(&vproc_origin_list_lock);
@@ -340,7 +360,9 @@
 	if (vodp->vod_nodelist)
 		NSC_NODELIST_FREE(vodp->vod_nodelist);
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	DEINIT_RW_LOCK(&vodp->vod_rwlock);
+#endif
 	DEINIT_SPIN_LOCK(&vodp->vod_mutex);
 	DEINIT_RW_LOCK(&vodp->vod_carehash_rwlock);
 	DEINIT_LOCK(&vodp->vod_carequeue_mutex);
@@ -386,7 +408,7 @@
 				UNLOCK_SPIN_LOCK(&vodp->vod_mutex);
 				break;
 			}
-			atomic_inc(&vodp->vod_refcnt);
+			VOD_GET(vodp);
 			UNLOCK_SPIN_LOCK(&vodp->vod_mutex);
 			goto found;
 #else
@@ -400,10 +422,12 @@
 found:
 	rcu_read_unlock();
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	if (vodp) {
 		LOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
 		atomic_dec(&vodp->vod_refcnt);
 	}
+#endif
 
 	return vodp;
 #else
@@ -442,7 +466,11 @@
 	vodp->vod_responses = 1;
 	UNLOCK_COND_LOCK(&vodp->vod_response_mutex);
 	SIGNAL_CONDITION(&vodp->vod_response_cond);
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT(vodp);
+#else
 	UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 }
 
 static void
@@ -712,7 +740,11 @@
 		UNLOCK_LOCK(&vodp->vod_carequeue_mutex);
 	}
 
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT(vodp);
+#else
 	UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 
 	return 0;
 }
@@ -799,7 +831,11 @@
 	/*
 	 * Unlock vproc origin data structure held by vproc_origin_find().
 	 */
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT(vodp);
+#else
 	UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 }
 
 /*
@@ -845,7 +881,11 @@
 	/*
 	 * Unlock vproc origin data structure held by vproc_origin_find().
 	 */
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT(vodp);
+#else
 	UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 }
 
 /*
@@ -861,7 +901,7 @@
 	int			vcdcount,
 	int			trans_type)
 {
-	vproc_origin_data_t *vodp = NULL;
+	vproc_origin_data_t *vodp;
 
 	/*
 	 * Because the nodedown routines are run on all nodes in parallel,
@@ -871,8 +911,23 @@
 	 * therefore need to WAIT here until vproc_origin_create() finishes
 	 * and SIGNALs us.
 	 */
-	while (vodp == NULL) {
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+#ifndef RCU_VPROC_ORIGIN_LIST
+#warning not supported
+#endif
+	LOCK_COND_LOCK(&vproc_origin_create_mutex);
+	while (!(vodp = vproc_origin_find_nolock(trans_node))) {
+		WAIT_CONDITION(&vproc_origin_create_cond,
+			       &vproc_origin_create_mutex);
+	}
+	UNLOCK_COND_LOCK(&vproc_origin_create_mutex);
+#else
+	do {
 #ifdef RCU_VPROC_ORIGIN_LIST
+		/* SSI_XXX: might sleep in atomic
+		 * vproc_origin_list_lock	(vproc_origin_inform_surrogate)
+		 * vod_rwlock			(vproc_origin_find_nolock)
+		 */
 		spin_lock(&vproc_origin_list_lock);
 #else
 		LOCK_SHR_RW_LOCK(&vproc_origin_list_lock);
@@ -889,7 +944,8 @@
 				       &vproc_origin_create_mutex);
 		}
 		UNLOCK_COND_LOCK(&vproc_origin_create_mutex);
-	}
+	} while (vodp == NULL);
+#endif /* !VPROC_LOCKING_CONTEXT_FIX */
 
 	/*
 	 * Perform checks to ignore cases where nodedown and failover
@@ -967,7 +1023,11 @@
 	 * Unlock vproc origin data structure held by
 	 * vproc_origin_find().
 	 */
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT(vodp);
+#else
 	UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 }
 
 

Index: nd_slave.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_slave.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- nd_slave.c	9 Feb 2009 05:00:36 -0000	1.10
+++ nd_slave.c	24 Mar 2009 04:26:28 -0000	1.11
@@ -530,6 +530,9 @@
 			       " returned error %d\n",
 			       __FUNCTION__, vnsap->surrogate_node, error);
 		}
+#ifdef VPROC_CARECOUNT_FIX
+		vproc_caredata_dealloc(vcdp, vcdcount);
+#endif
 	} else if (vcdcount) {
 		error = PVPSOP_INFORM_SURROGATE_RPC(vnsap->surrogate_node,
 						this_node,

Index: rproc_svr_vproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_svr_vproc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- rproc_svr_vproc.c	9 Feb 2009 05:00:36 -0000	1.15
+++ rproc_svr_vproc.c	24 Mar 2009 04:26:28 -0000	1.16
@@ -103,6 +103,16 @@
 			 PV_PROC_ORIGIN;
 
 	/*
+	 * Point the child's pvproc at its underlying pproc (proc.h)
+	 * structure.  Then initialize some more fields of the pvproc
+	 * structure.
+	 */
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	get_task_struct(procp);
+#endif
+	pvc->pvp_pproc = procp;	/* as returned by the physical layer */
+
+	/*
 	 * Continue to set up the data structures of the newly created
 	 * child's vproc + pvproc.
 	 */
@@ -124,20 +134,12 @@
 	if (v)
 		v->vp_hashbwd = vc;
 #endif
+#ifndef VPROC_RELEASE__REFCNT_RACE_FIX
 	VPROC_HOLD(vc, "rfork_server(active)");
+#endif
 	VPROC_LIST_UNLOCK();
 	VPROC_HOLD(vc, "rfork_server(origin)");
 
-	/*
-	 * Point the child's pvproc at its underlying pproc (proc.h)
-	 * structure.  Then initialize some more fields of the pvproc
-	 * structure.
-	 */
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	get_task_struct(procp);
-#endif
-	pvc->pvp_pproc = procp;	/* as returned by the physical layer */
-
 	/* sort out the immediate family relationships */
 #ifdef VPROC_PVP_CHILD_LL
 	/* already done in vproc_alloc; keep for reference */

Index: rproc_server_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_server_pproc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rproc_server_pproc.c	10 Oct 2008 08:10:32 -0000	1.12
+++ rproc_server_pproc.c	24 Mar 2009 04:26:28 -0000	1.13
@@ -146,7 +146,10 @@
 		get_task_struct(current);
 #endif
 		pve->pvp_pproc = current;
+
+		write_lock_irq(&tasklist_lock);
 		current->p_vproc = ve;
+		write_unlock_irq(&tasklist_lock);
 
 		/*
 		 * Wakeup the parent server process. Note that this is
@@ -202,8 +205,10 @@
 #ifndef VPROC_HOLD_ZERO_GET_TASK
 		pvm->pvp_pproc = NULL;
 #endif
+		write_lock_irq(&tasklist_lock);
 		p->clear_child_tid = NULL;
 		p->p_vproc = vm;
+		write_unlock_irq(&tasklist_lock);
 
 		pproc_remove_process();
 

Index: reopen.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/reopen.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- reopen.c	19 Feb 2009 08:01:02 -0000	1.31
+++ reopen.c	24 Mar 2009 04:26:28 -0000	1.32
@@ -230,8 +230,7 @@
 	flckp->filockdata_list_t_len = count;
 
 	/* Allocate memory for export lock data */
-	lockp = (struct filockdata *)kzmalloc(
-				(sizeof(struct filockdata) * count), GFP_USER);
+	lockp = kzmalloc(count * sizeof(*lockp), GFP_USER);
 	if (!lockp)
 		return -ENOMEM;
 
@@ -568,21 +567,28 @@
 	unsigned long ino)
 #endif
 {
-	int count, ctr;
-	char *pathname;
 #ifndef REOP_EXPORT_PATH_SVRNODE
 	unsigned long svrnode;
+	int count, ctr;
 #endif
+	char *pathname = *name;
 
-	pathname = *name;
 	if (*pathname == '/')
 		return ssi_path_init(pathname, 0, nd);
 
-	/*
-	 * SSI_XXX: We're hashing remote pipes and sockets by name, but
-	 * the base hashes the local form by inode number. This may be
-	 * a problem.
-	 */
+#ifdef REOP_EXPORT_PATH_SVRNODE
+	if (!strncmp(pathname, "pipe:", 5)) {
+		nd->mnt = mntget(pipe_mnt);
+		pathname += 5;
+	} else if (!strncmp(pathname, "socket:", 7)) {
+		nd->mnt = mntget(sock_mnt);
+		pathname += 7;
+	} else
+		return -1;
+
+	/* fool path_walk() */
+	*name = pathname;
+#else
 	count = 0;
 	if (!strncmp(pathname, "pipe:", 5)) {
 		nd->mnt = mntget(pipe_mnt);
@@ -600,9 +606,12 @@
 		pathname++;
 
 	*name = pathname;
+#endif
 
+#ifndef SSI_LOOKUP_DENTRY_HASH
 	nd->last_type = LAST_ROOT;
 	nd->flags = 0;
+#endif
 	nd->dentry = dget(nd->mnt->mnt_root);
 
 #ifndef REOP_EXPORT_PATH_SVRNODE
@@ -625,26 +634,48 @@
 		this.len = strlen(pathname);
 		this.hash = ino;
 		dentry = d_lookup(nd->dentry, &this);
+#ifdef REOPDEBUG
+		printk(KERN_DEBUG "reop_import_pathinit: d_lookup() dentry=%p name=%s hash=%d\n",
+					dentry, pathname, (int)ino);
+#endif
 		if (!dentry)
-#ifndef REOPDEBUG
-			return -ENOENT;
-#else
-		/* SSI_XXX: This is not happening ?! */
-		{
-			printk(KERN_DEBUG "reop_import_pathinit: d_lookup() failed name=%s hash=%d\n",
-						pathname, (int)ino);
 			return -ENOENT;
-		}
-		else
-			printk(KERN_DEBUG "reop_import_pathinit: d_lookup() success name=%s hash=%d\n",
-						pathname, (int)ino);
-#endif
 		dput(nd->dentry);
-		mb(); /* need this? */
 		nd->dentry = dentry;
 		return 0;
 	}
+#ifdef SSI_LOOKUP_DENTRY_HASH
+	else {
+		struct path next;
+		struct qstr this;
+		int ret;
+
+		/* SSI_XXX: redundant w/ above */
+		this.name = pathname;
+		this.len = strlen(pathname);
+		this.hash = ino; /* pipe or socket */
+
+		ret = do_lookup(nd, &this, &next);
+#ifdef REOPDEBUG
+		printk(KERN_DEBUG "reop_import_pathinit: do_lookup() ret=%d name=%s hash=%d\n",
+					ret, pathname, (int)ino);
+#endif
+		if (ret)
+			return ret;
+		dput(nd->dentry);
+		nd->dentry = next.dentry;
+		return 0;
+	}
+	/* not reached */
+	BUG();
+#else
+	/*
+	 * SSI_XXX: We're hashing remote pipes and sockets by name, but
+	 * the base hashes the local form by inode number. This may be
+	 * a problem.
+	 */
 	return 1;
+#endif /* !SSI_LOOKUP_DENTRY_HASH */
 }
 
 static inline int
@@ -810,9 +841,11 @@
 		} else {
 			error = 0;
 			*dentryp = result;
-			/* SSI_XXX: This is scary without locking */
 			*mntp = lookup_mnt_uniqueid(path->mntid);
+#ifndef CFS_VFSMOUNT_RACE_FIX
+			/* SSI_XXX: This is scary without locking */
 			mntget(*mntp);
+#endif
 			goto out;
 		}
 	}
@@ -845,7 +878,6 @@
 
 		dput(*dentryp);
 		mntput(*mntp);
-		mb(); /* need this? */
 		*dentryp = NULL;
 		*mntp = NULL;
 	}

Index: nd_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_subr.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- nd_subr.c	3 Feb 2009 06:18:13 -0000	1.6
+++ nd_subr.c	24 Mar 2009 04:26:28 -0000	1.7
@@ -62,10 +62,18 @@
 	if (vodp) {
 		if ((vodp->vod_flags & VOD_PENDING) &&
 		    origin_node != this_node) {
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+			VOD_PUT(vodp);
+#else
 			UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 			return NULL;
 		}
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+		return (void *)vodp;
+#else
 		return (void *)(&vodp->vod_rwlock);
+#endif
 	}
 
 	return NULL;
@@ -78,7 +86,11 @@
 vproc_unlock_origin_node(
 	void *lockp)
 {
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VOD_PUT((vproc_origin_data_t *)lockp);
+#else
 	UNLOCK_SHR_RW_LOCK((RW_LOCK_T *)lockp);
+#endif
 }
 
 /*
@@ -123,14 +135,22 @@
 		 * We report this node as not being the origin node until
 		 * setup is completed.
 		 */
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+		VOD_PUT(vodp);
+#else
 		UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 		return 0;
 	}
 	else {
 		/*
 		 * This node is the origin node for the process.
 		 */
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+		VOD_PUT(vodp);
+#else
 		UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 		return 1;
 	}
 }

Index: procfs_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/procfs_subr.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- procfs_subr.c	19 Feb 2009 08:01:02 -0000	1.14
+++ procfs_subr.c	24 Mar 2009 04:26:28 -0000	1.15
@@ -11,7 +11,11 @@
 #include <cluster/ssi/rcopy.h>
 #include <cluster/gen/reopen.h>
 
+#ifdef PROC_LARGE_MAXPIDS
+#define PROC_MAXPIDS VPROC_MAXPIDS
+#else
 #define PROC_MAXPIDS 20
+#endif
 
 struct proc_root_readdir_cookie {
 	unsigned int cur_index;
@@ -31,11 +35,20 @@
 
 	if (PVP(current->p_vproc)->pvp_localview)
 		return 0;
+#ifdef PROC_LARGE_MAXPIDS
+	cp = kmalloc(sizeof(*cp), GFP_KERNEL);
+#else
 	cp = kzmalloc(sizeof(*cp), GFP_KERNEL);
+#endif
 	if (cp == NULL)
 		return -ENOMEM;
-	/* cp->start_index = 0; */
-	/* cp->cur_index = 0; */
+#ifdef PROC_LARGE_MAXPIDS
+	cp->cur_index = 0;
+	cp->start_node = 0;
+	cp->h_index = 0;
+	cp->v_index = 0;
+	cp->start_index = 0;
+#endif
 	file->private_data = cp;
 	return 0;
 }
@@ -46,6 +59,7 @@
 	if (PVP(current->p_vproc)->pvp_localview)
 		return 0;
 	kfree(file->private_data);
+	file->private_data = NULL;
 	return 0;
 }
 
@@ -293,10 +307,20 @@
 			*pgrp = -1;
 			return error;
 		}
-		if (to_node == this_node)
+		if (to_node == this_node) {
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+			/* SSI_XXX: might sleep in following path...
+			 * rssi_tty_get_pgrp, ssi_get_tty, devpts_get_tty,
+			 * get_node
+			 */
+			read_unlock(&tasklist_lock);
+#endif
 			error = rssi_tty_get_pgrp(to_node, &rerror,
 						  cttydev, pgrp);
-		else if (to_node >= 1) {
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+			read_lock(&tasklist_lock);
+#endif
+		} else if (to_node >= 1) {
 			read_unlock(&tasklist_lock);
 			error = RSSI_TTY_GET_PGRP(to_node, &rerror,
 						  cttydev, pgrp);

Index: procfs_mount.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/procfs_mount.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- procfs_mount.c	27 Apr 2005 00:41:17 -0000	1.11
+++ procfs_mount.c	24 Mar 2009 04:26:28 -0000	1.12
@@ -88,8 +88,7 @@
 proc_notify_all(struct vfsmount *mnt, struct nameidata *nd, int flags)
 {
 	struct super_block *sb = mnt->mnt_sb;
-	struct dentry *root_dentry = sb->s_root;
-	struct inode *root = root_dentry->d_inode;
+	struct inode *root = sb->s_root->d_inode;
 	nsc_nodelist_t *nl;
 	nsc_nlcookie_t cookie;
 	clusternode_t node;
@@ -305,7 +304,9 @@
 		BUG();
 	}
 
+#ifndef CFS_VFSMOUNT_RACE_FIX
 	mntget(mnt);
+#endif
 
 	if (atomic_read(&mnt->mnt_count) != 2)
 		retval = -EBUSY;
@@ -317,7 +318,7 @@
 
 	/* On error don't keep vfsmount held */
 	if (retval != 0)
-		mntput(mnt);
+		_mntput(mnt);
 
 	*rval = retval;
 	return 0;
@@ -338,12 +339,15 @@
 		printk("cfsd_proc_umount_0; Can't find vfsmount\n");
 		BUG();
 	}
+#ifdef CFS_VFSMOUNT_RACE_FIX
+	_mntput(mnt); /* for the lookup */
+#endif
 
 	/* vfsmount should have the right number of holds due to prep above. */
 
 	retval = do_umount(mnt, flags);
 
-	mntput(mnt);
+	_mntput(mnt);
 
 	*rval = retval;
 	return 0;
@@ -367,8 +371,10 @@
 		BUG();
 	}
 
+#ifdef CFS_VFSMOUNT_RACE_FIX
+	_mntput(mnt); /* for the lookup */
+#endif
 	/* SSI_XXX: Release lock held in prep umount above */
-
 	mntput(mnt);
 
 	*rval = 0;
@@ -386,8 +392,7 @@
 	int *payload_len)
 {
 	struct super_block *sb = mnt->mnt_sb;
-	struct dentry *root_dentry = sb->s_root;
-	struct inode *root = root_dentry->d_inode;
+	struct inode *root = sb->s_root->d_inode;
 	static char proc_type[] = "proc";
 	struct proc_mount_data *cmdp;
 	char *cmap;

Index: nsc_initproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nsc_initproc.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- nsc_initproc.c	9 Feb 2009 05:00:36 -0000	1.22
+++ nsc_initproc.c	24 Mar 2009 04:26:28 -0000	1.23
@@ -201,9 +201,6 @@
 #else
 		list_add_rcu(&v->vp_list, &vproc_hash[VPROCPIDHASH(v->vp_pid)]);
 #endif
-#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
-		VPROC_HOLD(v, "initialize_init_vproc");
-#endif
 		VPROC_LIST_UNLOCK();
 #else
 		w = vproc_hash[hashidx = VPROCPIDHASH(v->vp_pid)];
@@ -222,6 +219,9 @@
 	pvp->pvp_flag |= PV_PROCESS|
 			 PV_IS_ORIGIN|
 			 PV_PROC_ORIGIN|
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+			 PV_SYS|
+#endif
 			 PV_IS_TGID;
 
 

Index: dvp_vpops.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_vpops.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- dvp_vpops.c	9 Feb 2009 05:00:36 -0000	1.39
+++ dvp_vpops.c	24 Mar 2009 04:26:28 -0000	1.40
@@ -358,6 +358,14 @@
 
 	VPROC_LOCK_EXCL(vc,"vpop_fork(child)");
 
+	/*
+	 * point the vproc at the physical process
+	 */
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	get_task_struct(procp);
+#endif
+	pvc->pvp_pproc = procp;
+
 	/* put the vproc on the vproc hash chain */
 	vc->vp_pid = child_pid;
 	VPROC_LIST_LOCK();
@@ -375,28 +383,19 @@
 	if (w)
 		w->vp_hashbwd = vc;
 #endif
-	VPROC_HOLD(vc, "vpop_fork(origin)");
-	VPROC_LIST_UNLOCK();
+#ifndef VPROC_RELEASE__REFCNT_RACE_FIX
 	VPROC_HOLD(vc, "vpop_fork(active)");
+#endif
+	VPROC_LIST_UNLOCK();
+	VPROC_HOLD(vc, "vpop_fork(origin)");
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	VPROC_LOCK_FLAG(vc, "vpop_fork");
-
-	/*
-	 * point the vproc at the physical process
-	 */
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	get_task_struct(procp);
 #endif
-	pvc->pvp_pproc = procp;
 
 	/* sort out the immediate family relationships */
 	VPROC_LOCK_ND_LIST_EXCL(pp, "vpop_fork");
 #ifdef VPROC_PVP_CHILD_LL
-#if 0
-	/* already done in vproc_alloc; keep for reference */
-	INIT_LIST_HEAD(&pvc->pvp_sibling);
-	INIT_LIST_HEAD(&pvc->pvp_children);
-#endif
 	PVP_ADD_PARENT(pvc, pvp);
 #else
 	pvc->pvp_childl = pvp->pvp_head_childl; /* put child on its parent's */
@@ -405,6 +404,9 @@
 	pvc->pvp_head_childl = NULL;	/* child has no children */
 #endif /* !VPROC_PVP_CHILD_LL */
 	VPROC_UNLOCK_ND_LIST_EXCL(pp, "vpop_fork");
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+	VPROC_LOCK_FLAG(vc, "vpop_fork");
+#endif
 	pvc->pvp_ppid = pp->vp_pid;	/* set child's parent id */
 	pvc->pvp_pgid = pvp->pvp_pgid;	/* child's pgrp is parent's */
 	pvc->pvp_sid = pvp->pvp_sid;	/* child's session is parent's */
@@ -414,6 +416,7 @@
 	pvc->pvp_loadlevel = pvp->pvp_loadlevel; /* child inherits loadlevel */
 	pvc->pvp_localview = pvp->pvp_localview; /* child inherits view */
 
+#ifndef VPROC_LOCKING_CONTEXT_FIX
 	 if (!(local_flags & IS_KTHREAD)) {
 		 /* if not a kernel daemon(kernel daemons cant move) and parent
 		  * hasnt been set yet then set it now, so child
@@ -426,6 +429,7 @@
 		 }
 #endif
 	}
+#endif /* !VPROC_LOCKING_CONTEXT_FIX */
 	/*
 	 * These values are only guaranteed to be accurate at the origin
 	 * node of the process.
@@ -1607,7 +1611,11 @@
 next_thread:
 			tsk = next_thread(tsk);
 			if (tsk != parent) {
+#ifdef LINUX_SSI_EVENT
+				VPROC_WAIT_EVENT_SIGNAL(tsk->p_vproc);
+#else
 				VPROC_WAIT_EVENT_BROADCAST(tsk->p_vproc);
+#endif
 				goto next_thread;
 			}
 			read_unlock(&tasklist_lock);
@@ -1679,7 +1687,11 @@
 			/* Need to wake up every thread in parent group */
 			read_lock(&tasklist_lock);
 			while_each_thread(parent, tsk) {
+#ifdef LINUX_SSI_EVENT
+				VPROC_WAIT_EVENT_SIGNAL(tsk->p_vproc);
+#else
 				VPROC_WAIT_EVENT_BROADCAST(tsk->p_vproc);
+#endif
 			}
 			read_unlock(&tasklist_lock);
 		}

Index: dvp_pvpops.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_pvpops.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- dvp_pvpops.c	7 Feb 2009 04:19:43 -0000	1.39
+++ dvp_pvpops.c	24 Mar 2009 04:26:28 -0000	1.40
@@ -3126,7 +3126,11 @@
 					      NULL);
 		if (*sigp == -1)
 			dpvproc_nocldwait_async_queue(p, v);
+#ifdef LINUX_SSI_EVENT
+		VPROC_WAIT_EVENT_SIGNAL(p);
+#else
 		VPROC_WAIT_EVENT_BROADCAST(p);
+#endif
 		break;
 	case VPROC_STOP:
 		VPROC_LOCK_FLAG(v, "pvpop_report_state");
@@ -3141,7 +3145,11 @@
 		error = PVPOP_SIGPROC(p, sig, 0, pinfo,
 				      VSIG_INTERNAL|VSIG_CHILD_STOP, NULL);
 #endif
+#ifdef LINUX_SSI_EVENT
+		VPROC_WAIT_EVENT_SIGNAL(p);
+#else
 		VPROC_WAIT_EVENT_BROADCAST(p);
+#endif
 		break;
 	case VPROC_UNSTOP:
 		VPROC_LOCK_FLAG(v, "pvpop_report_state");
@@ -3167,7 +3175,11 @@
 #endif
 		}
 #endif /* VPROC_CONTINUE_SIGCHLD */
+#ifdef LINUX_SSI_EVENT
+		VPROC_WAIT_EVENT_SIGNAL(p);
+#else
 		VPROC_WAIT_EVENT_BROADCAST(p);
+#endif
 #endif /* VPROC_CONTINUE */
 		break;
 	case VPROC_TRAP:
@@ -3195,7 +3207,11 @@
 		 */
 		/* FALLTHROUGH */
 	case VPROC_LEFT_PGRP:
+#ifdef LINUX_SSI_EVENT
+		VPROC_WAIT_EVENT_SIGNAL(p);
+#else
 		VPROC_WAIT_EVENT_BROADCAST(p);
+#endif
 		break;
 	default:
 		printk("pvpop_report_state no case for state %x\n", state);
@@ -4066,11 +4082,6 @@
 	/*
 	 * Perform operation locally.
 	 */
-#ifdef VPROC_RW_LOCK
-	VPROC_LOCK_SHARED(v, "pvpop_procfs_getattr");
-#else
-	VPROC_LOCK_EXCL(v, "pvpop_procfs_getattr");
-#endif
 
 #ifdef VPROC_HOLD_ZERO_GET_TASK
 	if (!PV_IS_ALIVE(pvp)) {
@@ -4078,6 +4089,11 @@
 		goto out;
 	}
 #else
+#ifdef VPROC_RW_LOCK
+	VPROC_LOCK_SHARED(v, "pvpop_procfs_getattr");
+#else
+	VPROC_LOCK_EXCL(v, "pvpop_procfs_getattr");
+#endif
 	if (pvp->pvp_pproc == NULL) {
 		error = -ESRCH;
 		goto out;
@@ -4099,11 +4115,13 @@
 		*tgid = pvp->pvp_pproc->tgid;
 
 out:
+#ifndef VPROC_HOLD_ZERO_GET_TASK
 #ifdef VPROC_RW_LOCK
 	VPROC_UNLOCK_SHARED(v, "pvpop_procfs_getattr");
 #else
 	VPROC_UNLOCK_EXCL(v, "pvpop_procfs_getattr");
 #endif
+#endif
 
 	VPROC_RELEASE_MOVEMENT(v, "pvpop_procfs_getattr");
 	return(error);
@@ -4158,15 +4176,15 @@
 
 	len = -ENOENT;
 	*buflen = 0;
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	if (!PV_IS_ALIVE(pvp))
+		goto out;
+#else
 #ifdef VPROC_RW_LOCK
 	VPROC_LOCK_SHARED(v, "pvpop_proc_read");
 #else
 	VPROC_LOCK_EXCL(v, "pvpop_proc_read");
 #endif
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	if (!PV_IS_ALIVE(pvp))
-		goto out;
-#else
 	if (!pvp->pvp_pproc)
 		goto out;
 #endif
@@ -4176,11 +4194,13 @@
 		*buflen = len;
 
 out:
+#ifndef VPROC_HOLD_ZERO_GET_TASK
 #ifdef VPROC_RW_LOCK
 	VPROC_UNLOCK_SHARED(v, "pvpop_proc_read");
 #else
 	VPROC_UNLOCK_EXCL(v, "pvpop_proc_read");
 #endif
+#endif
 	VPROC_RELEASE_MOVEMENT(v, "pvpop_proc_read");
 	return(len);
 }
@@ -4256,16 +4276,16 @@
 	/*
 	 * Perform operation locally.
 	 */
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	if (!PV_IS_ALIVE(pvp))
+		goto out;
+#else
 #ifdef VPROC_RW_LOCK
 	VPROC_LOCK_SHARED(v, "pvpop_proc_readlink");
 #else
 	VPROC_LOCK_EXCL(v, "pvpop_proc_readlink");
 #endif
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	if (!PV_IS_ALIVE(pvp)) {
-#else
 	if (!pvp->pvp_pproc) {
-#endif
 #ifdef VPROC_RW_LOCK
 		VPROC_UNLOCK_SHARED(v, "pvpop_proc_readlink");
 #else
@@ -4273,8 +4293,19 @@
 #endif
 		goto out;
 	}
+	get_task_struct(pvp->pvp_pproc);
+	/* NB: We used to call do_proc_links() with VPROC lock held. */
+#ifdef VPROC_RW_LOCK
+	VPROC_UNLOCK_SHARED(v, "pvpop_proc_readlink");
+#else
+	VPROC_UNLOCK_EXCL(v, "pvpop_proc_readlink");
+#endif
+#endif /* !VPROC_HOLD_ZERO_GET_TASK */
 
 	error = do_proc_links(v, type, buffer, buflen, de, vfsmnt);
+#ifndef VPROC_HOLD_ZERO_GET_TASK
+	put_task_struct(pvp->pvp_pproc);
+#endif
 out:
 	VPROC_RELEASE_MOVEMENT(v, "pvpop_proc_readlink");
 	return(error);
@@ -4400,22 +4431,16 @@
 	 */
 	*buflen = 0;
 	num = 0;
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	if (!PV_IS_ALIVE(pvp))
+		goto out;
+	task = pvp->pvp_pproc;
+#else
 #ifdef VPROC_RW_LOCK
 	VPROC_LOCK_SHARED(v, "pvpop_proc_readfd");
 #else
 	VPROC_LOCK_EXCL(v, "pvpop_proc_readfd");
 #endif
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	if (!PV_IS_ALIVE(pvp)) {
-#ifdef VPROC_RW_LOCK
-		VPROC_UNLOCK_SHARED(v, "pvpop_proc_readfd");
-#else
-		VPROC_UNLOCK_EXCL(v, "pvpop_proc_readfd");
-#endif
-		goto out;
-	}
-	task = pvp->pvp_pproc;
-#else
 	task = pvp->pvp_pproc;
 	if (!task) {
 #ifdef VPROC_RW_LOCK
@@ -4431,11 +4456,13 @@
 	if (files)
 		atomic_inc(&files->count);
 	task_unlock(task);
+#ifndef VPROC_HOLD_ZERO_GET_TASK
 #ifdef VPROC_RW_LOCK
 	VPROC_UNLOCK_SHARED(v, "pvpop_proc_readfd");
 #else
 	VPROC_UNLOCK_EXCL(v, "pvpop_proc_readfd");
 #endif
+#endif
 	if (!files)
 		goto out;
 	for (fd = ppos; fd < files->max_fds && num < alloclen; fd++) {
@@ -4499,22 +4526,16 @@
 	 * Perform operation locally.
 	 */
 	error = -ENOENT;
+#ifdef VPROC_HOLD_ZERO_GET_TASK
+	if (!PV_IS_ALIVE(pvp))
+		goto out;
+	task = pvp->pvp_pproc;
+#else
 #ifdef VPROC_RW_LOCK
 	VPROC_LOCK_SHARED(v, "pvpop_proc_check_fd");
 #else
 	VPROC_LOCK_EXCL(v, "pvpop_proc_check_fd");
 #endif
-#ifdef VPROC_HOLD_ZERO_GET_TASK
-	if (!PV_IS_ALIVE(pvp)) {
-#ifdef VPROC_RW_LOCK
-		VPROC_UNLOCK_SHARED(v, "pvpop_proc_check_fd");
-#else
-		VPROC_UNLOCK_EXCL(v, "pvpop_proc_check_fd");
-#endif
-		goto out;
-	}
-	task = pvp->pvp_pproc;
-#else
 	task = pvp->pvp_pproc;
 	if (!task) {
 #ifdef VPROC_RW_LOCK
@@ -4527,11 +4548,13 @@
 	}
 #endif /* !VPROC_HOLD_ZERO_GET_TASK */
 	files = get_files_struct(task);
+#ifndef VPROC_HOLD_ZERO_GET_TASK
 #ifdef VPROC_RW_LOCK
 	VPROC_UNLOCK_SHARED(v, "pvpop_proc_check_fd");
 #else
 	VPROC_UNLOCK_EXCL(v, "pvpop_proc_check_fd");
 #endif
+#endif
 	if (!files)
 		goto out;
 	spin_lock(&files->file_lock);

Index: rproc_svr_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_svr_pproc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- rproc_svr_pproc.c	12 Feb 2009 03:13:13 -0000	1.24
+++ rproc_svr_pproc.c	24 Mar 2009 04:26:28 -0000	1.25
@@ -266,36 +266,29 @@
 	struct dentry *root, *old;
 	struct vfsmount *rootmnt, *oldmnt, *lastrootmnt;
 
-	read_lock(&current->fs->lock);
+	write_lock(&current->fs->lock);
 	oldmnt = rootmnt = mntget(current->fs->rootmnt);
 	old = dget(current->fs->root);
-	read_unlock(&current->fs->lock);
 
 	/* Find top-of-tree; don't use "rootfs" filesystem. */
 	spin_lock(&dcache_lock);
-	lastrootmnt = rootmnt;
-	while (rootmnt != rootmnt->mnt_parent) {
-		lastrootmnt = rootmnt;
-		rootmnt = rootmnt->mnt_parent;
-	}
+	for (lastrootmnt = rootmnt;
+	     rootmnt != rootmnt->mnt_parent;
+	     lastrootmnt = rootmnt, rootmnt = rootmnt->mnt_parent)
+		;
 	rootmnt = lastrootmnt;
 	root = lastrootmnt->mnt_root;
 	spin_unlock(&dcache_lock);
 
 	if (root != old || rootmnt != oldmnt) {
-		mntget(rootmnt);
-		dget(root);
-		mntput(oldmnt);
-		dput(old);
-
-		read_lock(&current->fs->lock);
 		mntput(current->fs->rootmnt);
 		dput(current->fs->root);
-		mb(); /* need this? */
-		current->fs->rootmnt = rootmnt;
-		current->fs->root = root;
-		read_unlock(&current->fs->lock);
+		current->fs->rootmnt = mntget(rootmnt);
+		current->fs->root = dget(root);
 	}
+	mntput(oldmnt);
+	dput(old);
+	write_unlock(&current->fs->lock);
 }
 
 /*
@@ -330,26 +323,23 @@
 	if (!pwd || !root)
 		goto rap_fail;
 
-	read_lock(&current->fs->lock);
+	write_lock(&current->fs->lock);
 	mntput(current->fs->pwdmnt);
 	dput(current->fs->pwd);
-	mb(); /* need this? */
 	current->fs->pwdmnt = pwdmnt;
 	current->fs->pwd = pwd;
 	if (altroot) {
 		mntput(current->fs->altrootmnt);
 		dput(current->fs->altroot);
-		mb(); /* need this? */
 		current->fs->altrootmnt = altrootmnt;
 		current->fs->altroot = altroot;
 	}
 	mntput(current->fs->rootmnt);
 	dput(current->fs->root);
-	mb(); /* need this? */
 	current->fs->rootmnt = rootmnt;
 	current->fs->root = root;
 	current->fs->umask = comm_datap->comm_umask;
-	read_unlock(&current->fs->lock);
+	write_unlock(&current->fs->lock);
 
 	return 0;
 

Index: dvp_pvpsops.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_pvpsops.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dvp_pvpsops.c	9 Feb 2009 05:00:36 -0000	1.17
+++ dvp_pvpsops.c	24 Mar 2009 04:26:28 -0000	1.18
@@ -917,8 +917,6 @@
 	spin_unlock(&capability_spin_lock);
 }
 
-#define PROC_MAXPIDS 20
-
 int
 pvpsop_get_tgid_list(
 	clusternode_t node,
@@ -962,9 +960,7 @@
 	 * is somewhat better to count from the back to see new
 	 * processes that have been added since the last iteration.
 	 */
-#ifdef VPROC_RCU_LIST
-	rcu_read_lock();
-#else
+#ifndef VPROC_RCU_LIST
 	 /* We still will tend to do worse than the base. */
 	VPROC_LIST_LOCK();
 #endif
@@ -972,7 +968,7 @@
 #ifdef VPROC_HASH_LIST
 		lcount = 0;
 #ifdef VPROC_RCU_LIST
-		/* SSI_XXX: no reverse traversal for RCU */
+		rcu_read_lock();
 		list_for_each_entry_rcu(vp, &vproc_hash[i], vp_list) {
 #else
 		list_for_each_entry_reverse(vp, &vproc_hash[i], vp_list) {
@@ -986,10 +982,9 @@
 		for (lcount = 0; vp != NULL; vp = vp->vp_hashbwd) {
 			prefetch(vp->vp_hashbwd);
 #endif
-			if (vp->vp_pid &&
-					(PVP(vp)->pvp_flag & PV_PROC_ORIGIN) && 
-					!(PVP(vp)->pvp_flag & PV_SYS) && 
-					(PVP(vp)->pvp_flag & PV_IS_TGID)) {
+			if (vp->vp_pid && !(PVP(vp)->pvp_flag & PV_SYS) &&
+			    (PVP(vp)->pvp_flag & (PV_PROC_ORIGIN|PV_IS_TGID)) ==
+			     (PV_PROC_ORIGIN|PV_IS_TGID)) {
 				if (elem_index > lcount++)
 					continue;
 				(*pids)[count++] = vp->vp_pid;
@@ -997,21 +992,22 @@
 					break;
 			}
 		}
+#ifdef VPROC_RCU_LIST
+		rcu_read_unlock();
+#endif
 		elem_index = 0;
 		if (count >= *pids_size)
 			break;
 	}
-#ifdef VPROC_RCU_LIST
-	rcu_read_unlock();
-#else
+#ifndef VPROC_RCU_LIST
 	VPROC_LIST_UNLOCK();
 #endif
 	*hash_index = i;
 	*vproc_index = lcount;
 	*pids_size = count;
 	return 0;
-
 }
+
 /*
  * Set task capability lock on desired node
  */
@@ -1048,8 +1044,8 @@
 		ssi_block_signals(current, &old_blocked);
 		while (capability_lock_owner != -1 &&
 		       capability_lock_owner != lock_pid) {
-			__set_current_state(TASK_INTERRUPTIBLE);
 			add_wait_queue_exclusive(&capability_wqh, &wait);
+			set_current_state(TASK_INTERRUPTIBLE);
 			spin_unlock(&capability_spin_lock);
 			schedule();
 			remove_wait_queue(&capability_wqh, &wait);

Index: nd_carelist.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_carelist.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- nd_carelist.c	3 Feb 2009 06:18:13 -0000	1.7
+++ nd_carelist.c	24 Mar 2009 04:26:28 -0000	1.8
@@ -183,9 +183,18 @@
 	void *args)
 {
 	vproc_caredata_t *vcdp, *vcdbufp, *vcdbuf2p, *vcdentp;
+#ifdef VPROC_CARECOUNT_FIX
+	size_t carecount, cares_packed;
+
+	/* SSI_XXX: vproc_caredata_alloc() bounded by size_t */
+	BUG_ON(vchp->vch_carecount > UINT_MAX);
+
+	carecount = (size_t) vchp->vch_carecount;
+#else
 	int carecount, cares_packed;
 
 	carecount = vchp->vch_carecount;
+#endif
 	if (carecount == 0) {
 		*vcdpp = NULL;
 		*vcdcntp = 0;
@@ -207,6 +216,9 @@
 	}
 
 	if (cares_packed == 0) {
+#ifdef VPROC_CARECOUNT_FIX
+		vproc_caredata_dealloc(vcdbufp, carecount);
+#endif
 		*vcdpp = NULL;
 		*vcdcntp = 0;
 	} else if (cares_packed < carecount) {

Index: dvp_init.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_init.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dvp_init.c	22 Feb 2009 04:15:37 -0000	1.15
+++ dvp_init.c	24 Mar 2009 04:26:28 -0000	1.16
@@ -65,20 +65,6 @@
 		pvp->pvp_flag |= PV_PROCESS | PV_PROC_ORIGIN |
 			PV_PGRP_ORIGIN | PV_SESS_ORIGIN;
 
-		/* put the vproc on the vproc hash chain */
-#ifdef VPROC_HASH_LIST
-		list_add(&v->vp_list, &vproc_hash[VPROCPIDHASH(v->vp_pid)]);
-#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
-		VPROC_HOLD(v, "dpvproc_init0");
-#endif
-#else
-		w = vproc_hash[hashidx = VPROCPIDHASH(v->vp_pid)];
-		v->vp_hashbwd = NULL;
-		v->vp_hashfwd = w;
-		vproc_hash[hashidx] = v;
-		if (w)
-			w->vp_hashbwd = v;
-#endif
 		/*
 		 * point the vproc at the physical process
 		 */
@@ -109,6 +95,17 @@
 		 */
 		pvp->pvp_flag |= PV_NOCLDWAIT;
 
+		/* put the vproc on the vproc hash chain */
+#ifdef VPROC_HASH_LIST
+		list_add(&v->vp_list, &vproc_hash[VPROCPIDHASH(v->vp_pid)]);
+#else
+		w = vproc_hash[hashidx = VPROCPIDHASH(v->vp_pid)];
+		v->vp_hashbwd = NULL;
+		v->vp_hashfwd = w;
+		vproc_hash[hashidx] = v;
+		if (w)
+			w->vp_hashbwd = v;
+#endif
 	}
 #ifndef VPROC_RELEASE__REFCNT_RACE_FIX
 	VPROC_HOLD(v, "dpvproc_init0");
@@ -229,13 +226,9 @@
 #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
 			list_add(&vp->vp_list, &vproc_hash[VPROCPIDHASH(pid)]);
-#ifdef VPROC_RELEASE__REFCNT_RACE_FIX
-			VPROC_HOLD(vp, str);
-#endif
 #endif
 #else /* !VPROC_HASH_LIST */
 			w = vproc_hash[hashidx = VPROCPIDHASH(pid)];
@@ -272,7 +265,7 @@
 	 */
 	if (nvp != NULL)
 #ifdef VPROC_RCU_LIST
-		vproc_dealloc(&nvp->vp_rcu);
+		VPROC_RELE(nvp, str);
 #else
 		vproc_dealloc(nvp);
 #endif
@@ -342,7 +335,7 @@
 	 *	 sleep, so dpvproc_struct_init() should not be called
 	 *	 with spin locks held.
 	 */
-#ifndef VPROC_KMEM_CACHE
+#if __SSI_LOCK_DEBUG || !defined(VPROC_KMEM_CACHE)
 	VPROC_LOCK_INIT(v);
 	VPROC_LOCK_ND_LIST_INIT(v);
 	VPROC_LOCK_PGRP_LIST_INIT(v);
@@ -385,7 +378,11 @@
 	SSI_ASSERT(pvp->pvp_pgrpl == NULL);
 	SSI_ASSERT(pvp->pvp_sessionl == NULL);
 
-#ifndef VPROC_KMEM_CACHE
+#if __SSI_LOCK_DEBUG || !defined(VPROC_KMEM_CACHE)
+	/* To support __SSI_LOCK_DEBUG we must de-init here
+	 * because later kernels removed slab alloc: destructors
+	 * http://www.mail-archive.com/[email protected]/msg13529.html
+	 */
 	VPROC_LOCK_DEINIT(v);
 	VPROC_LOCK_ND_LIST_DEINIT(v);
 	VPROC_LOCK_PGRP_LIST_DEINIT(v);

Index: nd_cleanup.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/nd_cleanup.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- nd_cleanup.c	10 Oct 2008 08:10:32 -0000	1.8
+++ nd_cleanup.c	24 Mar 2009 04:26:28 -0000	1.9
@@ -657,7 +657,11 @@
 	}
 
 	if (origin_node != CLUSTERNODE_INVAL)
+#ifdef VPROC_LOCKING_CONTEXT_FIX
+		VOD_PUT(vodp);
+#else
 		UNLOCK_SHR_RW_LOCK(&vodp->vod_rwlock);
+#endif
 
 	return 0;
 }

Index: dvp_misc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_misc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dvp_misc.c	12 Feb 2009 03:13:13 -0000	1.15
+++ dvp_misc.c	24 Mar 2009 04:26:28 -0000	1.16
@@ -365,30 +365,47 @@
 void
 dvp_set_exec(struct file *f)
 {	
+	struct dentry *de;
+	struct vfsmount *mnt;
+
+	write_lock_irq(&tasklist_lock);
+	de = PVP(current->p_vproc)->pvp_comm_de;
+	mnt = PVP(current->p_vproc)->pvp_comm_mnt;
+	mb();
+
 	/* set the dentry and mnt ptrs for the executable name */
-	dput(PVP(current->p_vproc)->pvp_comm_de);
-	mntput(PVP(current->p_vproc)->pvp_comm_mnt);
-	mb(); /* need this? */
 	PVP(current->p_vproc)->pvp_comm_de = dget(f->f_dentry);
 	PVP(current->p_vproc)->pvp_comm_mnt = mntget(f->f_vfsmnt);
+	write_unlock_irq(&tasklist_lock);
+
+	dput(de);
+	mntput(mnt);
 }
 
 void
 dvp_clear_exec(struct file *f)
 {
+	struct dentry *de;
+	struct vfsmount *mnt;
+
+	write_lock_irq(&tasklist_lock);
+
 	/* release and clear the ptrs for the executable name */
 	if (f) {
-		dput(f->f_dentry);
-		mntput(f->f_vfsmnt);
-	}
-	else {
-		dput(PVP(current->p_vproc)->pvp_comm_de);
-		mntput(PVP(current->p_vproc)->pvp_comm_mnt);
+		de = f->f_dentry;
+		mnt = f->f_vfsmnt;
+	} else {
+		de = PVP(current->p_vproc)->pvp_comm_de;
+		mnt = PVP(current->p_vproc)->pvp_comm_mnt;
+		mb();
 	}
-	mb(); /* need this? */
 
 	PVP(current->p_vproc)->pvp_comm_de = NULL;
 	PVP(current->p_vproc)->pvp_comm_mnt = NULL;
+	write_unlock_irq(&tasklist_lock);
+
+	dput(de);
+	mntput(mnt);
 }
 
 int


------------------------------------------------------------------------------
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.