[dm-devel] Partition size set to 0 when resizing extended and adding logical partition with BLKPG

Kai Lüke kailueke at riseup.net
Tue Apr 9 17:58:18 UTC 2019


Ah, no, forget about it, sorry.

It's a bug in libparted and that's why I observed the wrong argument in
strace which made it into my code as well.
The length should be of course 512 and not 1 due to the different units.

Patch would be adding the following line to libparted/arch/linux.c:2551:
+++        linux_part.length *= disk->dev->sector_size;
(function _blkpg_resize_partition)

Well, thanks for reading it anyway. I will submit a patch.

Am 09.04.19 um 18:41 schrieb Kai Lüke:
> Hello,
>
> I write to you because I believe that the BLKPG ioctl misbehaves when an
> existing extended MBR partition is changed and a logical partition added
> in it.
> Should I report like this or should I sign up for bugzilla.kernel.org?
>
> The /sys/block/sdx/sdxY/size entry is set to 0 and even opening the
> extended partition fails.
> This leads to e.g. udevd failing to have access.
> https://github.com/storaged-project/udisks/issues/425
>
> To fix this situation from userspace, a BLKRRPART ioctl is needed.
>
> To reproduce it, I attached a small program, which you can run on this
> prepared image or on any drive with a single extended partition on it.
>
> $ wget http://kailueke.spline.de/test.img
> $ udisksctl loop-setup -f test.img
>
> $ sudo ./sim loop0
> new size in /sys/block/loop0/loop0p1/size: 0
> issuing BLKRRPART
> new size in /sys/block/loop0/loop0p1/size: 2
>
>
> Do you think that this should be fixed in the kernel?
> Regards,
> Kai Lüke
>




More information about the dm-devel mailing list