mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "bradgoodman.com" <bkgoodman@bradgoodman.com>
To: akpm@zip.com.au, Atul.Mukker@lsil.com, bgoodman@acopia.com,
	linux-kernel@vger.kernel.org, marcelo@conectiva.com.br,
	torvalds@osdl.org
Subject: [PATCH] 2.6.8.1 MegaRAID Driver Race
Date: Mon, 23 Aug 2004 17:57:48 -0400	[thread overview]
Message-ID: <200408232157.i7NLvmB30968@bradgoodman.com> (raw)

[PATCH] 2.6.8.1 to LSI Logic MegaRAID Adapter - ioctl function calls 
mega_internal_command, which uses wait_event, which calls schedule.
This means schedule() is called while big kernel_lock is held.

Locks/Unlocks were done here because 

1. There are a lot of return()s in the ioctl function to dodge.
2. mega_internal_command is also called by read and writes,
   which don't hold big kernel_lock

Brad Goodman <brad@bradgoodman.com>


--- drivers/scsi/megaraid.c.orig	Mon Aug 23 15:57:09 2004
+++ drivers/scsi/megaraid.c	Mon Aug 23 15:18:48 2004
@@ -38,6 +38,7 @@
 #include <linux/blkdev.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
+#include <linux/smp_lock.h>
 #include <linux/delay.h>
 #include <linux/proc_fs.h>
 #include <linux/reboot.h>
@@ -3622,7 +3623,9 @@
 			/*
 			 * Issue the command
 			 */
+			unlock_kernel();
 			mega_internal_command(adapter, LOCK_INT, &mc, pthru);
+			lock_kernel();
 
 			rval = mega_n_to_m((void __user *)arg, &mc);
 
@@ -3705,7 +3708,9 @@
 			/*
 			 * Issue the command
 			 */
+			unlock_kernel();
 			mega_internal_command(adapter, LOCK_INT, &mc, NULL);
+			lock_kernel();
 
 			rval = mega_n_to_m((void __user *)arg, &mc);
 

             reply	other threads:[~2004-08-23 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-23 21:57 bradgoodman.com [this message]
2004-08-23 22:16 ` Andrew Morton
2004-08-28 19:15 ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408232157.i7NLvmB30968@bradgoodman.com \
    --to=bkgoodman@bradgoodman.com \
    --cc=Atul.Mukker@lsil.com \
    --cc=akpm@zip.com.au \
    --cc=bgoodman@acopia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®