Yes, this is my read on the issue as well.  The trigger is related to
the inotify watch that systemd-udevd puts on the disk.  Something that
might help that we could try per xnox's comment around use of flock.

if growpart were to flock /dev/sda (we need to sort out what flags are
needed to prevent udev probe and rule execution) prior to running
sgdisk, and not release this flock until after partx runs (to inform the
kernel of the update) and a udevadm settle (and possibly a trigger of a
CHANGE event).

This should prevent early reads of the modified but not update-to-date
partition data in the kernel.

Lastly, another area of exploration is:  why isn't a change event
emitted when partx runs to update the kernel with new partition data?

If there is one, and the rules then generate the correct symlink;
another approach for growpart is for it to block until the size of the
new partition is correct.  growpart calculates what the new size should
be; so it could poll for this value thus blocking cloud-init's size
check from running until growpart is confident that the kernel has
updated the correct value (and the subsequent rules have completed
execution)!

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1834875

Title:
  cloud-init growpart race with udev

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1834875/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to