All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Stephen Warren <swarren@nvidia.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH 2/2] test/py: Wait for guestmount worker to exit after running guestunmount
Date: Mon, 5 Jul 2021 20:58:46 -0400	[thread overview]
Message-ID: <20210706005846.GG9516@bill-the-cat> (raw)
In-Reply-To: <20210604190447.45342-2-alpernebiyasak@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

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 <alpernebiyasak@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  parent reply	other threads:[~2021-07-06  0:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 19:04 [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests Alper Nebi Yasak
2021-06-04 19:04 ` [PATCH 2/2] test/py: Wait for guestmount worker to exit after running guestunmount Alper Nebi Yasak
2021-06-26 18:29   ` Simon Glass
2021-06-27 13:54     ` Alper Nebi Yasak
2021-07-06  0:58   ` Tom Rini [this message]
2021-06-26 18:29 ` [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests Simon Glass
2021-06-27 12:34   ` Alper Nebi Yasak
2021-07-06  0:58 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706005846.GG9516@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=sjg@chromium.org \
    --cc=swarren@nvidia.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.