* [PATCH] kernfs: fix kernfs_node_from_dentry()
@ 2014-02-14 8:57 ` Li Zefan
0 siblings, 0 replies; 6+ messages in thread
From: Li Zefan @ 2014-02-14 8:57 UTC (permalink / raw)
To: Tejun Heo; +Cc: Greg Kroah-Hartman, Cgroups, LKML
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>
---
fs/kernfs/dir.c | 2 +-
fs/kernfs/kernfs-internal.h | 1 +
fs/kernfs/mount.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 939684e..300f57b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -501,7 +501,7 @@ const struct dentry_operations kernfs_dops = {
*/
struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
{
- if (dentry->d_op == &kernfs_dops)
+ if (dentry->d_sb->s_op == &kernfs_sops)
return dentry->d_fsdata;
return NULL;
}
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index a91d7a1..8be13b2 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -65,6 +65,7 @@ struct kernfs_super_info {
};
#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
+extern const struct super_operations kernfs_sops;
extern struct kmem_cache *kernfs_node_cache;
/*
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index e5b28b0..405279b 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)
return 0;
}
-static const struct super_operations kernfs_sops = {
+const struct super_operations kernfs_sops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
.evict_inode = kernfs_evict_inode,
--
1.8.0.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] kernfs: fix kernfs_node_from_dentry()
@ 2014-02-14 8:57 ` Li Zefan
0 siblings, 0 replies; 6+ messages in thread
From: Li Zefan @ 2014-02-14 8:57 UTC (permalink / raw)
To: Tejun Heo; +Cc: Greg Kroah-Hartman, Cgroups, LKML
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-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
fs/kernfs/dir.c | 2 +-
fs/kernfs/kernfs-internal.h | 1 +
fs/kernfs/mount.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 939684e..300f57b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -501,7 +501,7 @@ const struct dentry_operations kernfs_dops = {
*/
struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
{
- if (dentry->d_op == &kernfs_dops)
+ if (dentry->d_sb->s_op == &kernfs_sops)
return dentry->d_fsdata;
return NULL;
}
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index a91d7a1..8be13b2 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -65,6 +65,7 @@ struct kernfs_super_info {
};
#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
+extern const struct super_operations kernfs_sops;
extern struct kmem_cache *kernfs_node_cache;
/*
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index e5b28b0..405279b 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)
return 0;
}
-static const struct super_operations kernfs_sops = {
+const struct super_operations kernfs_sops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
.evict_inode = kernfs_evict_inode,
--
1.8.0.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] kernfs: fix kernfs_node_from_dentry()
@ 2014-02-14 16:03 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2014-02-14 16:03 UTC (permalink / raw)
To: Li Zefan; +Cc: Greg Kroah-Hartman, Cgroups, LKML
On Fri, Feb 14, 2014 at 04:57:27PM +0800, Li Zefan wrote:
> 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>
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kernfs: fix kernfs_node_from_dentry()
@ 2014-02-14 16:03 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2014-02-14 16:03 UTC (permalink / raw)
To: Li Zefan; +Cc: Greg Kroah-Hartman, Cgroups, LKML
On Fri, Feb 14, 2014 at 04:57:27PM +0800, Li Zefan wrote:
> 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-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kernfs: fix kernfs_node_from_dentry()
2014-02-14 22:04 ` Greg Kroah-Hartman
@ 2014-02-14 22:04 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2014-02-14 22:04 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Li Zefan, Cgroups, LKML
On Fri, Feb 14, 2014 at 02:04:40PM -0800, Greg Kroah-Hartman wrote:
> On Fri, Feb 14, 2014 at 11:03:01AM -0500, Tejun Heo wrote:
> > On Fri, Feb 14, 2014 at 04:57:27PM +0800, Li Zefan wrote:
> > > 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>
>
> Is this needed for 3.14-final or 3.15-rc1?
3.15-rc1, so, driver-core-next.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kernfs: fix kernfs_node_from_dentry()
2014-02-14 16:03 ` Tejun Heo
(?)
@ 2014-02-14 22:04 ` Greg Kroah-Hartman
2014-02-14 22:04 ` Tejun Heo
-1 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2014-02-14 22:04 UTC (permalink / raw)
To: Tejun Heo; +Cc: Li Zefan, Cgroups, LKML
On Fri, Feb 14, 2014 at 11:03:01AM -0500, Tejun Heo wrote:
> On Fri, Feb 14, 2014 at 04:57:27PM +0800, Li Zefan wrote:
> > 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>
Is this needed for 3.14-final or 3.15-rc1?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-14 22:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14 8:57 [PATCH] kernfs: fix kernfs_node_from_dentry() Li Zefan
2014-02-14 8:57 ` Li Zefan
2014-02-14 16:03 ` Tejun Heo
2014-02-14 16:03 ` Tejun Heo
2014-02-14 22:04 ` Greg Kroah-Hartman
2014-02-14 22:04 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.