[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 0/2] Work-around blkid running from udev after device close.

This is a possibly better work-around for bug 769304, the bug where
blkid runs from udev whenever a device closes, causing the subsequent
operation to fail.  For background to this change, see:


So far we have noticed this problem in two places (although I'm fairly
certain it affects many more):

 - in virt-resize, after copy_device_to_device and before
   part_set_bootable (which runs parted)

 - in virt-format, after wiping the device (which writes zeroes then
   closes it) and before blockdev_rereadpt

The fix is to run udev_settle *before* all blockdev, parted and sfdisk
commands.  Note we do it before because at this point a blkid command
may be running which we have to wait for.  None of these commands
should be performance sensitive (unlike pwrite_device, where I have
removed the udev_settle call).

In the parted and sfdisk cases we also have to run this command
afterwards, since parted itself will have closed the block device.

There may be alternatives to this patch:

 - Add a udev rule (temporarily?)  which causes udev to ignore devices
   that libguestfs is using.  However I feel this could be dangerous
   since it may affect more than just the problematic blkid operation.

 - Edit the udev rules so that the blkid rule doesn't run.  This
   requires complex and distro-specific edits to built-in udev rules.

 - Get something into udev upstream which lessens the effect of the
   blkid rule (eg. delaying it or disabling it in some circumstances)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]