Occasionally when using parted with newer GNU/Linux kernels (2.6.31)
and udev (145), the kernel would fail to reread the partition table.
This could lead to problems with subsequent actions such as formatting
the partition.
Basically this patch increases the retry_count, and adds one sleep(1)
function call prior to the the last few ioctl() calls.
This patch might not be a perfect solution to this problem of "failure
to inform kernel of partition changes", but it does significantly
reduce the likelihood of encountering the problem.
Details on the testing results and procedures used can be found at
the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=604298#c9
* libparted/arch/linux.c (_kernel_reread_part_table): Sleep for a
full second if retry_count makes it down to "3". Start it at 9
rather than at 5.
* NEWS (Bug fixes):
"make install" no longer installs tests programs named disk and label
+ libparted: try harder to inform kernel of partition changes.
+ Previously when editing partitions, occasionally the kernel would
+ fail to be informed of partition changes. When this happened future
+ problems would occur because the kernel had incorrect information.
+ For example, if this problem arose when resizing or creating a
+ new partition, then an incorrect partition size might be displayed
+ or a user might encounter a failure to format or delete a newly
+ created partition, respectively.
+
* Noteworthy changes in release 2.1 (2009-12-20) [stable]
/* libparted - a library for manipulating disk partitions
- Copyright (C) 1999 - 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
_kernel_reread_part_table (PedDevice* dev)
{
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
- int retry_count = 5;
+ int retry_count = 9;
sync();
while (ioctl (arch_specific->fd, BLKRRPART)) {
retry_count--;
sync();
+ if (retry_count == 3)
+ sleep(1); /* Pause to allow system to settle */
+
if (!retry_count) {
ped_exception_throw (
PED_EXCEPTION_WARNING,