public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: Joel.Becker@oracle.com
Cc: ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
	Louis Rilling <Louis.Rilling@kerlabs.com>
Subject: [RFC][PATCH 1/4] Prepare i_mutex lockdep subclasses for locking of variable path lengths
Date: Thu, 22 May 2008 13:40:49 +0200	[thread overview]
Message-ID: <20080522114947.310735375@kerlabs.com> (raw)
In-Reply-To: 20080522114048.265996107@kerlabs.com

[-- Attachment #1: prepare-variable-path-lengths-inode-locking.patch --]
[-- Type: text/plain, Size: 1726 bytes --]

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@kerlabs.com>
---
 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


  reply	other threads:[~2008-05-22 11:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 11:40 [RFC][PATCH 0/4] configfs: Make nested default groups lockdep-friendly v2 Louis Rilling
2008-05-22 11:40 ` Louis Rilling [this message]
2008-05-22 11:40 ` [RFC][PATCH 2/4] Prepare vfs_rmdir() for further nested i_mutex locking Louis Rilling
2008-05-22 11:40 ` [RFC][PATCH 3/4] configfs: Make nested default groups creations lockdep-friendly Louis Rilling
2008-05-22 11:40 ` [RFC][PATCH 4/4] configfs: Make multiple default_group destructions lockdep friendly Louis Rilling
2008-05-23 16:44   ` Louis Rilling
2008-06-02 23:07     ` Joel Becker
2008-06-03 16:00       ` Louis Rilling
2008-06-06 23:01         ` Joel Becker
2008-06-09 11:03           ` Louis Rilling
2008-06-09 12:54             ` [BUG] deadlock between configfs_rmdir() and sys_rename() (WAS Re: [RFC][PATCH 4/4] configfs: Make multiple default_group) " Louis Rilling
2008-06-10  1:58               ` Joel Becker
2008-06-10 10:14                 ` Louis Rilling
2008-06-10 17:36                   ` Joel Becker
2008-06-11 14:10                     ` Louis Rilling
2008-06-11 17:30                       ` Louis Rilling
2008-06-11 21:15                         ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080522114947.310735375@kerlabs.com \
    --to=louis.rilling@kerlabs.com \
    --cc=Joel.Becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox