Skip to contentSkip to conversation

nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error

PATCH In review fanchaoting 3 participants 3 messages Mar 27, 2013 – Apr 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs, if don't do it, it maybe cause Memory leak.

---
 fs/nfsd/nfsctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfsd/nfsctl.c +3 -1
index f33455b..58e4db4 100644
@@ -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 */
Signature · 1 line
1.7.1
#1 lore raw

Thanks, applying.

--b.

Quoted 30 lines · fanchaoting

when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs, if don't do it, it maybe cause Memory leak.

---
 fs/nfsd/nfsctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfsd/nfsctl.c +3 -1
index f33455b..58e4db4 100644
@@ -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 */
Signature · 1 line
1.7.1
#2 lore raw
In reply to fanchaoting
Quoted 5 lines · fanchaoting

when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs, if don't do it, it maybe cause Memory leak.

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

Quoted 22 lines
---
 fs/nfsd/nfsctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfsd/nfsctl.c +3 -1
index f33455b..58e4db4 100644
@@ -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 */