avoid creation of partitions beyond actual capacity (patch for 2.6.15)

Gerte Hoogewerf gerte at nieuwenborg.nl
Wed Feb 8 20:47:34 UTC 2006


In reply to: "Here is how to stop the new udev from accessing your
striped	 dmraid drives (Peter Jones)"

Hi folkes,

When using striped Fake-Raid's the partition table of a RAID set is
oftenly found at the fist sector on one of the underlying disks. This
confuses the kernel which creates partitions for every disk carrying a
partition table. It's very likely such a partition starts at an offset
beyond the end of a single device that belongs to the striped set. The
result is a partition like /dev/sdXY which starts at an offset beyound the
maximum capacity of the device. If any (user-)code accesses the device the
kernel will output scary block IO errors. Udev will acces the device, so
the errors will occur everytime you boot.

People on this list are proposing to prevent udev, hal et altera to access
the device. This can be done by removing udev rules, like the way Peter
Jones describes. I solved the underlying problem on my setup by a kernel
patch. I never felt any need to share the code, until now: The code seems
to be interesting for more people.

My approach just prevents the kernel to create invalid partitions:
partitions beyond the end of a device won't be created (the offset is set
to zero and rest of the existing code path won't create the partition).
In fact the patch adds a check in the partition detection code. Not
creating partitions with an offset >= capacity won't hurt any other code.
Not using the patch won't hurt either, but I found it annoying to see
Block IO errors in my syslogger just because of a tiny kernel bug.

You can download / review the patch here:
http://tienstra4.flatnet.tudelft.nl/~gerte/linux-2.6.15-dont-create-incorrect-partitions.txt

A copy of the patch has been attached to this e-mail.

Feel free to alter or include in any distribution,
Gerte
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: linux-2.6.15-dont-create-incorrect-partitions.txt
URL: <http://listman.redhat.com/archives/ataraid-list/attachments/20060208/075bfbdc/attachment.txt>


More information about the Ataraid-list mailing list