Skip to content

Commit

Permalink
Restore VolumeLabel as ZFS name, detach storport
Browse files Browse the repository at this point in the history
tighten some mount error cases.

Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Sep 2, 2024
1 parent 270cf59 commit 18d9b18
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions module/os/windows/zfs/zfs_ioctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,8 @@ zfs_unload_ioctl(

IoDetachDevice(DriverExtension->LowerDeviceObject);

if (DriverExtension->FunctionalDeviceObject->AttachedDevice)
IoDetachDevice(DriverExtension->FunctionalDeviceObject);
if (DriverExtension->StorportDeviceObject)
IoDetachDevice(DriverExtension->StorportDeviceObject);
IoDeleteDevice(DriverExtension->FunctionalDeviceObject);

IoDetachDevice(DriverExtension->PhysicalDeviceObject);
Expand Down
11 changes: 10 additions & 1 deletion module/os/windows/zfs/zfs_vnops_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -2515,10 +2515,15 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
WCHAR *wstr;

ffvi->VolumeSerialNumber = 0x19831116;
#if 0
ffvi->VolumeLabelLength =
sizeof (VOLUME_LABEL) - sizeof (WCHAR);
wstr = VOLUME_LABEL;

#else
ffvi->VolumeLabelLength =
zmo->name.Length;
wstr = zmo->name.Buffer;
#endif
int space =
IrpSp->Parameters.QueryFile.Length -
FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel);
Expand Down Expand Up @@ -6129,6 +6134,10 @@ volume_create(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject,
{
mount_t *zmo = DeviceObject->DeviceExtension;

if ((zmo->type != MOUNT_TYPE_VCB) &&
(zmo->type != MOUNT_TYPE_DCB))
return (STATUS_INVALID_PARAMETER);

#if 1
if (zmo->vpb != NULL)
FileObject->Vpb = zmo->vpb;
Expand Down
10 changes: 9 additions & 1 deletion module/os/windows/zfs/zfs_vnops_windows_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,11 +1063,19 @@ InitVpb(__in PVPB Vpb, __in PDEVICE_OBJECT VolumeDevice, mount_t *zmo)
{
if (Vpb != NULL) {
Vpb->DeviceObject = VolumeDevice;
#if 0
Vpb->VolumeLabelLength =
MIN(sizeof (VOLUME_LABEL) - sizeof (WCHAR),
sizeof (Vpb->VolumeLabel));
RtlCopyMemory(Vpb->VolumeLabel, VOLUME_LABEL,
Vpb->VolumeLabelLength);
#else
Vpb->VolumeLabelLength =
MIN(zmo->name.Length,
sizeof (Vpb->VolumeLabel));
RtlCopyMemory(Vpb->VolumeLabel, zmo->name.Buffer,
Vpb->VolumeLabelLength);
#endif
Vpb->SerialNumber = 0x19831116;
Vpb->Flags |= VPB_MOUNTED;
}
Expand Down Expand Up @@ -1824,7 +1832,7 @@ matched_mount(PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceToMount,
0ULL,
FILE_READ_ATTRIBUTES);
vp = vcb->root_file->FsContext;
if (VN_HOLD(vp) == 0) {
if (vp && VN_HOLD(vp) == 0) {
vnode_ref(vp);
VN_RELE(vp);
}
Expand Down

0 comments on commit 18d9b18

Please sign in to comment.