[parted-devel] partprobe gives errors with dvh partition no. >16
Jim Meyering
jim at meyering.net
Tue Jun 24 16:20:12 UTC 2008
Petr Uzel <petr.uzel at suse.cz> wrote:
> Hi list,
>
> I believe there's a bug in parted/partprobe. However, I don't fully understand
> its background, so I rather describe steps to reproduce and possible solution
> (of course I'm not sure it is correct).
...
> I think that the problem is in function _disk_sync_part_table() in
> libparted/arch/linux.c. When determining last partition which is to be
> removed/added, PED_MIN() has to be used instead of PED_MAX(). This ensures
> that it would be never done for partition with number greater than 16.
>
> If I am right, some description/comment of the magic number 16 used in the
> code would be useful.
>
> Same problem (if it is actually a problem) is in _dm_reread_part_table().
>
> I would attach a patch, but since I didn't sign the FSF copyright assignment I
> rather didn't do so ;)
Thanks for the report and analysis.
Actually, you're welcome to send tiny patches like that (s/MAX/MIN/),
and we can apply them. But once we've applied more than ~10-15
lines worth of changes from you, we'll need a copyright assignment.
FYI, here's shell code to create 16 primary partitions on
a DVH partition.
N=50 dev=dev-file; dd if=/dev/null of=$dev bs=1 seek=${N}M
./parted -s $dev mklabel dvh mkpart primary fat32 2M 10M
for i in $(seq 11 23); do
echo $i
./parted -s $dev mkpart primary fat32 ${i}M $((i+1))M
done
Can you add to that (or change it) -- using dvhtool, or some other tool --
to create a table that makes partprobe fail?
I agree that the first PED_MAX should be changed to PED_MIN, since
I can't see a reason to check more than the number of partitions
returned by ped_disk_get_last_partition_num, while I do see a reason
(max of 16 minor devices per major device number) to limit to a maximum.
As Bryn said, the DM-related code need not be subject to the limit
of 16 partitions, so this will have to change, too:
_dm_reread_part_table (PedDisk* disk)
{
int rc = 1;
int last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
I will wait to hear back from Bryn on his tests.
More information about the parted-devel
mailing list