Re: [PATCH] configfs: Silence lockdep on mkdir(), rmdir() andconfigfs_depend_item()

From: Louis Rilling
Date: Mon Jan 26 2009 - 09:00:54 EST


On 26/01/09 14:41 +0100, Peter Zijlstra wrote:
> On Mon, 2009-01-26 at 14:24 +0100, Louis Rilling wrote:
>
> > However configfs_rmdir() and configfs_mkdir() (recursively) lock inodes because
> > this is how the VFS works when removing/adding entries under a directory which
> > has already lived in the dcache.
>
> Ok, so then I'm not understanding things correctly.

You may understand the VFS better than I do actually.

>
> Its not a locking correctness thing, but simply not being able to do it
> from the vfs calls because those assume locks held?
>
> Can't you simply punt the work to a worklet once you've created/removed
> the non-default group, which can be done from within the vfs callback ?

I'm not sure to understand your suggestion. Is this:
1) for mkdir(), create the non-default group, but without its default groups,
and defer their creation to a worker which won't have constraints on locks held
by any caller;
2) for rmdir(), unlink the non-default group, but without unlinking its default
groups, and defer the recursive work to a lock-free context?

For mkdir(), this may work. Maybe a bit confusing for userspace, since mkdir(A)
returns as soon as A is created, but A may be populated later and userspace may
rely on A being populated as soon as it is created (current behavior). As a
configfs user, this makes my life harder...

For rmdir(), is this safe to unlink a non-empty directory, and to empty it
afterwards? This looks like going back to the unmount problem.

Thanks,

Louis

--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes

Attachment: signature.asc
Description: Digital signature