From: Amerigo Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Greg Kroah-Hartman <gregkh@suse.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Miles Lane <miles.lane@gmail.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Larry Finger <Larry.Finger@lwfinger.net>,
Amerigo Wang <amwang@redhat.com>,
akpm@linux-foundation.org
Subject: [PATCH 2/2] sysfs: fix the incomplete part of subclass support for s_active
Date: Fri, 29 Jan 2010 02:02:15 -0500 [thread overview]
Message-ID: <20100129070537.4058.42197.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20100129070516.4058.77227.sendpatchset@localhost.localdomain>
From: Amerigo Wang <amwang@redhat.com>
Date: Fri, 29 Jan 2010 14:18:58 +0800
Subject: [PATCH 2/2] sysfs: fix the incomplete part of subclass support for s_active
Patch 1/2 missed the initialization part for subclass, which I think
is the reason why it still can't stop the lockdep warning. This depends
on patch 1/2.
Compile test only.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/dir.c | 1 -
fs/sysfs/file.c | 2 ++
fs/sysfs/sysfs.h | 6 +++---
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e0cd4a0..6b63198 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -364,7 +364,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
atomic_set(&sd->s_count, 1);
atomic_set(&sd->s_active, 0);
- sysfs_dirent_init_lockdep(sd);
sd->s_name = name;
sd->s_mode = mode;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index dc30d9e..abf30d7 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -509,6 +509,8 @@ int sysfs_add_file_mode(struct sysfs_dirent *dir_sd,
if (!sd)
return -ENOMEM;
sd->s_attr.attr = (void *)attr;
+ if ((type & SYSFS_TYPE_MASK) == SYSFS_KOBJ_ATTR)
+ sysfs_dirent_init_lockdep(sd, sd->s_attr.attr->subclass);
sysfs_addrm_start(&acxt, dir_sd);
rc = sysfs_add_one(&acxt, sd);
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index cdd9377..7e78f2e 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -89,14 +89,14 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd)
}
#ifdef CONFIG_DEBUG_LOCK_ALLOC
-#define sysfs_dirent_init_lockdep(sd) \
+#define sysfs_dirent_init_lockdep(sd, c) \
do { \
static struct lock_class_key __key; \
\
- lockdep_init_map(&sd->dep_map, "s_active", &__key, 0); \
+ lockdep_init_map(&sd->dep_map, "s_active", &__key, c); \
} while(0)
#else
-#define sysfs_dirent_init_lockdep(sd) do {} while(0)
+#define sysfs_dirent_init_lockdep(sd, c) do {} while(0)
#endif
/*
--
1.5.5.6
next prev parent reply other threads:[~2010-01-29 7:04 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 7:01 [Patch 0/2] sysfs: fix s_active lockdep warning Amerigo Wang
2010-01-29 7:02 ` [Patch 1/2] sysfs: add support for lockdep subclasses to s_active Amerigo Wang
2010-01-29 7:02 ` Amerigo Wang [this message]
2010-01-29 7:21 ` [Patch 0/2] sysfs: fix s_active lockdep warning Eric W. Biederman
2010-01-29 8:38 ` Cong Wang
2010-01-29 13:44 ` Eric W. Biederman
2010-01-29 14:22 ` Greg KH
2010-01-29 17:57 ` Peter Zijlstra
2010-01-29 18:10 ` Greg KH
2010-01-29 18:14 ` Peter Zijlstra
2010-01-29 18:21 ` Greg KH
2010-01-29 20:10 ` Peter Zijlstra
2010-01-29 20:30 ` Eric W. Biederman
2010-02-04 11:38 ` Peter Zijlstra
2010-02-04 16:35 ` Alan Stern
2010-02-04 16:41 ` Peter Zijlstra
2010-02-04 18:37 ` Alan Stern
2010-02-05 10:18 ` Peter Zijlstra
2010-02-05 15:30 ` Alan Stern
2010-02-05 15:41 ` Peter Zijlstra
2010-02-07 9:22 ` Dave Young
2010-02-08 3:08 ` Cong Wang
2010-02-08 3:14 ` Dave Young
2010-02-08 3:30 ` Cong Wang
2010-02-08 3:06 ` Cong Wang
2010-02-08 15:38 ` Alan Stern
2010-02-04 16:46 ` Peter Zijlstra
2010-02-04 18:40 ` Alan Stern
2010-02-05 3:09 ` Cong Wang
2010-02-05 4:06 ` Alan Stern
2010-02-04 16:46 ` Greg KH
2010-02-04 16:59 ` Thomas Gleixner
2010-02-26 19:36 ` Alan Stern
2010-02-26 20:54 ` Thomas Gleixner
2010-02-05 3:43 ` Cong Wang
2010-02-05 8:55 ` Eric W. Biederman
2010-01-29 20:25 ` Eric W. Biederman
2010-01-30 5:30 ` Greg KH
2010-01-29 18:02 ` Peter Zijlstra
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=20100129070537.4058.42197.sendpatchset@localhost.localdomain \
--to=amwang@redhat.com \
--cc=Larry.Finger@lwfinger.net \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=ebiederm@xmission.com \
--cc=gregkh@suse.de \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miles.lane@gmail.com \
--cc=tj@kernel.org \
/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