Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic mfi.c still uses the spl() synchronisation scheme...



details:   https://anonhg.NetBSD.org/src/rev/e85843b61592
branches:  trunk
changeset: 746983:e85843b61592
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Aug 26 21:41:05 2009 +0000

description:
mfi.c still uses the spl() synchronisation scheme and so needs the kernel lock.
The sysmon subsystem is marked MPSAFE and so runs without the kernel lock.
So get the kernel lock in mfi_sensor_refresh()  before calling
mfi_ioctl_vol().
This fixes command list corruption seen on heavy I/O load on the mfi
driver(4).

diffstat:

 sys/dev/ic/mfi.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r d7b5b916c244 -r e85843b61592 sys/dev/ic/mfi.c
--- a/sys/dev/ic/mfi.c  Wed Aug 26 13:28:48 2009 +0000
+++ b/sys/dev/ic/mfi.c  Wed Aug 26 21:41:05 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.27 2009/07/16 18:58:38 dyoung Exp $ */
+/* $NetBSD: mfi.c,v 1.28 2009/08/26 21:41:05 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.27 2009/07/16 18:58:38 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.28 2009/08/26 21:41:05 bouyer Exp $");
 
 #include "bio.h"
 
@@ -2032,18 +2032,21 @@
        struct mfi_softc        *sc = sme->sme_cookie;
        struct bioc_vol         bv;
        int s;
+       int error;
 
        if (edata->sensor >= sc->sc_ld_cnt)
                return;
 
        memset(&bv, 0, sizeof(bv));
        bv.bv_volid = edata->sensor;
+       KERNEL_LOCK(1, curlwp);
        s = splbio();
-       if (mfi_ioctl_vol(sc, &bv)) {
-               splx(s);
-               return;
+       error = mfi_ioctl_vol(sc, &bv);
        }
        splx(s);
+       KERNEL_UNLOCK_ONE(curlwp);
+       if (error)
+               return;
 
        switch(bv.bv_status) {
        case BIOC_SVOFFLINE:



Home | Main Index | Thread Index | Old Index