[RFC][PATCH 1/4] Prepare i_mutex lockdep subclasses for locking of variable path lengths

From: Louis Rilling
Date: Thu May 22 2008 - 07:53:21 EST


Some filesystems, like configfs, need to lock more than two regular inodes
recursively in a tree, which i_mutex lockdep subclasses do not permit.

This patch reorders the definitions (but not the semantics) of i_mutex lockdep
sub-classes so that nested i_mutex locking can be done with sub-classes
I_MUTEX_PARENT -> I_MUTEX_CHILD -> I_MUTEX_CHILD + 1 -> I_MUTEX_CHILD + 2 -> ...
until MAX_LOCKDEP_SUBCLASSES - 1.

Signed-off-by: Louis Rilling <Louis.Rilling@xxxxxxxxxxx>
---
include/linux/fs.h | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)


Index: b/include/linux/fs.h
===================================================================
--- a/include/linux/fs.h 2008-05-21 09:40:28.000000000 +0200
+++ b/include/linux/fs.h 2008-05-22 12:20:20.000000000 +0200
@@ -660,20 +660,23 @@ struct inode {
* inode->i_mutex nesting subclasses for the lock validator:
*
* 0: the object of the current VFS operation
- * 1: parent
- * 2: child/target
- * 3: quota file
+ * 1: xattrs
+ * 2: quota file
+ * 3: parent
+ * 4: child/target
+ * ...: lower-level children
*
* The locking order between these classes is
- * parent -> child -> normal -> xattr -> quota
+ * parent -> child -> sub-children... -> normal -> xattr -> quota
*/
enum inode_i_mutex_lock_class
{
I_MUTEX_NORMAL,
+ I_MUTEX_XATTR,
+ I_MUTEX_QUOTA,
I_MUTEX_PARENT,
I_MUTEX_CHILD,
- I_MUTEX_XATTR,
- I_MUTEX_QUOTA
+ /* Reserved for variable paths of nested inode locks */
};

extern void inode_double_lock(struct inode *inode1, struct inode *inode2);

--
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

--
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/