All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nfs: fix kernel warning when removing proc entry
@ 2014-08-16 19:36 Cong Wang
  2014-08-20  4:20 ` Eric W. Biederman
  0 siblings, 1 reply; 9+ messages in thread
From: Cong Wang @ 2014-08-16 19:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-nfs, Eric W. Biederman, Trond Myklebust, Dan Aloni, Cong Wang

I saw the following kernel warning:

[ 1852.321222] ------------[ cut here ]------------
[ 1852.326527] WARNING: CPU: 0 PID: 118 at fs/proc/generic.c:521 remove_proc_entry+0x154/0x16b()
[ 1852.335630] remove_proc_entry: removing non-empty directory 'fs/nfsfs', leaking at least 'volumes'
[ 1852.344084] CPU: 0 PID: 118 Comm: kworker/u8:2 Not tainted 3.16.0+ #540
[ 1852.350036] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 1852.354992] Workqueue: netns cleanup_net
[ 1852.358701]  0000000000000000 ffff880116f2fbd0 ffffffff819c03e9 ffff880116f2fc18
[ 1852.366474]  ffff880116f2fc08 ffffffff810744ee ffffffff811e0e6e ffff8800d4e96238
[ 1852.373507]  ffffffff81dbe665 ffff8800d46a5948 0000000000000005 ffff880116f2fc68
[ 1852.380224] Call Trace:
[ 1852.381976]  [<ffffffff819c03e9>] dump_stack+0x4d/0x66
[ 1852.385495]  [<ffffffff810744ee>] warn_slowpath_common+0x7a/0x93
[ 1852.389869]  [<ffffffff811e0e6e>] ? remove_proc_entry+0x154/0x16b
[ 1852.393987]  [<ffffffff8107457b>] warn_slowpath_fmt+0x4c/0x4e
[ 1852.397999]  [<ffffffff811e0e6e>] remove_proc_entry+0x154/0x16b
[ 1852.402034]  [<ffffffff8129c73d>] nfs_fs_proc_net_exit+0x53/0x56
[ 1852.406136]  [<ffffffff812a103b>] nfs_net_exit+0x12/0x1d
[ 1852.409774]  [<ffffffff81785bc9>] ops_exit_list+0x44/0x55
[ 1852.413529]  [<ffffffff81786389>] cleanup_net+0xee/0x182
[ 1852.417198]  [<ffffffff81088c9e>] process_one_work+0x209/0x40d
[ 1852.502320]  [<ffffffff81088bf7>] ? process_one_work+0x162/0x40d
[ 1852.587629]  [<ffffffff810890c1>] worker_thread+0x1f0/0x2c7
[ 1852.673291]  [<ffffffff81088ed1>] ? process_scheduled_works+0x2f/0x2f
[ 1852.759470]  [<ffffffff8108e079>] kthread+0xc9/0xd1
[ 1852.843099]  [<ffffffff8109427f>] ? finish_task_switch+0x3a/0xce
[ 1852.926518]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
[ 1853.008565]  [<ffffffff819cbeac>] ret_from_fork+0x7c/0xb0
[ 1853.076477]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
[ 1853.140653] ---[ end trace 69c4c6617f78e32d ]---

It looks wrong that we add "/proc/net/nfsfs" in nfs_fs_proc_net_init()
while remove "/proc/fs/nfsfs" in nfs_fs_proc_net_exit().

Fixes: commit 65b38851a17 (NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes)
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Dan Aloni <dan@kernelim.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
v2 - fix nfs_fs_proc_net_init() as well

 fs/nfs/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 1c5ff6d..c117b96 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1418,7 +1418,7 @@ int nfs_fs_proc_net_init(struct net *net)
 error_2:
 	remove_proc_entry("servers", nn->proc_nfsfs);
 error_1:
-	remove_proc_entry("fs/nfsfs", NULL);
+	remove_proc_entry("nfsfs", net->proc_net);
 error_0:
 	return -ENOMEM;
 }
@@ -1429,7 +1429,7 @@ void nfs_fs_proc_net_exit(struct net *net)
 
 	remove_proc_entry("volumes", nn->proc_nfsfs);
 	remove_proc_entry("servers", nn->proc_nfsfs);
-	remove_proc_entry("fs/nfsfs", NULL);
+	remove_proc_entry("nfsfs", net->proc_net);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-08-16 19:36 [PATCH v2] nfs: fix kernel warning when removing proc entry Cong Wang
@ 2014-08-20  4:20 ` Eric W. Biederman
       [not found]   ` <alpine.DEB.2.19.4.1408192222470.2758@trent.utfs.org>
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Eric W. Biederman @ 2014-08-20  4:20 UTC (permalink / raw)
  To: Cong Wang; +Cc: linux-kernel, linux-nfs, Trond Myklebust, Dan Aloni

Cong Wang <xiyou.wangcong@gmail.com> writes:

> I saw the following kernel warning:

Cong thanks for finding and tracking this.  I was clearly asleep at the
switch when I was testing my fix to the nfs client code :(

I have applied this patch and will push it to Linus after it has a
little bit to sit in linux-next.

Eric

> [ 1852.321222] ------------[ cut here ]------------
> [ 1852.326527] WARNING: CPU: 0 PID: 118 at fs/proc/generic.c:521 remove_proc_entry+0x154/0x16b()
> [ 1852.335630] remove_proc_entry: removing non-empty directory 'fs/nfsfs', leaking at least 'volumes'
> [ 1852.344084] CPU: 0 PID: 118 Comm: kworker/u8:2 Not tainted 3.16.0+ #540
> [ 1852.350036] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [ 1852.354992] Workqueue: netns cleanup_net
> [ 1852.358701]  0000000000000000 ffff880116f2fbd0 ffffffff819c03e9 ffff880116f2fc18
> [ 1852.366474]  ffff880116f2fc08 ffffffff810744ee ffffffff811e0e6e ffff8800d4e96238
> [ 1852.373507]  ffffffff81dbe665 ffff8800d46a5948 0000000000000005 ffff880116f2fc68
> [ 1852.380224] Call Trace:
> [ 1852.381976]  [<ffffffff819c03e9>] dump_stack+0x4d/0x66
> [ 1852.385495]  [<ffffffff810744ee>] warn_slowpath_common+0x7a/0x93
> [ 1852.389869]  [<ffffffff811e0e6e>] ? remove_proc_entry+0x154/0x16b
> [ 1852.393987]  [<ffffffff8107457b>] warn_slowpath_fmt+0x4c/0x4e
> [ 1852.397999]  [<ffffffff811e0e6e>] remove_proc_entry+0x154/0x16b
> [ 1852.402034]  [<ffffffff8129c73d>] nfs_fs_proc_net_exit+0x53/0x56
> [ 1852.406136]  [<ffffffff812a103b>] nfs_net_exit+0x12/0x1d
> [ 1852.409774]  [<ffffffff81785bc9>] ops_exit_list+0x44/0x55
> [ 1852.413529]  [<ffffffff81786389>] cleanup_net+0xee/0x182
> [ 1852.417198]  [<ffffffff81088c9e>] process_one_work+0x209/0x40d
> [ 1852.502320]  [<ffffffff81088bf7>] ? process_one_work+0x162/0x40d
> [ 1852.587629]  [<ffffffff810890c1>] worker_thread+0x1f0/0x2c7
> [ 1852.673291]  [<ffffffff81088ed1>] ? process_scheduled_works+0x2f/0x2f
> [ 1852.759470]  [<ffffffff8108e079>] kthread+0xc9/0xd1
> [ 1852.843099]  [<ffffffff8109427f>] ? finish_task_switch+0x3a/0xce
> [ 1852.926518]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
> [ 1853.008565]  [<ffffffff819cbeac>] ret_from_fork+0x7c/0xb0
> [ 1853.076477]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
> [ 1853.140653] ---[ end trace 69c4c6617f78e32d ]---
>
> It looks wrong that we add "/proc/net/nfsfs" in nfs_fs_proc_net_init()
> while remove "/proc/fs/nfsfs" in nfs_fs_proc_net_exit().
>
> Fixes: commit 65b38851a17 (NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes)
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Trond Myklebust <trond.myklebust@primarydata.com>
> Cc: Dan Aloni <dan@kernelim.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> v2 - fix nfs_fs_proc_net_init() as well
>
>  fs/nfs/client.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 1c5ff6d..c117b96 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -1418,7 +1418,7 @@ int nfs_fs_proc_net_init(struct net *net)
>  error_2:
>  	remove_proc_entry("servers", nn->proc_nfsfs);
>  error_1:
> -	remove_proc_entry("fs/nfsfs", NULL);
> +	remove_proc_entry("nfsfs", net->proc_net);
>  error_0:
>  	return -ENOMEM;
>  }
> @@ -1429,7 +1429,7 @@ void nfs_fs_proc_net_exit(struct net *net)
>  
>  	remove_proc_entry("volumes", nn->proc_nfsfs);
>  	remove_proc_entry("servers", nn->proc_nfsfs);
> -	remove_proc_entry("fs/nfsfs", NULL);
> +	remove_proc_entry("nfsfs", net->proc_net);
>  }
>  
>  /*

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
       [not found]   ` <alpine.DEB.2.19.4.1408192222470.2758@trent.utfs.org>
