Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Oct 2004 16:54:41 +0200
From:      Uwe Doering <gemini@geminix.org>
To:        freebsd-stable@freebsd.org
Subject:   Re: panic caused by EVFILT_SIGNAL detaching in rfork()ed thread
Message-ID:  <417A70B1.50009@geminix.org>
In-Reply-To: <417A6347.8090207@geminix.org>
References:  <20041023003246.Y91215@is.park.rambler.ru> <417A6347.8090207@geminix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Uwe Doering wrote:
> Igor Sysoev wrote:
> 
>> Here is more correct patch to fix the panic in 4.x reported in
>> http://freebsd.rambler.ru/bsdmail/freebsd-hackers_2004/msg02732.html
>>
>> -------------------------
>> --- src/sys/kern/kern_event.c   Sun Oct 10 12:17:55 2004
>> +++ src/sys/kern/kern_event.c   Sun Oct 10 12:19:29 2004
>> @@ -794,7 +794,8 @@
>>             while (kn != NULL) {
>>                 kn0 = SLIST_NEXT(kn, kn_link);
>>                 if (kq == kn->kn_kq) {
>> -                   kn->kn_fop->f_detach(kn);
>> +                   if (!(kn->kn_status & KN_DETACHED))
>> +                       kn->kn_fop->f_detach(kn);
>>         /* XXX non-fd release of kn->kn_ptr */
>>                     knote_free(kn);
>>                     *knp = kn0;
>> -------------------------
> 
> 
> Your patch appears to be an excerpt from the fix to RELENG_5.  May I 
> suggest a different approach for RELENG_4?  My reasoning is that the 
> implementation of kevents differs between RELENG_4 and RELENG_5.
> 
> In RELENG_5 the flag KN_DETACHED is used in a more general way.  It gets 
> set by knlist_add() and cleared by knlist_remove(), in sync with list 
> insertion and removal.
> [...]

Slight correction: The logic is of course the other way round.  That is, 
the text is supposed to read:

   It gets cleared by knlist_add() and set by knlist_remove() ...

Sorry about that. :-)

    Uwe
-- 
Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers
gemini@geminix.org  |  http://www.escapebox.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?417A70B1.50009>