[parted-devel] [PATCH] Always allow at least two sectors for extended boot record
Jim Meyering
jim at meyering.net
Mon Mar 29 16:49:56 UTC 2010
Colin Watson wrote:
> Unless specifically told otherwise, the Linux kernel considers extended
> boot records to be two sectors long, in order to "leave room for LILO".
> When using anything other than cylinder alignment, libparted was only
> allowing one sector in the minimum extended partition geometry, which in
> some situations (e.g. following Phillip Susi's patch to reintroduce
> BLKPG) could confuse the kernel into thinking that the EBR and the first
> logical partition overlapped.
>
> * libparted/labels/dos.c (_get_min_extended_part_geom): Allow at least
> two sectors for the extended boot record.
> ---
> libparted/labels/dos.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
> index 6fb4aef..c25d35a 100644
> --- a/libparted/labels/dos.c
> +++ b/libparted/labels/dos.c
> @@ -1747,7 +1747,11 @@ _get_min_extended_part_geom (const PedPartition* ext_part,
> min_geom = ped_geometry_duplicate (&walk->geom);
> if (!min_geom)
> return NULL;
> - ped_geometry_set_start (min_geom, walk->geom.start - 1 * head_size);
> + /* We must always allow at least two sectors at the start, to leave
> + * room for LILO. See linux/fs/partitions/msdos.c.
> + */
> + ped_geometry_set_start (min_geom,
> + walk->geom.start - PED_MAX (1 * head_size, 2));
>
> for (walk = ext_part->part_list; walk; walk = walk->next) {
> if (!ped_partition_is_active (walk) || walk->num == 5)
Thanks!
This looks like a fine patch.
However, I would like a minimal test that fails without it,
yet that succeeds with the patch.
Can you provide one?
More information about the parted-devel
mailing list