Module Name:    src
Committed By:   snj
Date:           Thu Sep 10 07:06:34 UTC 2009

Modified Files:
        src/sys/dev/ic [netbsd-5]: mfi.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #931):
        sys/dev/ic/mfi.c: revision 1.28 via patch
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).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/dev/ic/mfi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.19 src/sys/dev/ic/mfi.c:1.19.4.1
--- src/sys/dev/ic/mfi.c:1.19	Thu Oct 23 21:00:06 2008
+++ src/sys/dev/ic/mfi.c	Thu Sep 10 07:06:34 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.19 2008/10/23 21:00:06 bouyer Exp $ */
+/* $NetBSD: mfi.c,v 1.19.4.1 2009/09/10 07:06:34 snj Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.19 2008/10/23 21:00:06 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.19.4.1 2009/09/10 07:06:34 snj Exp $");
 
 #include "bio.h"
 
@@ -1930,18 +1930,20 @@
 	struct mfi_softc	*sc = sme->sme_cookie;
 	struct bioc_vol		bv;
 	int s;
+	int error;
 
 	if (edata->sensor >= sc->sc_ld_cnt)
 		return;
 
 	bzero(&bv, 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:

Reply via email to