aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs
diff options
context:
space:
mode:
authorLi Zefan <lizefan@huawei.com>2014-02-14 03:57:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-14 17:31:37 -0500
commitf41c593454943b80a2017c8a2a3d6b1d0b0a6f89 (patch)
tree3ecd1f3669b51386a716115a2da6809048149ce7 /fs/kernfs
parent9383f4c6b66256c039c65ddc141f0caeeae51847 (diff)
kernfs: fix kernfs_node_from_dentry()
Currently kernfs_node_from_dentry() returns NULL for root dentry, because root_dentry->d_op == NULL. Due to this bug cgroupstats_build() returns -EINVAL for root cgroup. # mount -t cgroup -o cpuacct /cgroup # Documentation/accounting/getdelays -C /cgroup fatal reply error, errno -22 With this fix: # Documentation/accounting/getdelays -C /cgroup sleeping 305, blocked 0, running 1, stopped 0, uninterruptible 1 Signed-off-by: Li Zefan <lizefan@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r--fs/kernfs/dir.c2
-rw-r--r--fs/kernfs/kernfs-internal.h1
-rw-r--r--fs/kernfs/mount.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index a0f99b7f84b2..8245d3b34894 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -500,7 +500,7 @@ const struct dentry_operations kernfs_dops = {
500 */ 500 */
501struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry) 501struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
502{ 502{
503 if (dentry->d_op == &kernfs_dops) 503 if (dentry->d_sb->s_op == &kernfs_sops)
504 return dentry->d_fsdata; 504 return dentry->d_fsdata;
505 return NULL; 505 return NULL;
506} 506}
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index a91d7a1113d9..8be13b2a079b 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -65,6 +65,7 @@ struct kernfs_super_info {
65}; 65};
66#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info)) 66#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
67 67
68extern const struct super_operations kernfs_sops;
68extern struct kmem_cache *kernfs_node_cache; 69extern struct kmem_cache *kernfs_node_cache;
69 70
70/* 71/*
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index e5b28b0ebc37..405279b5517b 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -39,7 +39,7 @@ static int kernfs_sop_show_options(struct seq_file *sf, struct dentry *dentry)
39 return 0; 39 return 0;
40} 40}
41 41
42static const struct super_operations kernfs_sops = { 42const struct super_operations kernfs_sops = {
43 .statfs = simple_statfs, 43 .statfs = simple_statfs,
44 .drop_inode = generic_delete_inode, 44 .drop_inode = generic_delete_inode,
45 .evict_inode = kernfs_evict_inode, 45 .evict_inode = kernfs_evict_inode,