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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Louis Rilling
Date: Thursday, December 18, 2008 - 4:15 am

On 18/12/08  1:27 -0800, Joel Becker wrote:

Perhaps I didn't explain myself well. Quoting my original post:

<quote>
I am proposing two solutions:
1) one that wraps recursive mutex_lock()s with
   lockdep_off()/lockdep_on().
2) (as suggested earlier by Peter Zijlstra) one that puts the
   i_mutexes recursively locked in different classes based on their
   depth from the top-level config_group created. This
   induces an arbitrary limit (MAX_LOCK_DEPTH - 2 == 46) on the
   nesting of configfs default groups whenever lockdep is activated
   but this limit looks reasonably high. Unfortunately, this alos
   isolates VFS operations on configfs default groups from the others
   and thus lowers the chances to detect locking issues.

This patch implements solution 1).

Solution 2) looks better from lockdep's point of view, but fails with
configfs_depend_item(). This needs to rework the locking
scheme of configfs_depend_item() by removing the variable lock recursion
depth, and I think that it's doable thanks to the configfs_dirent_lock.
For now, let's stick to solution 1).
</quote>

Solution 2) does not play with i_mutex sub-classes as I proposed earlier, but
instead put default_groups' i_mutex in separate classes (actually one class per
default group depth). This is not worse than putting each run queue lock in a
separate class, as it used to be.

For instance, if a created group A has default groups A/B, A/D, and A/B/C, A's
i_mutex class will be the regular i_mutex class used everywhere else in the VFS,
A/B and A/D will have default_group_class[0], and A/B/C will have
default_group_class[1].

Of course those default_group classes will not benefit from locking schemes seen
by lockdep outside configfs, but they still will interact nicely with the VFS.
Moreover, a default group depth limit of 46 (MAX_LOCK_DEPTH - 2) looks rather
reasonable, doesn't it?

To me the real drawback of this solution is that it needs to rework locking in
configfs_depend_item(). Peter says it is preferable, I know how it could be
done, but as any code rework this may bring new bugs, and I realize that I'm
spending time to explain this while 1) I don't have much time to just explain
what could be done, 2) I'd prefer having time to code what I am explaining.
Let's see if I can show you something today.

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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
configfs, dlm_controld &amp; lockdep, Steven Whitehouse, (Thu Dec 11, 7:20 am)
Re: configfs, dlm_controld &amp; lockdep, Louis Rilling, (Thu Dec 11, 7:44 am)
Re: configfs, dlm_controld &amp; lockdep, Joel Becker, (Thu Dec 11, 10:34 am)
Re: configfs, dlm_controld &amp; lockdep, Louis Rilling, (Fri Dec 12, 3:06 am)
Re: [PATCH] configfs: Silence lockdep on mkdir(), rmdir() ..., Louis Rilling, (Thu Dec 18, 4:15 am)
Re: [PATCH] configfs: Silence lockdep on mkdir(), rmdir() ..., Steven Whitehouse, (Thu Dec 18, 4:26 am)
Make lockdep happy with configfs, Louis Rilling, (Thu Dec 18, 11:00 am)
Re: Make lockdep happy with configfs, Louis Rilling, (Mon Jan 26, 4:51 am)
Re: Make lockdep happy with configfs, Joel Becker, (Tue Jan 27, 8:44 pm)