cvs commit: src/sys/dev/md md.c

Jeremie Le Hen jeremie at le-hen.org
Mon Jan 24 05:46:01 PST 2005


> Can you add some more yourself ?  We need to find out where Giant
> is lost, it is picked up here:
> 
>         case MD_VNODE:
>                 mtx_lock(&Giant);
>                 hasgiant = 1;
>                 break;
> 
> And only dropped again when we exit.
> 
> Somehow it gets lost on your machine and there is nothing but for us
> to find out where.
> 
> Can you try if you can reproduce it with WITNESS enabled  ?

First, I want to tell that I have triggered the panic even with
softupdates disabled.  When I first tried it, I thought the panic was
occuring immediately on creation of the first md(4) device, therefore
when I succeeded in creating /dev/md0 with a non-softupdates filesystem,
I believed this was related.

In fact, I think now it's clearly a race condition since the panic is
not reproducible in a deterministic way.  Sometimes it occurs on the
first creation of a md(4) device, sometimes I have to create up to
4 devices to get it triggered.

While talking about WITNESS, I checked my kernel config and remembered
that FULL_PREEMPTION is on.  The panic disappeared when I turned off
the latter : I managed to create up to about 16 md(4) devices.  I know
this should not be enabled for users, but I'm interested in "exposing
race conditions" as said in the comment.  I think you don't really have
time to fix this kind of bugs caused by FULL_PREEMPTION so I'll try
myself.  I'm sorry for wasting your time.

FYI, here is my kernel configuration:
%%%
  options         PREEMPTION
  options         FULL_PREEMPTION
  options         MUTEX_DEBUG
  options         KDB
  options         DDB
  options         INVARIANT_SUPPORT
  options         INVARIANTS
  options         DIAGNOSTIC
  options         WITNESS
  options         WITNESS_KDB
  
  options         SCHED_ULE
%%%

Following some advices from a friend of mine, I'm going to give a try
to the KTR tracing facility.  First I wanted to set a watchpoint on
Giant, but I've been told that this feature is not very efficient and
furthermore I'm dreading that Giant might be used many times a second.

Advices and help are of course welcome.
-- 
Jeremie Le Hen
jeremie at le-hen.org


More information about the freebsd-current mailing list