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

Curtis Gedak gedakc at gmail.com
Tue Dec 22 00:25:45 UTC 2009


I am seeking help to resolve a intermittent problem when using the 
libparted library.


PROBLEM

The problem is that occasionally GParted encounters the following error 
message:

     The kernel was unable to re-read the partition table on /dev/sdb 
(Device
     or resource busy).  This means Linux won't know anything about the
     modifications you made until you reboot.  You should reboot your 
computer
     before doing anything with /dev/sdb.

I do not expect anyone to have to deal with the GParted code base.  
Hence I have produced a snippet of code and a script that will reproduce 
the problem.

I am not sure if the root cause is a problem with my code, with the 
parted library, or with some other component of a GNU/Linux distribution.

Due to the intermittent nature of the error I suspect some sort of race 
condition, possibly related to the kernel and udev.  It should be noted 
that this problem also occurs with Debian Sid that we use on the GParted 
Live CD.  The problem does not appear to occur on older distributions, 
such as Ubuntu 8.04.

Any help with this problem would be much appreciated.

Sincerely,
Curtis Gedak
Maintainer of GParted


STEPS TO REPRODUCE PROBLEM

1)  Start with a fedora 12 image.

     I built a virtual machine using the Fedora-12-i686-Live.iso image file.

2)  Install prerequisites to compile the code:

     $ yum groupinstall "Development Tools"
     $ yum install parted-devel
     $ yum install e2fsprogs-devel

3)  Compile the code

     $ gcc -lparted -ldl -o resize-using-libparted resize-using-libparted.c

4)  Test for the error using a hard disk device with no important data.

      WARNING:  The drive used for testing will be erased!

     $ ./test-partition-resize.sh /dev/sdb 99999


SCREEN SHOT

Attached is a screen shot of the problem occurring on iteration 242.  
This problem is random in nature and can occur at anytime.


RELEVANT GPARTED LINKS

WARNING! Problem Resizing File Systems with GParted
http://gparted-forum.surf4.info/viewtopic.php?id=13777

Bug 604298 -  Problems resizing file systems with gparted-live-0.5.0-3
https://bugzilla.gnome.org/show_bug.cgi?id=604298
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-partition-resize.sh
Type: application/x-sh
Size: 3512 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20091222/c21e66a8/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fedora-12-resize-using-libparted-failure.png
Type: image/png
Size: 128180 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20091222/c21e66a8/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resize-using-libparted.c
Type: text/x-csrc
Size: 2997 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20091222/c21e66a8/attachment.c>


More information about the parted-devel mailing list