Re: Giant pushdown in kern_descrip.c rev 1.128

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Tue, 17 Jun 2003 20:08:50 -0700 (PDT)
On 17 Jun, Alfred Perlstein wrote:
> * Don Lewis <truckman_at_FreeBSD.org> [030617 13:06] wrote:
>> On 17 Jun, Alfred Perlstein wrote:
>> > * Don Lewis <truckman_at_FreeBSD.org> [030617 12:00] wrote:
>> >> It's not legal to attempt to aquire Giant in fdrop_locked(), while
>> >> FILE_LOCK() is held.  The problem is that FILE_LOCK uses the mutex pool,
>> >> which should only be used for leaf mutexes.
>> >> 
>> >> It also looks like there is a potential for a lock order reversal if
>> >> some callers aquire Giant before FILE_LOCK() and fdrop_locked() does the
>> >> opposite.
>> >> 
>> >> It also appears that witness ignores the mutex pool ...
>> > 
>> > Yes, but I think the fix is as simple as just dropping the FILE_LOCK
>> > after the decrement as we're the last holders of it, can you try
>> > this:
>> 
>> I like simple fixes, especially when the code shrinks ;-)
>> 
>> Unfortunately, I think your point about this only happening because this
>> process is the last holder of the file means that this doesn't explain
>> Peter's deadlock.
> 
> You can still deadlock because another file's mutex may hash to the same
> location.

... or some other user of the mutex pool that happens to hold Giant.

I'm in favor of committing your patch, though I think it should be
commented to indicate why it is safe to play with fp after the mutex has
been unlocked.
Received on Tue Jun 17 2003 - 18:09:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:12 UTC