Please help reviewing ! Got another crash because of the
ttymodem() / ttyclose() race
Martin Blapp
mb at imp.ch
Sat Jul 8 06:40:44 UTC 2006
Hi,
> Yes.. did you see my reply on the mailing list
Ouch ? No I missed that ! Thanks. I just read it.
> I'm not sure that the proctree_lock should protect t_pgrp as that is part
> of the tty structure, not process groups or session structures.
Hmm ? In /usr/src/sys/kern/tty.c:1215 we copy in ttioctl() the pointers of
p->p_session and p->p_pgrp to the tty structure.
1215 tp->t_session = p->p_session;
1216 tp->t_pgrp = p->p_pgrp;
1217 SESS_LOCK(p->p_session);
It looks to me that we have to protect it with the locks of the
process groups or session structures since its only a copy of the pointer,
and not an exact copy. Else I wouldn't had any crashes - this is the mess.
Or do I understand something completly wrong ?
>I think probably it should be protected by Giant for now until the tty subsystem
>is locked. Also, the ttyinfo() part will not work since it tries to
>acquire a mutex (PGRP_LOCK()) while holding a spin mutex (sched_lock).
Ok, fixed. Does it look better now ?
Btw. this version is now running for three days without any crashes on four
SMP boxes. Rocking stable so far.
>perhaps instead we need to expand Giant to cover it until the tty subsystem is
>locked?
How would you do that ?
Martin
More information about the freebsd-current
mailing list