Bug 516096 - Race condition in test_swapon_label_0: /sbin/blockdev: BLKRRPART: Device or resource busy
Race condition in test_swapon_label_0: /sbin/blockdev: BLKRRPART: Device or r...
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
All Linux
high Severity high
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-06 13:35 EDT by Richard W.M. Jones
Modified: 2010-05-21 07:33 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-05-12 11:14:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2009-08-06 13:35:28 EDT
Description of problem:

Test fails sometimes with:

/sbin/swapoff -L swapit
psock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
roc 175 (swapoff_label) took 0.07 seconds
sock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
sock_write_event: 0x26d2010 g->state = 3, fd = 3, events = 0x2
sock_write_event: writing 40 bytes ...
sock_write_event: wrote 40 bytes
sock_write_event: done writing, calling send_cb
sock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
proc 85 (zero) took 0.03 seconds
sock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
sock_write_event: 0x26d2010 g->state = 3, fd = 3, events = 0x2
sock_write_event: writing 40 bytes ...
sock_write_event: wrote 40 bytes
sock_write_event: done writing, calling send_cb
/sbin/blockdev --rereadpt /dev/sdb
guestfsd: error: /sbin/blockdev: BLKRRPART: Device or resource busy
proc 65 (blockdev_rereadpt) took 0.09 seconds
sock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
sock_read_event: 0x26d2010 g->state = 3, fd = 3, events = 0x1
/sbin/blockdev: BLKRRPART: Device or resource busy
test_swapon_label_0 FAILED

The proximate cause is this commit:

http://git.et.redhat.com/?p=libguestfs.git;a=commitdiff;h=8eb7f1a58f424ad0f210fe638574b5067d2ac97b

However the underlying reason is that the swapoff operation
doesn't finish before the BLKRRPART ioctl is performed.

In the past we have sometimes seen good effects by adding
calls to udev_settle() at places in the code, although we
don't know if that works just by luck/timing.
Comment 1 Richard W.M. Jones 2010-05-12 07:24:46 EDT
This bug has just reappeared in the build.
Comment 2 Richard W.M. Jones 2010-05-12 11:14:09 EDT
I added this which hopefully will fix the problem:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=9d158c3ab132df21d58890f18224cd2fe020de67
Comment 3 Fedora Update System 2010-05-14 15:12:47 EDT
libguestfs-1.2.6-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.6-1.fc13
Comment 4 Fedora Update System 2010-05-17 08:27:56 EDT
libguestfs-1.2.7-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-1.fc12
Comment 5 Fedora Update System 2010-05-17 08:47:46 EDT
libguestfs-1.2.7-1.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-1.el5
Comment 6 Fedora Update System 2010-05-17 09:00:25 EDT
libguestfs-1.2.7-2.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-2.fc13
Comment 7 Fedora Update System 2010-05-21 07:33:40 EDT
libguestfs-1.2.7-2.fc13.1 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-2.fc13.1

Note You need to log in before you can comment on or make changes to this bug.