public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove BKL from ieee1394_core release function
@ 2002-04-05 19:11 Dave Hansen
  2002-04-05 20:10 ` Ben Collins
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Hansen @ 2002-04-05 19:11 UTC (permalink / raw)
  To: andreas.bombe; +Cc: linux1394-devel, linux-kernel

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

I produced a similar patch for 2.5 which I discussed on the ieee1394 
mailing list a few weeks ago.  We decided that this was a safe and 
BKL-free approach.  Here is a patch to do the same thing for 2.4.19-pre6.

Please forward on to Marcello.

-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: ieee1394_core-bkl_remove-2.4.19-pre6.patch --]
[-- Type: text/plain, Size: 1333 bytes --]

--- linux-2.4.19-pre6-clean/drivers/ieee1394/ieee1394_core.c	Fri Apr  5 09:37:37 2002
+++ linux/drivers/ieee1394/ieee1394_core.c	Fri Apr  5 10:51:46 2002
@@ -906,17 +906,16 @@
 
 	/* printk("ieee1394_dispatch_open(%d)", blocknum); */
 
-	/* lock the whole kernel here, to prevent a driver from
-	   being unloaded between the file_ops lookup and the open */
-
-	lock_kernel();
-
 	read_lock(&ieee1394_chardevs_lock);
-	file_ops = ieee1394_chardevs[blocknum].file_ops;
 	module = ieee1394_chardevs[blocknum].module;
+	/* bump the reference count of the driver that
+	   will receive the open() */
+	INCREF(module);
+	file_ops = ieee1394_chardevs[blocknum].file_ops;
 	read_unlock(&ieee1394_chardevs_lock);
 
 	if(file_ops == NULL) {
+		DECREF(module);
 		goto out_fail;
 	}
 
@@ -924,10 +923,6 @@
 	   own file_operations */
 	file->f_op = file_ops;
 
-	/* bump the reference count of the driver that
-	   will receive the open() */
-	INCREF(module);
-	
 	/* at this point BOTH ieee1394 and the task-specific driver have
 	   an extra reference */
 
@@ -956,7 +951,6 @@
 		   and will be dropped by the VFS when the file is
 		   released. */
 		
-		unlock_kernel();
 		return 0;
 	}
 	       
@@ -966,7 +960,6 @@
 	   function returns. */
 	
 	file->f_op = &ieee1394_chardev_ops;
-	unlock_kernel();
 	return retval;
 
 #undef INCREF

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

* Re: [PATCH] remove BKL from ieee1394_core release function
  2002-04-05 19:11 [PATCH] remove BKL from ieee1394_core release function Dave Hansen
@ 2002-04-05 20:10 ` Ben Collins
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Collins @ 2002-04-05 20:10 UTC (permalink / raw)
  To: Dave Hansen; +Cc: andreas.bombe, linux1394-devel, linux-kernel

On Fri, Apr 05, 2002 at 11:11:28AM -0800, Dave Hansen wrote:
> I produced a similar patch for 2.5 which I discussed on the ieee1394 
> mailing list a few weeks ago.  We decided that this was a safe and 
> BKL-free approach.  Here is a patch to do the same thing for 2.4.19-pre6.

Just let me put this into the linux1394 repo, and I'll forward the patch
to Marcello and Linus. Keeps me from having to track 3 sets of changes.

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://linux1394.sourceforge.net/
Subversion - http://subversion.tigris.org/

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

end of thread, other threads:[~2002-04-05 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-05 19:11 [PATCH] remove BKL from ieee1394_core release function Dave Hansen
2002-04-05 20:10 ` Ben Collins

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