Skip to contentSkip to conversation

kNFSd - 2 of 2 - BKL is missing in once place in knfsd

PATCH New NeilBrown 1 participant 1 message Jul 28, 2003

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 2 of 2 - BKL is missing in once place in knfsd

Knfsd still uses the BKL in many places, and the exp_*lock() routines for locking the export table depend on it. However reading /proc/fs/nfs/exports uses those locks without first grabing the BKL.

This patch is reported to fix a hang that was being experienced on an SMP nfs server on which /proc/fs/nfs/exports was being read frequently.

(patch against 2.4.22-pre9)

fs/nfsd/export.c renamed from fs/nfsd/export.c~current~ +3 -0
diff ./fs/nfsd/export.c~current~ ./fs/nfsd/export.c
@@ -19,6 +19,7 @@
 #include <linux/stat.h>
 #include <linux/in.h>
 #include <linux/seq_file.h>
+#include <linux/smp_lock.h>
 
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
@@ -571,6 +572,7 @@ static void *e_start(struct seq_file *m,
 	svc_client *clp;
 	struct list_head *p;
 	
+	lock_kernel();
 	exp_readlock();
 	if (!n--)
 		return (void *)1;
@@ -622,6 +624,7 @@ static void *e_next(struct seq_file *m, 
 static void e_stop(struct seq_file *m, void *p)
 {
 	exp_unlock();
+	unlock_kernel();
 }
 
 struct flags {

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs