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

Petr Uzel petr.uzel at suse.cz
Thu Jan 28 06:45:09 UTC 2010


Hi,

On Wed, Jan 27, 2010 at 01:51:11PM -0700, Curtis Gedak wrote:
> 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)

                   ^^^^^^^^^^^^^^^^^^^^^
Don't you mean something like 'if (retry_count % 3 == 0)' 
instead? That would pause on the 3rd, 6th and 9th (last) iteration.

> +                        sleep(1); /* Pause to allow system to settle */
>                 if (!retry_count) {
>                         ped_exception_throw (
>                                 PED_EXCEPTION_WARNING,
> 


Petr

--
Petr Uzel, openSUSE Boosters Team
IRC: ptr_uzl @ freenode
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20100128/ab59132a/attachment.pgp>


More information about the parted-devel mailing list