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

Curtis Gedak gedakc at gmail.com
Fri Jan 29 16:31:57 UTC 2010


Hi Petr and Jim,

Both of your questions and suggestions are valid.  If I can paraphrase 
what you wrote:

     Jim:  If a one second sleep fixes the problem, then why not try 
1/10s or 1/2s, or sleeping 200ms multiple times before giving up?

     Petr:  Why sleep on the third iteration and not on the last iteration?

The challenge with this problem is that there is probably more than one 
solution that would work.  These same type of questions could be asked 
of the original implementation that tried 5 times before giving up.  For 
example, why not try only 4 times, or perhaps 6 times?

My guess is that the original author found that 5 times appeared to 
solve the problem and hence 5 is the number that was used.

I believe that the solution I have proposed falls into the same 
category.  I wished to maintain at least the same number of tries as the 
original code before invoking the sleep.  Then following the sleep I 
wished to have at least a couple of more tries before the function would 
give up.  I happened to choose 9 and 3 because I liked these numbers and 
the solution appears to work (my test has now run over 35,000 iterations 
successfully).

Perhaps a better solution would involve both of your suggestions.

 From my perspective I am interested in having this problem fixed.  
Because I have been working on this problem since November and I believe 
that the proposed solution does address the problem, I am inclined to 
leave it at that.  I think that for me, spending more time on this 
problem will result in significantly diminishing returns.

Please feel free to improve upon the solution.  This is one of the great 
benefits of free open source software.

I will report back with the status of my test when it completes.  I 
anticipate that this will take at least a few more days.

Sincerely,
Curtis Gedak



More information about the parted-devel mailing list