Re: [PATCH] nfsd: lockdep annotation

From: Peter Zijlstra
Date: Thu Aug 24 2006 - 02:55:46 EST


On Thu, 2006-08-24 at 16:12 +1000, Neil Brown wrote:
> On Wednesday August 23, a.p.zijlstra@xxxxxxxxx wrote:
> > Hi,
> >
> > while doing a kernel make modules_install install over an NFS mount.
> > (
> >
> > =============================================
> > [ INFO: possible recursive locking detected ]
> > ---------------------------------------------
>
> Thanks for the patch. I had a patch to fix this in my queue, but I
> just hadn't got around to submitting it yet :-(
> Never mind, we'll go with yours and Andrew already has it.
>
> I had flags the fh_lock in nfsd_setattr a I_MUTEX_CHILD which you
> didn't however I see that isn't needed (Why do we have PARENT and
> CHILD and NORMAL.... you would think that any two would do ??)

I_MUTEX_CHILD is only used in renames. All other childs are left
unannotated, it feels a bit sloppy (and it probably is) but it works
out. Unannotated lock operations are a separate class on their own, as
are I_MUTEX_NORMAL (used when you don't feel like figuring out which
would be the proper level, and there is no further nesting AFAIK).

This way you'll end up with PARENT -> {NORMAL, unannotated} which is as
valid as PARENT -> CHILD.
The only danger would be if you also have a locking sequence like CHILD
-> PARENT, that could go unnoticed, because the other direction is not
from CHILD. This could hide real deadlocks.

/me looks at Arjan, did I get it right?

> However there is a bit missing: the fh_lock in nfsd_proc_create
> in nfsproc.c needs I_MUTEX_PARENT - I'll send a separate patch to fix
> that.

Ah, right, must've overlooked it.

Thanks

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/