Skip to content

Commit bce453c

Browse files
committed
Use unique VolumeSerialNumber on mounts
To avoid errors like: ls: /d/a/b: not listing already-listed directory Signed-off-by: Jorgen Lundman <[email protected]>
1 parent 9ff6199 commit bce453c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

module/os/windows/zfs/zfs_vnops_windows.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,7 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
24192419
int space;
24202420
int error = 0;
24212421
uint64_t refdbytes, availbytes, usedobjs, availobjs;
2422+
uint64_t guid = 0ULL;
24222423

24232424
mount_t *zmo = DeviceObject->DeviceExtension;
24242425
if (!zmo ||
@@ -2438,6 +2439,9 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
24382439
if (zfsvfs->z_os && zfsvfs->z_os->os_spa)
24392440
sectorsz = zfsvfs->z_os->os_spa->spa_min_alloc;
24402441

2442+
if (zfsvfs->z_os)
2443+
guid = dmu_objset_fsid_guid(zfsvfs->z_os);
2444+
24412445
switch (IrpSp->Parameters.QueryVolume.FsInformationClass) {
24422446

24432447
case FileFsAttributeInformation:
@@ -2590,7 +2594,6 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
25902594
FILE_FS_OBJECTID_INFORMATION *ffoi =
25912595
Irp->AssociatedIrp.SystemBuffer;
25922596
RtlZeroMemory(ffoi->ObjectId, sizeof (ffoi->ObjectId));
2593-
uint64_t guid = dmu_objset_fsid_guid(zfsvfs->z_os);
25942597
RtlCopyMemory(ffoi->ObjectId, &guid, sizeof (ffoi->ObjectId));
25952598
RtlZeroMemory(ffoi->ExtendedInfo, sizeof (ffoi->ExtendedInfo));
25962599
Irp->IoStatus.Information =
@@ -2617,7 +2620,11 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
26172620
// PVPB Vpb = zmo->vpb;
26182621
WCHAR *wstr;
26192622

2620-
ffvi->VolumeSerialNumber = 0x19831116;
2623+
uint32_t serial = 0x19831116;
2624+
if (guid)
2625+
serial = (uint32_t)(guid ^ (guid >> 32));
2626+
2627+
ffvi->VolumeSerialNumber = serial;
26212628
#if 0
26222629
ffvi->VolumeLabelLength =
26232630
sizeof (VOLUME_LABEL) - sizeof (WCHAR);

0 commit comments

Comments
 (0)