On Mon, Dec 14, 2015 at 01:11:59PM +0100, Ruediger Meier wrote: > our test suite shows that many sfdisk tests fail sometimes to "Re-read > partition table" at the end. I was able to find some systems where > I could re-produce the problem using the script below. Yes, the problem is probably udev, and "udevadm settle" is not always enough. > Seems that the problem is because of the first BLKRRPART ioctl call > in sfdisk.c function is_device_used(). Maybe it cause udev or > whatever to open the device and then the real BLKRRPART in > write_changes() fails. but the device has to be already partitioned, on disk without partitions BLKRRPART (and is_device_used()) does not generate any events (try "udevadm monitor"). > Removing the first BLKRRPART ioctl (or sleeping about 50ms after the first one) > "fixes" the issue. The is_device_used() in the sfdisk is nothing elegant, maybe we can use --noreread sfdisk command line option in the tests. Anyway, it would be nice to have some in-sfdisk solution, because our users who use fdisk in scripts may be affected by the same problem. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html