From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E19FC07E99 for ; Tue, 6 Jul 2021 00:59:02 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F8BB6194B for ; Tue, 6 Jul 2021 00:59:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F8BB6194B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 235D382BDD; Tue, 6 Jul 2021 02:58:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="jVlPWyJx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED03282BFF; Tue, 6 Jul 2021 02:58:52 +0200 (CEST) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B43EA82BEE for ; Tue, 6 Jul 2021 02:58:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf2b.google.com with SMTP id g15so6621703qvi.13 for ; Mon, 05 Jul 2021 17:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hwXeER0evxUr8giyVc0Ra/dvuEfUuMyBF/yeMLHgVuY=; b=jVlPWyJxXCncploMK2gu9GbcFNIWeEZXIlHp0isbHjKp1iB74YtRIAoNME17TNeZma W3h1Vd6qsrjFGIdqg+wE4h3/QDE0zaRRQ+1u5N85yH6IDHsi9V6oKINJC8PSjjNTMk3X aBmALgWyfAgKIlmXfdTJ21wxdht8yYbdFbSoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hwXeER0evxUr8giyVc0Ra/dvuEfUuMyBF/yeMLHgVuY=; b=MBZYp9QAueENpeFRFEwO6U2F1c60v2cJ0r9l4jtPR6TXaPe2exr1TBrRK9lCjH+rKp rCUP6HO1AI8eVX7Ki6T2veauIBN/2ZbHkGkCEJU5gBA5vzsUMdnsp08Ct72MK/7Ey4F8 2t6Djh1Jp9va9OzCV2Waw1DfR8yDqXrW0R0tInoTuTW8vDowXADYwtfHYCH9hKrkMcH/ fszeWLb60h0IwVM7gynyN8MpT8U42G9jWzNWo7dwgYudjqhbJ8KcQqTWYEZBZedHKXU/ k6YWtpV1mw4Yf5QjXX1YtXUZJIbSevb6+rvNmk5ie2iLUaksArCZ94P/VQi3272lGYJY hIqw== X-Gm-Message-State: AOAM530AD2Bkdk/OaViCHRERNkURIoSLATzXXcWcDh74fr3XgVU3ku1X cgY/8T6fhAY9GapCplqwt3OFrQ== X-Google-Smtp-Source: ABdhPJwhufKadRLBlJHmpTfSn5y4BsAPNb8hfOkZ1PGzRNg5nrXQ7e8+sTa54emGVQngIOiUehTa3w== X-Received: by 2002:a0c:ea88:: with SMTP id d8mr15834683qvp.1.1625533128622; Mon, 05 Jul 2021 17:58:48 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-5170-f33c-21eb-73eb.res6.spectrum.com. [2603:6081:7b01:cbda:5170:f33c:21eb:73eb]) by smtp.gmail.com with ESMTPSA id m22sm1841913qtk.82.2021.07.05.17.58.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Jul 2021 17:58:47 -0700 (PDT) Date: Mon, 5 Jul 2021 20:58:46 -0400 From: Tom Rini To: Alper Nebi Yasak Cc: u-boot@lists.denx.de, Simon Glass , Heinrich Schuchardt , Stephen Warren , Andy Shevchenko Subject: Re: [PATCH 2/2] test/py: Wait for guestmount worker to exit after running guestunmount Message-ID: <20210706005846.GG9516@bill-the-cat> References: <20210604190447.45342-1-alpernebiyasak@gmail.com> <20210604190447.45342-2-alpernebiyasak@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="o/TH/B9oCyWIXb3g" Content-Disposition: inline In-Reply-To: <20210604190447.45342-2-alpernebiyasak@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --o/TH/B9oCyWIXb3g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > When guestunmount(1)/fusermount(1) exits, guestmount may still be > running and cleaning up the mountpoint. The disk image will not be > fully finalized. >=20 > This means that scripts like the following have a nasty race conditio= n: >=20 > guestmount -a disk.img -i /mnt > # copy things into /mnt > guestunmount /mnt > # immediately try to use 'disk.img' ** UNSAFE ** >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Alper Nebi Yasak > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! --=20 Tom --o/TH/B9oCyWIXb3g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmDjqsUACgkQFHw5/5Y0 tyxFKQv+MXrPx2abUHNp1zcnrSRqE+wFnUiQfLQbJpQsj6wNvVg0cL9kNIN+60ZZ Ukjw2bntyY9CIV7m/dzOzgj9CodrUXdTlt7oBHS6iW5cVa0rsXethIMu4BhQ5uzU Lms07o05VXKnNvGYkri5/ADDLrzhgRWf5mTFnz5ta8cHfrKHr5ExyNWEc8BXW40G zRTyxnUdBrAX7avYpTdUv67GPiBw5dwgoJv0rlzMZUwqMQ56bvDBIVdKLPVG63Qs 3YxMkwVAXBDFWK1hT1UaVWZwj7OFC6WSIfgHc42m+DBNq+sRisjXT5UPLh8gbn+s mKh8BjF7Dqn97CFH1QNpdELODCLZP0FS4NlMm0uGn95dBMtlM7bhaS383bj4Gih/ kQfY53TGn2JfxPYL9Tnq54hyZFBiv25Ynan8tqp+/UaY6oecz33ndQewKv0WxyGe +6EAXqd4eRKWXxfVQpaoELM1N1eFk7T0RVeHQa0155920RCcn4vueKM8Ez4O9XAz yb1zuPfN =dO0Z -----END PGP SIGNATURE----- --o/TH/B9oCyWIXb3g--