From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6631790376260730880 X-Received: by 2002:a1c:6708:: with SMTP id b8mr3046280wmc.5.1544089449456; Thu, 06 Dec 2018 01:44:09 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:3a8a:: with SMTP id h132-v6ls4322679wma.7.canary-gmail; Thu, 06 Dec 2018 01:44:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/VWIaI3iqETNJUiuKuxtP56J/SsWimxJW5h/w4iYBY37jSbR1a4hx3SY/a2Pvxp+DK3B4Bp X-Received: by 2002:a1c:2088:: with SMTP id g130mr2756904wmg.6.1544089449009; Thu, 06 Dec 2018 01:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544089448; cv=none; d=google.com; s=arc-20160816; b=bn4Y7HUwMfwovZxL8QBAd0UhP8L7oNgaskssr1UmFvnVq1gFmTkdGj0AMaZNLwaTgV cCDaL0KQFrAThdna02KCKktphxODzDO1ytsNG/EG9/5ZPfCaISc9XDunAsWk/u9U46Ph j7CWgUpvCVO9JLkOijLZax4d0lgxVTPmvzrMVd4XTtFQZ63dTpaHpwCegNNyI5+Oe1aa LGLuA3ndA52j64OdNMn6lWhJJ+Ajh4LBaNBLcAlDCfevdrXS3meqDDl0xd5l1E3m0Yd5 uAxYRv5RYnVt7KVsLOh9Z9DyRdbXQV9Xy/i1OntQtdCd/tKcj+pYGG5X10kjlfN+pgdv osOQ== 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=jHF/aLUQy8f3EYoDDtt/tSgbVzE61yRTGlTqSK0U4y4=; b=P+ehH2dLIncp+93A93d5CGqIx4Fx0EQyZRgDZ+ORKALVOlAsk5qtlZhbfvX5DpW0NX HoxYyBYD7Xs+O3aV7GIqvBg47RsG4Ai7XhJ7FTXLlb+PjFM7xoe+Le2CT30MKydmK+dm ll6HpI2KCJhx6GJvp7n9PITCOLMdqHVSJ2GVykaMTiouNHjotJHebcVSLOnILF3hTxrW X7JUmQGEoqtQ5c90B08HjGFTua1An6DCKGNnpJBHKkzn9Npc/7YK2cugDmivKSh0J1VW W+XwXwm/06RMZhrK6T9uwTcDlUeAEOJpQ+2wM0DcM52gxRg4/osRXIwf/eWFu91o6XhB SDKA== 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 x13si494830wrn.3.2018.12.06.01.44.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 01:44:08 -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 wB69i50m032076 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 6 Dec 2018 10:44:07 +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: Date: Thu, 6 Dec 2018 12:44:00 +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: zrfXrFSbYLfd Just to doublecheck: What is your patch queue for that? 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 > > 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