Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic bio(4) is MP-safe but mfi(4) is not. So get the k...



details:   https://anonhg.NetBSD.org/src/rev/311321b10579
branches:  trunk
changeset: 750941:311321b10579
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Jan 19 20:54:32 2010 +0000

description:
bio(4) is MP-safe but mfi(4) is not. So get the kernel_lock at
mfi_ioctl() entry and release it on exit.

diffstat:

 sys/dev/ic/mfi.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 07b3c819ee00 -r 311321b10579 sys/dev/ic/mfi.c
--- a/sys/dev/ic/mfi.c  Tue Jan 19 17:51:03 2010 +0000
+++ b/sys/dev/ic/mfi.c  Tue Jan 19 20:54:32 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.30 2009/09/13 21:24:58 dyoung Exp $ */
+/* $NetBSD: mfi.c,v 1.31 2010/01/19 20:54:32 bouyer Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom <marco%peereboom.us@localhost>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.30 2009/09/13 21:24:58 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.31 2010/01/19 20:54:32 bouyer Exp $");
 
 #include "bio.h"
 
@@ -1412,7 +1412,10 @@
 {
        struct mfi_softc *sc = device_private(dev);
        int error = 0;
-       int s = splbio();
+       int s;
+
+       KERNEL_LOCK(1, curlwp);
+       s = splbio();
 
        DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl ", DEVNAME(sc));
 
@@ -1452,6 +1455,7 @@
                error = EINVAL;
        }
        splx(s);
+       KERNEL_UNLOCK_ONE(curlwp);
 
        DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl return %x\n", DEVNAME(sc), error);
        return error;



Home | Main Index | Thread Index | Old Index