My testing of the patch for the "failure to inform kernel of partition
changes" problem was successful. All 99,999 iterations completed
successfully, and the test took about 5.5 days to run.
Attached is the patch based on the master branch of the git repository
as of February 2, 2010.
Regards,
Curtis Gedak
>From 87d0f3c51ee301b0a0b9534dd902cf4a1bbed0c4 Mon Sep 17 00:00:00 2001
From: Curtis Gedak <[email protected]>
Date: Fri, 29 Jan 2010 16:17:21 -0700
Subject: [PATCH] linux: add wait time and retries to kernel partition reread
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): add time and retries
---
libparted/arch/linux.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index f3b54f0..2b0cee0 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2516,12 +2516,14 @@ static int
_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,
--
1.6.6
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel