~curtin-dev/curtin/trunk

Viewing all changes in revision 502.

Resolve bcache race-conditions

Creation and removal of bcache devices continues to be somewhat
racy preventing reliable installation of bcache configurations.
This patch resolves both removal and creation race conditions
by checking additional attributes in sysfs and applying reasonable
retries with bounded timeouts.

In some cases, it is not sufficient to check only that
/sys/class/block/bcacheN has been removed to ensure exclusive
access to any of the underlying slave devices of bcacheN.

In BcacheBasic vmtest, we bind a bcache device to a partition
and separate block device and will sometimes not wait long
enough for the kernel to release on or more of the slave devices.

This patch resolves this by checking the bcache device and
all of the slave devices to see if they're still bound by the
bcache layer. If so, then we run the shutdown code on the
bcacheN block device.

We also introduce a udevamd_settle between wiping the cache
set device and checking on the backing device.

Even though we now check slave devices, there still may be other
holders of the device (very likely udev related), thus we
introduce a retry loop in clear_holders when we attempt to
wipe a volume (which requires exclusive access).

During testing, we also uncovered issues which are addressed
 - Allow strict parameter to be set from the top callers
   all the way down; this handles the case where a block
   device may be deleted during the resolution of a devname
   to a sysfs path.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: