]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: Fix probe_ioctl_tp assigning BLKGETDISKSEQ as physical sector size
authorSam Fink <fsamuel@netapp.com>
Wed, 17 Sep 2025 14:04:51 +0000 (10:04 -0400)
committerSam Fink <fsamuel@netapp.com>
Wed, 17 Sep 2025 14:28:54 +0000 (10:28 -0400)
Fix issue introduced by PR#2908 in probe_ioctl_tp where the BLKGETDISKSEQ ioctl
result is incorrectly assigned to the topology with
blkid_topology_set_physical_sector_size instead of blkid_topology_set_diskseq.

This issue was observed while using a Debian 13 container on a RHEL 9.4 host
attempting to format a volume. The physical sector size was incorrectly
reported as 3. This issue also presents with the fdisk command,
which also uses this library to resolve physical sector size of devices.

Example fdisk output:
root@r94p121-PA:~ # fdisk --list /dev/sdb
Disk /dev/sdb: 90 GiB, 96636764160 bytes, 188743680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 3 bytes
I/O size (minimum/optimal): 512 bytes / 3 bytes

Strace of relevant ioctls:
ioctl(3, BLKALIGNOFF, [0])              = 0
ioctl(3, BLKIOMIN, [512])               = 0
ioctl(3, BLKIOOPT, [0])                 = 0
ioctl(3, BLKPBSZGET, [512])             = 0
ioctl(3, BLKGETDISKSEQ, [3])            = 0
ioctl(3, BLKSSZGET, [512])              = 0

libblkid/src/topology/ioctl.c

index 7b15c9e9a74d54ca4481c5a7dad526d9972a9a24..e95d67739cd1ceb013e9c14ce511ce7f3be8e460 100644 (file)
@@ -46,7 +46,7 @@ static int probe_ioctl_tp(blkid_probe pr,
 
        if (ioctl(pr->fd, BLKGETDISKSEQ, &u64) == -1)
                return 1;
-       if (blkid_topology_set_physical_sector_size(pr, u64))
+       if (blkid_topology_set_diskseq(pr, u64))
                return -1;
 
        return 0;