svn commit: r208876 - head/sys/netinet

Robert Watson rwatson at FreeBSD.org
Tue Jun 8 16:05:04 UTC 2010


On Mon, 7 Jun 2010, Pawel Jakub Dawidek wrote:

>>   1) Further enhance the INVARIANT lock validation (no locks) are
>>      held by checking the create and inp locks as well.
> [...]
>> +	if (mtx_owned(&inp->inp_create_mtx)) {
>> +		panic("Own create lock on inp");
>> +	}
>> +	if (mtx_owned(&inp->inp_mtx)) {
>> +		panic("Own inp lock on inp");
>> +	}
>
> If you replace this with:
>
> 	mtx_assert(&inp->inp_create_mtx, MA_NOTOWNED);
> 	mtx_assert(&inp->inp_mtx, MA_NOTOWNED);
>
> But the kernel has to be compiled with INVARIANTS to make it work.

It might be worth mimicking the locking assertions from in_pcb.h, even though 
these data structures are different.

Robert


More information about the svn-src-head mailing list