@ 2014-08-20 23:16     ` Trond Myklebust
  0 siblings, 0 replies; 9+ messages in thread
From: Trond Myklebust @ 2014-08-20 23:16 UTC (permalink / raw)
  To: Christian Kujau
  Cc: Eric W. Biederman, Cong Wang, LKML, Linux NFS Mailing List, Dan Aloni

On Wed, Aug 20, 2014 at 1:24 AM, Christian Kujau <lists@nerdbynature.de> wrote:
> On Tue, 19 Aug 2014 at 21:20, Eric W. Biederman wrote:
>
>> Cong Wang <xiyou.wangcong@gmail.com> writes:
>>
>> > I saw the following kernel warning:
>>
>> Cong thanks for finding and tracking this.  I was clearly asleep at the
>> switch when I was testing my fix to the nfs client code :(
>>
>> I have applied this patch and will push it to Linus after it has a
>> little bit to sit in linux-next.
>
> This made the boot warning go away for me as well:
> http://lkml.iu.edu/hypermail/linux/kernel/1408.2/01792.html
>
> Tested-by: Christian Kujau <lists@nerdbynature.de>
>
> Thanks!
> Christian.
> --
> BOFH excuse #182:
>
> endothermal recalibration

It is customary (and expected!) to send these patches through the
maintainer; not to push them yourself.

-- 
Trond Myklebust

Linux NFS client maintainer, PrimaryData

trond.myklebust@primarydata.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-08-20  4:20 ` Eric W. Biederman
       [not found]   ` <alpine.DEB.2.19.4.1408192222470.2758@trent.utfs.org>
@ 2014-08-20 23:27   ` Trond Myklebust
  2014-08-28  1:41   ` Al Viro
  2014-09-08 18:50   ` Matt Mullins
  3 siblings, 0 replies; 9+ messages in thread
From: Trond Myklebust @ 2014-08-20 23:27 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Cong Wang, Linux Kernel mailing list, Linux NFS Mailing List, Dan Aloni

On Wed, Aug 20, 2014 at 12:20 AM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Cong Wang <xiyou.wangcong@gmail.com> writes:
>
>> I saw the following kernel warning:
>
> Cong thanks for finding and tracking this.  I was clearly asleep at the
> switch when I was testing my fix to the nfs client code :(
>
> I have applied this patch and will push it to Linus after it has a
> little bit to sit in linux-next.
>

This is precisely _WHY_ it is supposed to go through the maintainer,
and not through arbitrary namespace trees. I'm tired of the namespace
folks pushing crap and just assuming that a "Cc:" is OK. A "Cc:
maintainer" means this is an RFC, not something that is to be
committed.

Trond

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-08-20  4:20 ` Eric W. Biederman
       [not found]   ` <alpine.DEB.2.19.4.1408192222470.2758@trent.utfs.org>
  2014-08-20 23:27   ` Trond Myklebust
@ 2014-08-28  1:41   ` Al Viro
  2014-09-08 23:54     ` Trond Myklebust
  2014-09-08 18:50   ` Matt Mullins
  3 siblings, 1 reply; 9+ messages in thread
From: Al Viro @ 2014-08-28  1:41 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Cong Wang, linux-kernel, linux-nfs, Trond Myklebust, Dan Aloni

On Tue, Aug 19, 2014 at 09:20:38PM -0700, Eric W. Biederman wrote:
> Cong Wang <xiyou.wangcong@gmail.com> writes:
> 
> > I saw the following kernel warning:
> 
> Cong thanks for finding and tracking this.  I was clearly asleep at the
> switch when I was testing my fix to the nfs client code :(
> 
> I have applied this patch and will push it to Linus after it has a
> little bit to sit in linux-next.

	Why does that code wank with one-by-one remove_proc_entry(), BTW?
remove_proc_subtree("nfsfs", net->proc_net) will take care of the whole pile
just fine, TYVM...  While we are it, there's no need to keep ->proc_nfsfs
at all - just have it in a local variable in nfs_fs_proc_net_init().

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-08-20  4:20 ` Eric W. Biederman
                     ` (2 preceding siblings ...)
  2014-08-28  1:41   ` Al Viro
@ 2014-09-08 18:50   ` Matt Mullins
  2014-09-08 20:26     ` Alexei Starovoitov
  3 siblings, 1 reply; 9+ messages in thread
From: Matt Mullins @ 2014-09-08 18:50 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Cong Wang, linux-kernel, linux-nfs, Trond Myklebust, Dan Aloni

On Tue, Aug 19, 2014 at 09:20:38PM -0700, Eric W. Biederman wrote:
> I have applied this patch and will push it to Linus after it has a
> little bit to sit in linux-next.

I also fairly reliably hit this warning with trinity, and with Cong's
patch, it seems to be gone.

If it helps get it pushed toward Linus:
Tested-by: Matt Mullins <mmullins@twopensource.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-09-08 18:50   ` Matt Mullins
@ 2014-09-08 20:26     ` Alexei Starovoitov
  0 siblings, 0 replies; 9+ messages in thread
From: Alexei Starovoitov @ 2014-09-08 20:26 UTC (permalink / raw)
  To: Eric W. Biederman, Cong Wang, linux-kernel, linux-nfs,
	Trond Myklebust, Dan Aloni

On Mon, Sep 8, 2014 at 11:50 AM, Matt Mullins <mmullins@twopensource.com> wrote:
> On Tue, Aug 19, 2014 at 09:20:38PM -0700, Eric W. Biederman wrote:
>> I have applied this patch and will push it to Linus after it has a
>> little bit to sit in linux-next.

what's the status of this patch?
It's rc4 already and I keep seeing it every boot:
[    7.730034] WARNING: CPU: 3 PID: 103 at ../fs/proc/generic.c:521
remove_proc_entry+0x1a4/0x1b0()
[    7.730036] remove_proc_entry: removing non-empty directory
'fs/nfsfs', leaking at least 'volumes'
[    7.730037] Modules linked in: ...
[    7.730063] CPU: 3 PID: 103 Comm: kworker/u8:15 Not tainted 3.17.0-rc4+ #196

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-08-28  1:41   ` Al Viro
@ 2014-09-08 23:54     ` Trond Myklebust
  2014-09-09  2:59       ` Cong Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2014-09-08 23:54 UTC (permalink / raw)
  To: Al Viro
  Cc: Eric W. Biederman, Cong Wang, Linux Kernel mailing list,
	Linux NFS Mailing List, Dan Aloni

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Wed, Aug 27, 2014 at 6:41 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Tue, Aug 19, 2014 at 09:20:38PM -0700, Eric W. Biederman wrote:
>> Cong Wang <xiyou.wangcong@gmail.com> writes:
>>
>> > I saw the following kernel warning:
>>
>> Cong thanks for finding and tracking this.  I was clearly asleep at the
>> switch when I was testing my fix to the nfs client code :(
>>
>> I have applied this patch and will push it to Linus after it has a
>> little bit to sit in linux-next.
>
>         Why does that code wank with one-by-one remove_proc_entry(), BTW?
> remove_proc_subtree("nfsfs", net->proc_net) will take care of the whole pile
> just fine, TYVM...  While we are it, there's no need to keep ->proc_nfsfs
> at all - just have it in a local variable in nfs_fs_proc_net_init().

Since nobody sent me an updated version with the remove_proc_subtree
fix, I went ahead and edited the patch myself (see attachment). Cong,
please let me know if you disagree with that change, otherwise, that
will be the final patch sent upstream and Cc: stable # 3.4+.

I'll schedule cleanup patches to make the same changes to the original
nfs_fs_proc_exit() and nfs_fs_proc_init() and to remove (struct
nfs_net)->proc_nfsfs for merging in 3.18.

-- 
Trond Myklebust

Linux NFS client maintainer, PrimaryData

trond.myklebust@primarydata.com

[-- Attachment #2: 0001-nfs-fix-kernel-warning-when-removing-proc-entry.patch --]
[-- Type: application/octet-stream, Size: 3788 bytes --]

From 21e81002f9788a3af591416b6dec60d7b67f2fb2 Mon Sep 17 00:00:00 2001
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 8 Sep 2014 16:17:55 -0700
Subject: [PATCH] nfs: fix kernel warning when removing proc entry

I saw the following kernel warning:

[ 1852.321222] ------------[ cut here ]------------
[ 1852.326527] WARNING: CPU: 0 PID: 118 at fs/proc/generic.c:521 remove_proc_entry+0x154/0x16b()
[ 1852.335630] remove_proc_entry: removing non-empty directory 'fs/nfsfs', leaking at least 'volumes'
[ 1852.344084] CPU: 0 PID: 118 Comm: kworker/u8:2 Not tainted 3.16.0+ #540
[ 1852.350036] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 1852.354992] Workqueue: netns cleanup_net
[ 1852.358701]  0000000000000000 ffff880116f2fbd0 ffffffff819c03e9 ffff880116f2fc18
[ 1852.366474]  ffff880116f2fc08 ffffffff810744ee ffffffff811e0e6e ffff8800d4e96238
[ 1852.373507]  ffffffff81dbe665 ffff8800d46a5948 0000000000000005 ffff880116f2fc68
[ 1852.380224] Call Trace:
[ 1852.381976]  [<ffffffff819c03e9>] dump_stack+0x4d/0x66
[ 1852.385495]  [<ffffffff810744ee>] warn_slowpath_common+0x7a/0x93
[ 1852.389869]  [<ffffffff811e0e6e>] ? remove_proc_entry+0x154/0x16b
[ 1852.393987]  [<ffffffff8107457b>] warn_slowpath_fmt+0x4c/0x4e
[ 1852.397999]  [<ffffffff811e0e6e>] remove_proc_entry+0x154/0x16b
[ 1852.402034]  [<ffffffff8129c73d>] nfs_fs_proc_net_exit+0x53/0x56
[ 1852.406136]  [<ffffffff812a103b>] nfs_net_exit+0x12/0x1d
[ 1852.409774]  [<ffffffff81785bc9>] ops_exit_list+0x44/0x55
[ 1852.413529]  [<ffffffff81786389>] cleanup_net+0xee/0x182
[ 1852.417198]  [<ffffffff81088c9e>] process_one_work+0x209/0x40d
[ 1852.502320]  [<ffffffff81088bf7>] ? process_one_work+0x162/0x40d
[ 1852.587629]  [<ffffffff810890c1>] worker_thread+0x1f0/0x2c7
[ 1852.673291]  [<ffffffff81088ed1>] ? process_scheduled_works+0x2f/0x2f
[ 1852.759470]  [<ffffffff8108e079>] kthread+0xc9/0xd1
[ 1852.843099]  [<ffffffff8109427f>] ? finish_task_switch+0x3a/0xce
[ 1852.926518]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
[ 1853.008565]  [<ffffffff819cbeac>] ret_from_fork+0x7c/0xb0
[ 1853.076477]  [<ffffffff8108dfb0>] ? __kthread_parkme+0x61/0x61
[ 1853.140653] ---[ end trace 69c4c6617f78e32d ]---

It looks wrong that we add "/proc/net/nfsfs" in nfs_fs_proc_net_init()
while remove "/proc/fs/nfsfs" in nfs_fs_proc_net_exit().

Fixes: commit 65b38851a17 (NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes)
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Dan Aloni <dan@kernelim.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
[Trond: replace uses of remove_proc_entry() with remove_proc_subtree()
as suggested by Al Viro]
Cc: stable@vger.kernel.org # 3.4.x : 65b38851a17: NFS: Fix /proc/fs/nfsfs/servers
Cc: stable@vger.kernel.org # 3.4.x
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/client.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 1c5ff6d58385..6a4f3666e273 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1412,24 +1412,18 @@ int nfs_fs_proc_net_init(struct net *net)
 	p = proc_create("volumes", S_IFREG|S_IRUGO,
 			nn->proc_nfsfs, &nfs_volume_list_fops);
 	if (!p)
-		goto error_2;
+		goto error_1;
 	return 0;
 
-error_2:
-	remove_proc_entry("servers", nn->proc_nfsfs);
 error_1:
-	remove_proc_entry("fs/nfsfs", NULL);
+	remove_proc_subtree("nfsfs", net->proc_net);
 error_0:
 	return -ENOMEM;
 }
 
 void nfs_fs_proc_net_exit(struct net *net)
 {
-	struct nfs_net *nn = net_generic(net, nfs_net_id);
-
-	remove_proc_entry("volumes", nn->proc_nfsfs);
-	remove_proc_entry("servers", nn->proc_nfsfs);
-	remove_proc_entry("fs/nfsfs", NULL);
+	remove_proc_subtree("nfsfs", net->proc_net);
 }
 
 /*
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] nfs: fix kernel warning when removing proc entry
  2014-09-08 23:54     ` Trond Myklebust
@ 2014-09-09  2:59       ` Cong Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Cong Wang @ 2014-09-09  2:59 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: Al Viro, Eric W. Biederman, Linux Kernel mailing list,
	Linux NFS Mailing List, Dan Aloni

On Mon, Sep 8, 2014 at 4:54 PM, Trond Myklebust
<trond.myklebust@primarydata.com> wrote:
> On Wed, Aug 27, 2014 at 6:41 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>> On Tue, Aug 19, 2014 at 09:20:38PM -0700, Eric W. Biederman wrote:
>>> Cong Wang <xiyou.wangcong@gmail.com> writes:
>>>
>>> > I saw the following kernel warning:
>>>
>>> Cong thanks for finding and tracking this.  I was clearly asleep at the
>>> switch when I was testing my fix to the nfs client code :(
>>>
>>> I have applied this patch and will push it to Linus after it has a
>>> little bit to sit in linux-next.
>>
>>         Why does that code wank with one-by-one remove_proc_entry(), BTW?
>> remove_proc_subtree("nfsfs", net->proc_net) will take care of the whole pile
>> just fine, TYVM...  While we are it, there's no need to keep ->proc_nfsfs
>> at all - just have it in a local variable in nfs_fs_proc_net_init().
>
> Since nobody sent me an updated version with the remove_proc_subtree
> fix, I went ahead and edited the patch myself (see attachment). Cong,
> please let me know if you disagree with that change, otherwise, that
> will be the final patch sent upstream and Cc: stable # 3.4+.
>
> I'll schedule cleanup patches to make the same changes to the original
> nfs_fs_proc_exit() and nfs_fs_proc_init() and to remove (struct
> nfs_net)->proc_nfsfs for merging in 3.18.
>

Oops, I missed Al's reply and didn't know remove_proc_subtree() either.

Thanks for the update and it definitely looks good to me!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-09  2:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-16 19:36 [PATCH v2] nfs: fix kernel warning when removing proc entry Cong Wang
2014-08-20  4:20 ` Eric W. Biederman
     [not found]   ` <alpine.DEB.2.19.4.1408192222470.2758@trent.utfs.org>
2014-08-20 23:16     ` Trond Myklebust
2014-08-20 23:27   ` Trond Myklebust
2014-08-28  1:41   ` Al Viro
2014-09-08 23:54     ` Trond Myklebust
2014-09-09  2:59       ` Cong Wang
2014-09-08 18:50   ` Matt Mullins
2014-09-08 20:26     ` Alexei Starovoitov

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.