[parted-devel] [PATCH 2/4] libparted: remove extraneous blkpg add partition ped exception

Phillip Susi psusi at ubuntu.com
Thu Jan 12 20:08:02 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/12/2012 12:18 PM, Phillip Susi wrote:
> After looking at it carefully, it appears to me that before
> Collin's patch, it made sure to leave a whole cylinder before the
> first logical partition.  After his patch, it only requires 2
> sectors, not a whole cylinder.
> 
> It also appears that the constraint that this function generates
> is only used when aligning the extended partition, so it only
> matters for the purposes of align-check.  It has no affect on this
> test.
> 
> The reason that BLKPG_ADD_PARTITION fails when the logical
> partition starts on the immediately following sector is because 
> _blkpg_add_partition sets the length of the extended partition to
> 2 sectors when it is added.  It should not do this when there is a 
> logical partition that claims that second sector, and then this
> would work fine.
> 
> So what this test is really validating is that parted incorrectly 
> attempts to add overlapping partitions to the kernel, and that the 
> kernel fails that request.  I think that the incorrect behavior
> should be fixed and the test should validate that it works, not
> that it fails.
> 
> I'll work on a patch tonight.

I have patched parted to be able to correctly add the logical
partition.  Before I do anything with the test though, I want to ask
what should be done.  The test comment says:

# Ensure that parted leaves at least 2 sectors between the beginning
# of an extended partition and the first logical partition.
# Before parted-2.3, it could be made to leave just one, and that
# would cause trouble with the Linux kernel.

So obviously when you wrote the test, you thought that parted was
supposed to stop you from creating that logical partition.  Parted
never did this though.  It happily lets you create that partition,
writes it to the partition table, and then tries to inform the kernel
about the logical partition, but it overlaps the extended partition
and so the kernel refuses to add it.  This is the error message that
this test is actually checking.

If you reboot ( or BLKRRPRT ), then the kernel recognizes the logical
partition, and happily lets it overlap with the extended.  If you try
to install LILO to the extended partition, then it trounces on the
boot sector of the logical partition.  This is a bug in the kernel
that should be fixed; the extended partition length should not be set
to a length of 2 sectors if that second sector is claimed by a logical
partition.

So I see two possible ways to go:

1)  Fix parted to *correctly* sync the logical partition to the kernel
( see attached patch ), and change this test to make sure that works

2)  Fix parted to refuse to allow you to create that logical
partition, and fix the test to look for that new error message.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPDz2hAAoJEJrBOlT6nu75yUQH/AvO0m9xAbNPt0IVffs+goZg
a5JO5dZ1yfM0Go3LpJUPHJO+hfl/wVe4xN3pxhMyMhxcy3SVPc2BMmjPLP46ogqu
jpoMJ1DlZhk0FAiXxj95ymWp9DAJGGOzbBIFVoKjbx+QZaZAlWuBoftvBurex8Qn
FWsmHavxw/YsHgQLtznyJ5N5i7ukplJhDdD1SU+Wl/grisdYCcGmxOO2GMbalZWS
C6Iroql/VEJyPj3gRF/9T3i0DrdnljF6ImKRu61DfiTfKl9uag6oR3Jr4PPKbUKV
sPmNvcdLnIDMoSZPTqlLNw9zK90MnWZyyiXwDuxfR7n0pSihzcN/0hEJtliH/vA=
=YU7j
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-libparted-handle-logical-partitions-starting-immedia.patch
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20120112/6414c228/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libparted-handle-logical-partitions-starting-immedia.patch.sig
Type: application/octet-stream
Size: 287 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20120112/6414c228/attachment.obj>


More information about the parted-devel mailing list