public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove BKL from driverfs
@ 2002-07-04  6:26 Dave Hansen
  2002-07-04  7:10 ` Greg KH
  2002-07-05 17:09 ` Patrick Mochel
  0 siblings, 2 replies; 11+ messages in thread
From: Dave Hansen @ 2002-07-04  6:26 UTC (permalink / raw)
  To: mochel; +Cc: Greg KH, linux-kernel

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

I saw your talk about driverfs at OLS and it got my attention.  When 
my BKL debugging patch showed some use of the BKL in driverfs, I was 
very dissapointed (you can blame Greg if you want).

text from dmesg after BKL debugging patch:
release of recursive BKL hold, depth: 1
[ 0]main:492
[ 1]inode:149

I see no reason to hold the BKL in your situation.  I replaced it with 
i_sem in some places and just plain removed it in others.  I believe 
that you get all of the protection that you need from dcache_lock in 
the dentry insert and activate.  Can you prove me wrong?

-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: driverfs-bkl_remove-2.5.24-0.patch --]
[-- Type: text/plain, Size: 1265 bytes --]

--- linux-2.5.24-clean/fs/driverfs/inode.c	Thu Jun 20 15:53:45 2002
+++ linux/fs/driverfs/inode.c	Wed Jul  3 23:18:23 2002
@@ -146,20 +146,16 @@
 static int driverfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
 	int res;
-	lock_kernel();
 	dentry->d_op = &driverfs_dentry_dir_ops;
  	res = driverfs_mknod(dir, dentry, mode | S_IFDIR, 0);
-	unlock_kernel();
 	return res;
 }
 
 static int driverfs_create(struct inode *dir, struct dentry *dentry, int mode)
 {
 	int res;
-	lock_kernel();
 	dentry->d_op = &driverfs_dentry_file_ops;
  	res = driverfs_mknod(dir, dentry, mode | S_IFREG, 0);
-	unlock_kernel();
 	return res;
 }
 
@@ -211,9 +207,9 @@
 	if (driverfs_empty(dentry)) {
 		struct inode *inode = dentry->d_inode;
 
-		lock_kernel();
+		down(&inode->i_sem);
 		inode->i_nlink--;
-		unlock_kernel();
+		up(&inode->i_sem);
 		dput(dentry);
 		error = 0;
 	}
@@ -353,8 +349,9 @@
 driverfs_file_lseek(struct file *file, loff_t offset, int orig)
 {
 	loff_t retval = -EINVAL;
+        struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
 
-	lock_kernel();
+	down(&inode->i_sem);	
 	switch(orig) {
 	case 0:
 		if (offset > 0) {
@@ -371,7 +368,7 @@
 	default:
 		break;
 	}
-	unlock_kernel();
+	up(&inode->i_sem);
 	return retval;
 }
 

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

end of thread, other threads:[~2002-07-08  2:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04  6:26 [PATCH] remove BKL from driverfs Dave Hansen
2002-07-04  7:10 ` Greg KH
2002-07-04  7:26   ` Dave Hansen
2002-07-04 22:23     ` Greg KH
2002-07-04 23:38       ` Dave Hansen
2002-07-04 23:58         ` Alexander Viro
2002-07-05  0:08           ` Dave Hansen
2002-07-05 17:09 ` Patrick Mochel
2002-07-05 17:47   ` Patrick Mochel
2002-07-08  0:41     ` Dave Hansen
2002-07-08  2:43       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox