Module Name: src
Committed By: martin
Date: Tue Dec 4 12:00:42 UTC 2018
Modified Files:
src/sys/dev [netbsd-8]: ld.c
Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1122):
sys/dev/ld.c: revision 1.105
take kernel lock for ioctl calls when backend isn't tagged MPSAFE.
To generate a diff of this commit:
cvs rdiff -u -r1.101.2.1 -r1.101.2.2 src/sys/dev/ld.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/ld.c
diff -u src/sys/dev/ld.c:1.101.2.1 src/sys/dev/ld.c:1.101.2.2
--- src/sys/dev/ld.c:1.101.2.1 Fri Sep 1 09:59:10 2017
+++ src/sys/dev/ld.c Tue Dec 4 12:00:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.101.2.1 2017/09/01 09:59:10 martin Exp $ */
+/* $NetBSD: ld.c,v 1.101.2.2 2018/12/04 12:00:41 martin Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.101.2.1 2017/09/01 09:59:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.101.2.2 2018/12/04 12:00:41 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -369,7 +369,11 @@ ldioctl(dev_t dev, u_long cmd, void *add
return (error);
if (sc->sc_ioctl) {
+ if ((sc->sc_flags & LDF_MPSAFE) == 0)
+ KERNEL_LOCK(1, curlwp);
error = (*sc->sc_ioctl)(sc, cmd, addr, flag, 0);
+ if ((sc->sc_flags & LDF_MPSAFE) == 0)
+ KERNEL_UNLOCK_ONE(curlwp);
if (error != EPASSTHROUGH)
return (error);
}
@@ -388,7 +392,11 @@ ld_flush(device_t self, bool poll)
struct ld_softc *sc = device_private(self);
if (sc->sc_ioctl) {
+ if ((sc->sc_flags & LDF_MPSAFE) == 0)
+ KERNEL_LOCK(1, curlwp);
error = (*sc->sc_ioctl)(sc, DIOCCACHESYNC, NULL, 0, poll);
+ if ((sc->sc_flags & LDF_MPSAFE) == 0)
+ KERNEL_UNLOCK_ONE(curlwp);
if (error != 0)
device_printf(self, "unable to flush cache\n");
}