On Fri, Jun 04, 2021 at 10:04:46PM +0300, Alper Nebi Yasak wrote: > Some filesystem tests are failing when their image is prepared with > guestmount, but succeeding if loop mounts are used instead. The reason > seems to be a race condition the guestmount(1) manual page explains: > > When guestunmount(1)/fusermount(1) exits, guestmount may still be > running and cleaning up the mountpoint. The disk image will not be > fully finalized. > > This means that scripts like the following have a nasty race condition: > > guestmount -a disk.img -i /mnt > # copy things into /mnt > guestunmount /mnt > # immediately try to use 'disk.img' ** UNSAFE ** > > The solution is to use the --pid-file option to write the guestmount > PID to a file, then after guestunmount spin waiting for this PID to > exit. > > The Python standard library has an os.waitpid() function for waiting a > child to terminate, but it cannot wait on non-child processes. Implement > a utility function that can do this by polling the process repeatedly > for a given duration, optionally killing the process if it won't > terminate on its own. Apply the suggested solution with this utility > function, which makes the failing tests succeed again. > > Signed-off-by: Alper Nebi Yasak <alpernebiya...@gmail.com> > Reviewed-by: Simon Glass <s...@chromium.org>
Applied to u-boot/master, thanks! -- Tom
signature.asc
Description: PGP signature