svn commit: r255727 - stable/9/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Sep 20 07:31:33 UTC 2013


Author: kib
Date: Fri Sep 20 07:31:32 2013
New Revision: 255727
URL: http://svnweb.freebsd.org/changeset/base/255727

Log:
  MFC r255509:
  Reduce the scope of the proctree_lock.

Modified:
  stable/9/sys/kern/subr_prf.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_prf.c
==============================================================================
--- stable/9/sys/kern/subr_prf.c	Fri Sep 20 05:06:03 2013	(r255726)
+++ stable/9/sys/kern/subr_prf.c	Fri Sep 20 07:31:32 2013	(r255727)
@@ -151,26 +151,25 @@ uprintf(const char *fmt, ...)
 	PROC_LOCK(p);
 	if ((p->p_flag & P_CONTROLT) == 0) {
 		PROC_UNLOCK(p);
-		retval = 0;
-		goto out;
+		sx_sunlock(&proctree_lock);
+		return (0);
 	}
 	SESS_LOCK(p->p_session);
 	pca.tty = p->p_session->s_ttyp;
 	SESS_UNLOCK(p->p_session);
 	PROC_UNLOCK(p);
 	if (pca.tty == NULL) {
-		retval = 0;
-		goto out;
+		sx_sunlock(&proctree_lock);
+		return (0);
 	}
 	pca.flags = TOTTY;
 	pca.p_bufr = NULL;
 	va_start(ap, fmt);
 	tty_lock(pca.tty);
+	sx_sunlock(&proctree_lock);
 	retval = kvprintf(fmt, putchar, &pca, 10, ap);
 	tty_unlock(pca.tty);
 	va_end(ap);
-out:
-	sx_sunlock(&proctree_lock);
 	return (retval);
 }
 
@@ -211,6 +210,7 @@ tprintf(struct proc *p, int pri, const c
 	va_start(ap, fmt);
 	if (pca.tty != NULL)
 		tty_lock(pca.tty);
+	sx_sunlock(&proctree_lock);
 	kvprintf(fmt, putchar, &pca, 10, ap);
 	if (pca.tty != NULL)
 		tty_unlock(pca.tty);
@@ -218,7 +218,6 @@ tprintf(struct proc *p, int pri, const c
 	if (sess != NULL)
 		sess_release(sess);
 	msgbuftrigger = 1;
-	sx_sunlock(&proctree_lock);
 }
 
 /*


More information about the svn-src-all mailing list