Messages in this thread Patch in this message | | | Date | Fri, 29 Jan 2010 02:02:15 -0500 | From | Amerigo Wang <> | Subject | [PATCH 2/2] sysfs: fix the incomplete part of subclass support for s_active |
| |
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
| |