From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6631790376260730880 X-Received: by 2002:a5d:50c6:: with SMTP id f6mr2710216wrt.10.1544095047813; Thu, 06 Dec 2018 03:17:27 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:9d28:: with SMTP id k40ls7001219wre.12.gmail; Thu, 06 Dec 2018 03:17:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/UNGQ2H0zDeXey6KFIxx+RQ1/mZLnC6IMyj9O4SPsYsYYeNnE2WqOyj9Le82TbrH4fDgyQC X-Received: by 2002:a5d:44d2:: with SMTP id z18mr3023998wrr.15.1544095047282; Thu, 06 Dec 2018 03:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544095047; cv=none; d=google.com; s=arc-20160816; b=QJdC15P6jBuc+HVuJWp2nB9JlFd63t0l+K5R7TC4JBZ5j/17UZqGrIpjTSWkM50nGi p9kTGAhP5fWWk0po8HJrmwowOl0j00s5XybLSEOFpXpl9LPn3UKz29I72mVzTlQmZRpg 3xzlPXDLSl0kM5a9aIW1clNzQrhj9tMxjQskge9htIQNHxRucFUwyxyFYTDHruCWFWVc Y/EbgfMIj00XZyW87wuyQj146U4i7meg4c2PMTmBuz1kUPOWS2AzR9rpdh7uC6bSvG+U R6VZA1URd7uvRjh2xZOOKRGwDvDc/IDWCOIs+MIVTgiTqbeZiLh6SzXOSEcSf1jVwI0V MfjA== 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:from:references:cc:to:subject; bh=OE6rbSb0dsAo7VLh3VezfoU+75lxVWfHJfPqonxKmhM=; b=k2ipvTC/q0dOSlI1Ufj4y1mdpXHOaEYNIxn91UBY3hvlFj7OF+WiUw/+JEZUniu4pU ALFtiL0OKKRDq0WXZOP6ZTTA+GN9OAlQdiEYL7Tg0WUACULUxURRngFTwOBGkqZzMpPx g8VYCEzgRYs8U0R/6TVk7KebamS7uGPHyoatx8G6CcKIVip9SQtorgJDy2ql+Umq81Je OWUuNu3xLwd92i9Ot8G1VDL7q0KebYG5ji5MKUk+ys6C0V53NJoG7e/HJ2zn5fwEE8sy BLn9fUTtDun/pukyhUeWbfR+0staSlRtV3jFldLBDPI3mUthDe1ywbggqOCsiG2wsZe8 cfWw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id f136si15852wmd.1.2018.12.06.03.17.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 03:17:27 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id wB6BHQQW022247 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Dec 2018 12:17:26 +0100 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id wB6BHQaZ011856; Thu, 6 Dec 2018 12:17:26 +0100 Subject: Re: [PATCH] wic-img: Fix bind mounting To: "Maxim Yu. Osipov" , isar-users Cc: Henning Schild , Cedric Hombourger References: From: Jan Kiszka Message-ID: Date: Thu, 6 Dec 2018 12:17:25 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: BEqqOxzrMED6 On 06.12.18 10:44, Maxim Yu. Osipov wrote: > Just to doublecheck: What is your patch queue for that? > Just updated jan/queue on github.com/siemens/isar. It's not the best ordering of patches, this fix should probably come earlier, but the top is what I tested successfully also in a stretch VM. Jan > 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 >> > > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux