Protect enterpgrp() against another tty/proc race case until the tty locking work

has been fixed.

MFC after:	1 week
This commit is contained in:
Martin Blapp 2006-09-23 17:35:24 +00:00
parent f1edc3bde5
commit 45e6819160
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162581

View File

@ -313,6 +313,7 @@ enterpgrp(p, pgid, pgrp, sess)
PROC_LOCK(p);
p->p_flag &= ~P_CONTROLT;
PROC_UNLOCK(p);
mtx_lock(&Giant); /* XXX TTY */
PGRP_LOCK(pgrp);
sess->s_leader = p;
sess->s_sid = p->p_pid;
@ -325,6 +326,7 @@ enterpgrp(p, pgid, pgrp, sess)
KASSERT(p == curproc,
("enterpgrp: mksession and p != curproc"));
} else {
mtx_lock(&Giant); /* XXX TTY */
pgrp->pg_session = p->p_session;
SESS_LOCK(pgrp->pg_session);
pgrp->pg_session->s_count++;
@ -342,6 +344,7 @@ enterpgrp(p, pgid, pgrp, sess)
pgrp->pg_jobc = 0;
SLIST_INIT(&pgrp->pg_sigiolst);
PGRP_UNLOCK(pgrp);
mtx_unlock(&Giant); /* XXX TTY */
doenterpgrp(p, pgrp);