[SSI] openssi/kernel/cluster/ssi/vproc pproc_subr.c,1.13,1.14

Roger Tsang <[email protected]> Mon, 25 Oct 2010 06:09:53 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15007/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	pproc_subr.c 
Log Message:
Stop using tasklist_lock in pproc_setattr(), pproc_getattr(), pproc_setctty(), pproc_getctty().


Index: pproc_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/pproc_subr.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pproc_subr.c	18 Nov 2009 06:16:53 -0000	1.13
+++ pproc_subr.c	25 Oct 2010 06:09:51 -0000	1.14
@@ -41,7 +41,7 @@
 int pproc_setattr(struct task_struct *p, struct vproc *vp, pid_t *pidp,
 		  pid_t *ppidp, pid_t *pgrpp, pid_t *sidp, int *has_sctty)
 {
-	write_lock_irq(&tasklist_lock);
+	/* Called with EX VPROC LOCK */
 	if (vp)
 		p->p_vproc = vp;
 	if (pidp) {
@@ -56,7 +56,6 @@
 		if (sidp)
 			p->signal->session = *sidp;
 	}
-	write_unlock_irq(&tasklist_lock);
 
 	return 0;
 }
@@ -78,9 +77,7 @@
 int pproc_getattr(struct task_struct *p, pid_t *pidp, pid_t *ppidp, pid_t *pgrpp,
 	      pid_t *sidp, int *has_sctty, int *has_execed)
 {
-	SSI_ASSERT(p != NULL);
-
-	read_lock(&tasklist_lock);
+	/* Called with VPROC LOCK */
 	if (pidp)
 		*pidp = p->pid;
 	if (ppidp)
@@ -93,7 +90,6 @@
 	}
 	if (has_execed)
 		*has_execed = (int) p->did_exec;
-	read_unlock(&tasklist_lock);
 
 	return 0;
 }
@@ -127,33 +123,27 @@
 	 * task_lock		(pproc_setctty)
 	 */
 #else
+	SSI_ASSERT((flag & (VCTTY_SETCTTY|VCTTY_CLEARCTTY)) !=
+				(VCTTY_SETCTTY|VCTTY_CLEARCTTY));
 	lock_kernel(); /* protect tty_old_pgrp. see disassociate_ctty() */
 #endif
-	read_lock(&tasklist_lock);
-	if (p->signal) {
-#ifdef PPROC_SETCTTY_SIGLOCK
-		SSI_ASSERT((flag & (VCTTY_SETCTTY|VCTTY_CLEARCTTY)) !=
-					(VCTTY_SETCTTY|VCTTY_CLEARCTTY));
-#endif
-		task_lock(p);
-		if (flag & VCTTY_SETCTTY) {
-			SSI_ASSERT(cttydev != NODEV);
-			p->signal->cttydev = cttydev;
-			p->signal->cttynode = cttynode;
+	task_lock(p);
+	if (flag & VCTTY_SETCTTY) {
+		SSI_ASSERT(cttydev != NODEV);
+		p->signal->cttydev = cttydev;
+		p->signal->cttynode = cttynode;
+		p->signal->tty_old_pgrp = 0;
+	}
+	if (flag & VCTTY_CLEARCTTY) {
+		p->signal->cttydev = NODEV;
+		p->signal->cttynode = CLUSTERNODE_INVAL;
+		/* SSI_XXX_LR: temp hack until tty stuff figure out */
+		if (flag & VCTTY_SETLDR) {
+			p->signal->leader = 1;
 			p->signal->tty_old_pgrp = 0;
 		}
-		if (flag & VCTTY_CLEARCTTY) {
-			p->signal->cttydev = NODEV;
-			p->signal->cttynode = CLUSTERNODE_INVAL;
-			/* SSI_XXX_LR: temp hack until tty stuff figure out */
-			if (flag & VCTTY_SETLDR) {
-				p->signal->leader = 1;
-				p->signal->tty_old_pgrp = 0;
-			}
-		}
-		task_unlock(p);
 	}
-	read_unlock(&tasklist_lock);
+	task_unlock(p);
 #ifdef PPROC_SETCTTY_SIGLOCK
 	unlock_kernel();
 #endif
@@ -173,10 +163,6 @@
 /* Called with VPROC_HOLD_MOVEMENT */
 int pproc_getctty(struct task_struct *p, dev_t *cttydev, clusternode_t *cttynode)
 {
-	if (!p->signal)
-		return 0;
-
-	read_lock(&tasklist_lock);
 	if (p->signal) {
 		task_lock(p);
 		if (cttydev)
@@ -185,7 +171,6 @@
 			*cttynode = p->signal->cttynode;
 		task_unlock(p);
 	}
-	read_unlock(&tasklist_lock);
 
 	return 0;
 }


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev