public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Maxim Yu. Osipov" <mosipov@ilbers.de>,
	isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>,
	Cedric Hombourger <Cedric_Hombourger@mentor.com>
Subject: Re: [PATCH] wic-img: Fix bind mounting
Date: Thu, 6 Dec 2018 12:17:25 +0100	[thread overview]
Message-ID: <eebe93bc-524a-3ce6-f70b-4833f5e30327@siemens.com> (raw)
In-Reply-To: <f7a1d5af-772d-e185-b8c5-c7ca2d3742ac@ilbers.de>

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 <jan.kiszka@siemens.com>
>> ---
>>
>> 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

  reply	other threads:[~2018-12-06 11:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  8:13 Jan Kiszka
2018-12-06  9:44 ` Maxim Yu. Osipov
2018-12-06 11:17   ` Jan Kiszka [this message]
2018-12-07 11:18     ` Maxim Yu. Osipov
2018-12-07 11:33       ` Jan Kiszka
2018-12-07 13:48 ` Maxim Yu. Osipov

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=eebe93bc-524a-3ce6-f70b-4833f5e30327@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Cedric_Hombourger@mentor.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=mosipov@ilbers.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox