diff mbox

[1/2] nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error

Message ID 5152AE56.5010306@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

fanchaoting March 27, 2013, 8:31 a.m. UTC
when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs,
if don't do it, it maybe cause Memory leak.

 Signed-off-by: fanchaoting <fanchaoting@cn.fujitsu.com>
 Reviewed-by: chendt.fnst <chendt.fnst@cn.fujitsu.com>

---
 fs/nfsd/nfsctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

J. Bruce Fields April 3, 2013, 7:30 p.m. UTC | #1
Thanks, applying.

--b.

On Wed, Mar 27, 2013 at 04:31:18PM +0800, fanchaoting wrote:
> when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs,
> if don't do it, it maybe cause Memory leak.
> 
>  Signed-off-by: fanchaoting <fanchaoting@cn.fujitsu.com>
>  Reviewed-by: chendt.fnst <chendt.fnst@cn.fujitsu.com>
> 
> ---
>  fs/nfsd/nfsctl.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index f33455b..58e4db4 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -1102,8 +1102,10 @@ static int create_proc_exports_entry(void)
>  		return -ENOMEM;
>  	entry = proc_create("exports", 0, entry,
>  				 &exports_proc_operations);
> -	if (!entry)
> +	if (!entry) {
> +		remove_proc_entry("fs/nfs", NULL);
>  		return -ENOMEM;
> +	}
>  	return 0;
>  }
>  #else /* CONFIG_PROC_FS */
> -- 
> 1.7.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Benny Halevy April 11, 2013, 10:26 a.m. UTC | #2
On 2013-03-27 10:31, fanchaoting wrote:
> when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs,
> if don't do it, it maybe cause Memory leak.
> 
>  Signed-off-by: fanchaoting <fanchaoting@cn.fujitsu.com>
>  Reviewed-by: chendt.fnst <chendt.fnst@cn.fujitsu.com>

I merged this patch into pnfsd-block as well
to compliment
a55abd8 pnfsd-block: block layout should cleanup when register nfsd filesystem error

Thanks,

Benny

> 
> ---
>  fs/nfsd/nfsctl.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index f33455b..58e4db4 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -1102,8 +1102,10 @@ static int create_proc_exports_entry(void)
>  		return -ENOMEM;
>  	entry = proc_create("exports", 0, entry,
>  				 &exports_proc_operations);
> -	if (!entry)
> +	if (!entry) {
> +		remove_proc_entry("fs/nfs", NULL);
>  		return -ENOMEM;
> +	}
>  	return 0;
>  }
>  #else /* CONFIG_PROC_FS */
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index f33455b..58e4db4 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1102,8 +1102,10 @@  static int create_proc_exports_entry(void)
 		return -ENOMEM;
 	entry = proc_create("exports", 0, entry,
 				 &exports_proc_operations);
-	if (!entry)
+	if (!entry) {
+		remove_proc_entry("fs/nfs", NULL);
 		return -ENOMEM;
+	}
 	return 0;
 }
 #else /* CONFIG_PROC_FS */