mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: Joel.Becker@oracle.com
Cc: Louis.Rilling@kerlabs.com, linux-kernel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com
Subject: [RFC][PATCH 1/3] configfs: set CONFIGFS_USET_DEFAULT earlier in configfs_attach_group()
Date: Tue, 20 May 2008 18:33:21 +0200	[thread overview]
Message-ID: <20080520164318.369365434@kerlabs.com> (raw)
In-Reply-To: <20080520163320.025971210@kerlabs.com>

[-- Attachment #1: configfs-tell-configfs_attach_group-if-default-group.patch --]
[-- Type: text/plain, Size: 3153 bytes --]

When creating a config_group, the CONFIGFS_USET_DEFAULT flag of default
sub-groups is only known after create_default_group() finishes its work, that is
after having creating the whole sub-hierarchy. In order to track which lock to
hide from lockdep, we need to known whether a config_group is default earlier,
that is before creating the sub-hierarchy.

This patch adds a def_group flag to configfs_attach_group(), which allows
configfs_attach_group to set the CONFIGFS_USET_DEFAULT flag before calling
populate_groups().

Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
---
 fs/configfs/dir.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)


Index: b/fs/configfs/dir.c
===================================================================
--- a/fs/configfs/dir.c	2008-05-20 17:13:18.000000000 +0200
+++ b/fs/configfs/dir.c	2008-05-20 18:19:35.000000000 +0200
@@ -445,7 +445,8 @@ static int populate_attrs(struct config_
 
 static int configfs_attach_group(struct config_item *parent_item,
 				 struct config_item *item,
-				 struct dentry *dentry);
+				 struct dentry *dentry,
+				 int def_group);
 static void configfs_detach_group(struct config_item *item);
 
 static void detach_groups(struct config_group *group)
@@ -500,7 +501,6 @@ static int create_default_group(struct c
 {
 	int ret;
 	struct qstr name;
-	struct configfs_dirent *sd;
 	/* We trust the caller holds a reference to parent */
 	struct dentry *child, *parent = parent_group->cg_item.ci_dentry;
 
@@ -516,11 +516,9 @@ static int create_default_group(struct c
 		d_add(child, NULL);
 
 		ret = configfs_attach_group(&parent_group->cg_item,
-					    &group->cg_item, child);
-		if (!ret) {
-			sd = child->d_fsdata;
-			sd->s_type |= CONFIGFS_USET_DEFAULT;
-		} else {
+					    &group->cg_item, child,
+					    1);
+		if (ret) {
 			d_delete(child);
 			dput(child);
 		}
@@ -692,7 +690,8 @@ static void configfs_detach_item(struct 
 
 static int configfs_attach_group(struct config_item *parent_item,
 				 struct config_item *item,
-				 struct dentry *dentry)
+				 struct dentry *dentry,
+				 int def_group)
 {
 	int ret;
 	struct configfs_dirent *sd;
@@ -701,6 +700,8 @@ static int configfs_attach_group(struct 
 	if (!ret) {
 		sd = dentry->d_fsdata;
 		sd->s_type |= CONFIGFS_USET_DIR;
+		if (def_group)
+			sd->s_type |= CONFIGFS_USET_DEFAULT;
 
 		ret = populate_groups(to_config_group(item));
 		if (ret) {
@@ -1094,7 +1095,7 @@ static int configfs_mkdir(struct inode *
 	module_got = 1;
 
 	if (group)
-		ret = configfs_attach_group(parent_item, item, dentry);
+		ret = configfs_attach_group(parent_item, item, dentry, 0);
 	else
 		ret = configfs_attach_item(parent_item, item, dentry);
 
@@ -1418,7 +1419,8 @@ int configfs_register_subsystem(struct c
 		d_add(dentry, NULL);
 
 		err = configfs_attach_group(sd->s_element, &group->cg_item,
-					    dentry);
+					    dentry,
+					    0);
 		if (err) {
 			d_delete(dentry);
 			dput(dentry);

-- 
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-20 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 16:33 [RFC][PATCH 0/3] configfs: Make nested default groups lockdep-friendly Louis Rilling
2008-05-20 16:33 ` Louis Rilling [this message]
2008-05-20 16:33 ` [RFC][PATCH 2/3] configfs: Silence lockdep when creating nested default groups Louis Rilling
2008-05-20 16:33 ` [RFC][PATCH 3/3] configfs: Silence lockdep when destroying " Louis Rilling
2008-05-20 16:58 ` [RFC][PATCH 0/3] configfs: Make nested default groups lockdep-friendly Arjan van de Ven
2008-05-20 17:08   ` Louis Rilling
2008-05-20 21:56   ` Joel Becker
2008-05-20 22:13     ` Arjan van de Ven
2008-05-20 22:27       ` Joel Becker
2008-05-20 22:35         ` Arjan van de Ven
2008-05-20 23:51           ` Joel Becker
2008-05-21  9:20             ` Peter Zijlstra
2008-05-21  9:23       ` Peter Zijlstra
2008-05-21 10:25         ` Louis Rilling
2008-05-21 10:59           ` Peter Zijlstra
2008-05-21 12:54             ` Louis Rilling
2008-05-21 22:09             ` Joel Becker
2008-05-21  8:13     ` Louis Rilling
2008-05-20 21:41 ` [Ocfs2-devel] " 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=20080520164318.369365434@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

all inboxes | Powered by JetHome®