From f66b08048ca39193cdee14ed5bb8eab66728c238 Mon Sep 17 00:00:00 2001 From: Andrew Innes Date: Fri, 8 Jul 2022 13:50:04 +0800 Subject: [PATCH] Skip __zfs_dbgmsg in a DPC (#104) * Skip dprintf in a DPC Add a check to dprintf that will avoid trying to write to the debug log if we are in a IRQL of DISPATCH_LEVEL or higher. Otherwise we will get a BSOD when __zfs_dbgmsg tries to grab a mutex. https://github.com/openzfsonwindows/openzfs/issues/103 * dprintf avoid bsod while still providing information * Revert: dprintf avoid bsod while still providing information --- module/os/windows/zfs/zfs_debug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/os/windows/zfs/zfs_debug.c b/module/os/windows/zfs/zfs_debug.c index ca509accc84a..1153bfd1e553 100644 --- a/module/os/windows/zfs/zfs_debug.c +++ b/module/os/windows/zfs/zfs_debug.c @@ -203,6 +203,13 @@ __dprintf(boolean_t dprint, const char *file, const char *func, char *prefix = (dprint) ? "dprintf: " : ""; const char *newfile; + /* + * Skip everything if we can't write to the debug log due to + * being in a DPC. + */ + if (KeGetCurrentIrql() >= DISPATCH_LEVEL) + return; + /* * Get rid of annoying prefix to filename. */