From f9fd6397e6849f2cb28ce3326717172a9a8c66c9 Mon Sep 17 00:00:00 2001 From: Raghunath M <84957265+datacore-rm@users.noreply.github.com> Date: Sat, 9 Mar 2024 05:09:04 +0530 Subject: [PATCH] Allocate memory for Remove lock using ExAllocatePoolWithTag(). (#360) --- module/os/windows/zfs/zfs_windows_zvol_scsi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/os/windows/zfs/zfs_windows_zvol_scsi.c b/module/os/windows/zfs/zfs_windows_zvol_scsi.c index 7f8cfe63c1f0..5c5fbfa8508c 100644 --- a/module/os/windows/zfs/zfs_windows_zvol_scsi.c +++ b/module/os/windows/zfs/zfs_windows_zvol_scsi.c @@ -113,7 +113,7 @@ wzvol_decref_target(wzvolContext* zvc) // when refCnt is 0 we can free the remove lock block. // All IoReleaseRemoveLock have been called. atomic_cas_ptr(&zvc->pIoRemLock, pIoRemLock, NULL); - kmem_free(pIoRemLock, sizeof (*pIoRemLock)); + ExFreePoolWithTag(pIoRemLock, MP_TAG_GENERAL); } } @@ -156,8 +156,9 @@ wzvol_assign_targetid(zvol_state_t *zv) { wzvolContext* zv_targets = STOR_wzvolDriverInfo.zvContextArray; ASSERT(zv->zv_zso->zso_target_context == NULL); - PIO_REMOVE_LOCK pIoRemLock = kmem_zalloc(sizeof (*pIoRemLock), - KM_SLEEP); + PIO_REMOVE_LOCK pIoRemLock = ExAllocatePoolWithTag(NonPagedPoolNx, + sizeof (*pIoRemLock), MP_TAG_GENERAL); + if (!pIoRemLock) { dprintf("ZFS: Unable to assign targetid - out of memory.\n"); ASSERT("Unable to assign targetid - out of memory."); @@ -212,7 +213,7 @@ wzvol_assign_targetid(zvol_state_t *zv) IoReleaseRemoveLock(pIoRemLock, zv); } - kmem_free(pIoRemLock, sizeof (*pIoRemLock)); + ExFreePoolWithTag(pIoRemLock, MP_TAG_GENERAL); dprintf("ZFS: Unable to assign targetid - out of room.\n"); ASSERT("Unable to assign targetid - out of room."); return (0);