From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6631790376260730880 X-Received: by 2002:a7b:ce08:: with SMTP id m8mr279498wmc.22.1544190494437; Fri, 07 Dec 2018 05:48:14 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:3581:: with SMTP id c123ls352148wma.9.gmail; Fri, 07 Dec 2018 05:48:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/UWPx/44FuxDtptmsRm6RNwL3sflSAqoZLikNU9/u2wFODbdJ+ujxOUsf0ykd97ikOb5bKo X-Received: by 2002:a1c:bd1:: with SMTP id 200mr272733wml.25.1544190494034; Fri, 07 Dec 2018 05:48:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544190494; cv=none; d=google.com; s=arc-20160816; b=XKLr5r+cD6Y6vCbdkW0HQwN2XGhagMl6lT2gxJB0cvjDMoVYBHTKnlO9Qk55ZEGiWZ rEm0lzYAYF5Ts9yquFr06P6T/s0cCfqJwGU3I19q0skWiFtLCEhP/+lP7gjeP1E7QkI5 iF6P2eqvFCgyXR0tM2w7IVJE9DrT00WnsrL9PI8tQFEUG1bEkrOQR3SneZEWuMiPKzSG qy6a1sXUk4wehh4BT1IfuUhdtQgLm5ZBQ73Ve0qjWFX9SQzED0zm/ieSWoMA8k2pR29C 6D5RgdJNKS1/S6p537UX7FeRJ/ZGvxnTPjC5hi5Hknzhjqhd1Nz2mT32r/k9hXig6BJI ZJHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject; bh=ZePnB3hfnq6xxP583wklGVAf7MZZeEltE97ActG03Lk=; b=ZcAp5x6KNGH7KmwT8qy8WsPpDEufNn0eU98xeMcnrQZMvywbpMKwEAuMJVvv2fHfiT 05jT9UeW+IQ+iGQBNMS2YYLJ9ZAL54CQvtJkpQCZSAeFsGILBeJTfi4aWnLJMUwt4p8w b5f0RGMjfYLUIcUo2VSjlW8qt3M0P81fgeWMhqE3y4Ut3SX219+6cM1tQEi9UelElEDq UkuTklewDEtgtQZ9LeHjS/EQQQzAyVSPlx3D4Mo4rvghyuOx4Icp1dIPPDCWKWtQAjhq 6zeWw62+FaRFuWVKjPiKuaBDBIrzEQqi9EiP73gYuM59RCM/9v9SEItPtybx58biwRXP vaKA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id d6si141119wro.4.2018.12.07.05.48.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 05:48:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from [192.168.50.180] (nat-ppp-217.71.235.199-satnet-spb.ru [217.71.235.199] (may be forged)) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id wB7DmBuE004610 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 7 Dec 2018 14:48:12 +0100 Subject: Re: [PATCH] wic-img: Fix bind mounting To: Jan Kiszka , isar-users Cc: Henning Schild , Cedric Hombourger References: From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: <469e4f70-e345-ce70-28c6-7c35127f6bae@ilbers.de> Date: Fri, 7 Dec 2018 16:48:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: UBxTCaLZmJ6R On 12/6/18 11:13 AM, Jan Kiszka wrote: > > This addresses two issues of the current code: > > - we must make the bind mount of STAGING_DIR private because it will > otherwise pick up bind mounts done underneath it in the various > rootfs used by parallel targets > > - locking was missing to make check and mount atomic, just like we do > inside buildchroot_do_mounts Appled to the 'next', Thanks, Maxim. > Signed-off-by: Jan Kiszka > --- > > My theory on what went wrong /wrt rbind-mounted /sys and /dev: As the > bind-mounting of STAGING_DIR of a wic target (qemu-amd64) eventually > started to contain shared(!) bind-mounts of parallel targets (qemu- > armhf, qemu-arm64), and all those stick to the end, isar_handler started > to umount their now also shared /dev and /sys mounts. And that > destroyed the host mounts. > > Lesson to be recalled: never paper over issues that were not yet fully > understood. They may point to sleeping problems that will only bite you > again later. > > meta/classes/wic-img.bbclass | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass > index 225463e..76602d8 100644 > --- a/meta/classes/wic-img.bbclass > +++ b/meta/classes/wic-img.bbclass > @@ -87,11 +87,14 @@ do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" > > do_wic_image() { > buildchroot_do_mounts > - for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do > - sudo mkdir -p ${BUILDCHROOT_DIR}/$dir > - mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1 \ > - || sudo mount --bind $dir ${BUILDCHROOT_DIR}/$dir > - done > + sudo flock ${MOUNT_LOCKFILE} -c ' \ > + for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do > + mkdir -p ${BUILDCHROOT_DIR}/$dir > + if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1; then > + mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$dir > + fi > + done > + ' > export FAKEROOTCMD=${FAKEROOTCMD} > export BUILDDIR=${BUILDDIR} > export MTOOLS_SKIP_CHECK=1 > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov