[BTRFS] Do not rely on mountmgr when mounting volumes

This turns off mountmgr listening on new devices. Now
BTRFS will only be mounted on demand when OS asks for it. RAID
is not going to work this way probably (have anybody checked it at all?)

This is a temporary workaround for CORE-17469
This commit is contained in:
Victor Perevertkin 2021-07-06 02:37:34 +03:00
parent 93f986463a
commit 4359f48838
No known key found for this signature in database
GPG key ID: C750B7222E9C7830

View file

@ -4218,8 +4218,8 @@ static NTSTATUS check_mount_device(_In_ PDEVICE_OBJECT DeviceObject, _Out_ bool*
NTSTATUS Status;
ULONG to_read;
superblock* sb;
UNICODE_STRING pnp_name;
const GUID* guid;
// UNICODE_STRING pnp_name;
// const GUID* guid;
to_read = DeviceObject->SectorSize == 0 ? sizeof(superblock) : (ULONG)sector_align(sizeof(superblock), DeviceObject->SectorSize);
@ -4247,18 +4247,19 @@ static NTSTATUS check_mount_device(_In_ PDEVICE_OBJECT DeviceObject, _Out_ bool*
DeviceObject->Flags &= ~DO_VERIFY_VOLUME;
pnp_name.Buffer = NULL;
// pnp_name.Buffer = NULL;
Status = get_device_pnp_name(DeviceObject, &pnp_name, &guid);
if (!NT_SUCCESS(Status)) {
WARN("get_device_pnp_name returned %08lx\n", Status);
pnp_name.Length = 0;
}
// Status = get_device_pnp_name(DeviceObject, &pnp_name, &guid);
// if (!NT_SUCCESS(Status)) {
// WARN("get_device_pnp_name returned %08lx\n", Status);
// pnp_name.Length = 0;
// }
*pno_pnp = pnp_name.Length == 0;
// *pno_pnp = pnp_name.Length == 0;
*pno_pnp = true;
if (pnp_name.Buffer)
ExFreePool(pnp_name.Buffer);
// if (pnp_name.Buffer)
// ExFreePool(pnp_name.Buffer);
Status = STATUS_SUCCESS;
@ -6406,9 +6407,9 @@ NTSTATUS __stdcall DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_S
KeInitializeEvent(&mountmgr_thread_event, NotificationEvent, false);
Status = PsCreateSystemThread(&mountmgr_thread_handle, 0, &system_thread_attributes, NULL, NULL, mountmgr_thread, NULL);
if (!NT_SUCCESS(Status))
WARN("PsCreateSystemThread returned %08lx\n", Status);
// Status = PsCreateSystemThread(&mountmgr_thread_handle, 0, &system_thread_attributes, NULL, NULL, mountmgr_thread, NULL);
// if (!NT_SUCCESS(Status))
// WARN("PsCreateSystemThread returned %08lx\n", Status);
IoRegisterFileSystem(DeviceObject);