[parted-devel] Possible Race Condition using test code, libparted, and Fedora 12

Curtis Gedak gedakc at gmail.com
Wed Jan 27 20:51:11 UTC 2010


The "failure to inform kernel of partition changes" problem does occur 
with the latest code from the parted git repository (January 27, 2010).

The test details can be found at the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=604298#c24

Now I am running my test to see if the below listed code change will 
alleviate the problem.

If this test is successful for all 99,999 iterations, it will likely 
take several days to complete.  I will report back here with the results.

Regards,
Curtis Gedak


The following code was produced by "git diff":

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index aefe788..1147b1e 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2518,12 +2518,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,




More information about the parted-devel mailing list