Comment 6 for bug 1443542

Revision history for this message
Oleg Strikov (strikov-deactivatedaccount) wrote :

Execution of blockdev --rereadpt simply issues a call to ioctl(BLKRRPART) which forces kernel to re-initialize its metadata. Kernel adds information about newly created partition here: http://lxr.linux.no/#linux+v3.19.1/block/partition-generic.c#L269 You can see a call to kobject_uevent() which puts event to udev's queue. So to me it looks like udev settle should have all the information available. Only if blockdev succeeds though. We don't check its return code if I got it correctly.

Another interesting point is that there are two popular ways to re-read the partition table: BLKRRPAR ioctl (used by blockdev) and BLKPG ioctl (used by partprobe). They are very different. While BLKRRPAR lets kernel know that partition table needs to be re-read, BLKPG tells kernel the exact partitioning layout (parted does this because it wants to have ultimate control over things). BLKPG may be more udev-friendly because parted-based tools are more popular. We may want to try partprobe instead of blockdev and see if it solves the issue.