From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7010687509260664832 X-Received: by 2002:a1c:a942:: with SMTP id s63mr11182963wme.45.1632324227967; Wed, 22 Sep 2021 08:23:47 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:2012:: with SMTP id g18ls3617149wmg.1.canary-gmail; Wed, 22 Sep 2021 08:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxNhEdoW0pFYSt/BweTbxv0YYZuIEu8S0yHSe2cTnUpwkbSL5jbzfCQaBXGOTy0DTF0nvb X-Received: by 2002:a1c:a512:: with SMTP id o18mr11133022wme.162.1632324227047; Wed, 22 Sep 2021 08:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632324227; cv=none; d=google.com; s=arc-20160816; b=hIlNVTFlrsE3u6PJfHCnCAMuPLZasr/pMf4QoJZ5onFjspUdxxNBI4AyVcy3dGG+dn wWVc0s4nqDsExhc5dsVgkpEZs7OD28HTG4B7NjBMDn6d1dyD90mL5nan/jBwOj23oIuS U8K3BLod6kV6LMPmK5bM26bMzc0RGAzE7VuZ1uiPkx9kOFs67QAR9xgU5yLyqp3cDbF2 d14ip+f0F49hwv7eri+rPTf+1/VNVJrXfd86zOrsk/S0x6f03tI1ZxtzHfDNbWGT42Se xdDB+EfMc7IOjDDfpBglQ1dW/nAYFM9EszMky+U+JtWErfBP187f4kf8E8nCrkk2xH2r GPtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=hAP9MZETCTQiVZeOvJR6xXJebGo+U60IU+tNzMmSdLI=; b=PBSebvTB3YQkUMpA4mHu9JZEpSbCdfp0BHgVy5qZALHaTzWD9zGtprhMYioXbgGtIo OsyvoMiaqQPqANbBry1ZUmlePC8L9a0/lHs8W1CJdp6vmERgeCPLs7LlFqeeuiiVJP9H Z4Be25ja7KmmnOcfykuqPPL7ilBz+bcU+4wJpODPoZdVjrpmM6vQbDNTBViQczclow9B x21fqt8iKGPR+YjVs+Oo+el94/4L2E/N15mhrTOhXRP3nFhP+A5Jt5OObegJlIigfpWj H2VCpb/RxJ0+AG5b1tXuG+heY0r2w+oTx8vBGiLnZris7e6YRarj93l60v3f4aCvVwmv zBfw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id f5si150083wrm.5.2021.09.22.08.23.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Sep 2021 08:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id 18MFNkv1001887 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 Sep 2021 17:23:46 +0200 Received: from md1za8fc.ad001.siemens.net ([167.87.35.234]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 18MFNkmD012150; Wed, 22 Sep 2021 17:23:46 +0200 Date: Wed, 22 Sep 2021 17:23:45 +0200 From: Henning Schild To: Felix Moessbauer Cc: , Subject: Re: [PATCH 4/4] split rootfs finalization and unmounting into two tasks Message-ID: <20210922172345.62839267@md1za8fc.ad001.siemens.net> In-Reply-To: <20210922092754.3649703-5-felix.moessbauer@siemens.com> References: <20210922092754.3649703-1-felix.moessbauer@siemens.com> <20210922092754.3649703-5-felix.moessbauer@siemens.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: K9jSrxM4AzFn That split is nice. But i would try and run it always after in a catch block, not in another task. That way it will become more robust while not having to touch the task-chain ... which is not nice for layers that hook in "low". I would not hold this one back for a series of "improved mounting" ... divide and conquer! If it fixes an issue it is valid, only if you have the time to do a full "mount rework" i would hold it back. Henning Am Wed, 22 Sep 2021 11:27:54 +0200 schrieb Felix Moessbauer : > This patch separates the unmounting logic from do_rootfs_finalize > to inject tasks in between. By that, the do_wic_image tasks can > use the mount-points and finally everything is unmounted correctly. > > Signed-off-by: Felix Moessbauer > --- > meta/classes/image.bbclass | 49 > +++++++++++++++++++++++++----------- meta/classes/wic-img.bbclass | > 4 +-- 2 files changed, 36 insertions(+), 17 deletions(-) > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 1f39690..988f0d7 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -190,21 +190,6 @@ do_rootfs_finalize() { > find "${ROOTFSDIR}/usr/bin" \ > -maxdepth 1 -name 'qemu-*-static' -type f -delete > > - mountpoint -q '${ROOTFSDIR}/isar-apt' && \ > - umount -l ${ROOTFSDIR}/isar-apt > - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt > - > - mountpoint -q '${ROOTFSDIR}/base-apt' && \ > - umount -l ${ROOTFSDIR}/base-apt > - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt > - > - mountpoint -q '${ROOTFSDIR}/dev' && \ > - umount -l ${ROOTFSDIR}/dev > - mountpoint -q '${ROOTFSDIR}/proc' && \ > - umount -l ${ROOTFSDIR}/proc > - mountpoint -q '${ROOTFSDIR}/sys' && \ > - umount -l ${ROOTFSDIR}/sys > - > rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" > > rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list" > @@ -219,5 +204,39 @@ EOSUDO > } > addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess > > +do_rootfs_unmount() { > + sudo -s <<'EOSUDO' > + ret=0 > + if mountpoint -q '${ROOTFSDIR}/isar-apt'; then > + umount -vl ${ROOTFSDIR}/isar-apt || ret=1 > + fi > + if test -d ${ROOTFSDIR}/isar-apt; then > + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt > || ret=1 > + fi > + > + if mountpoint -q ${ROOTFSDIR}/base-apt; then > + umount -vl ${ROOTFSDIR}/base-apt || ret=1 > + fi > + if test -d ${ROOTFSDIR}/base-apt; then > + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt > || ret=1 > + fi > + > + if mountpoint -q ${ROOTFSDIR}/dev; then > + umount -vl ${ROOTFSDIR}/dev || ret=1 > + fi > + if mountpoint -q ${ROOTFSDIR}/proc; then > + umount -vl ${ROOTFSDIR}/proc || ret=1 > + fi > + if mountpoint -q '${ROOTFSDIR}/sys'; then > + umount -vl ${ROOTFSDIR}/sys || ret=1 > + fi > + > + if [$ret -ne 0]; then > + bbwarn "could not unmount all mountpoints" > + fi > +EOSUDO > +} > +addtask rootfs_unmount before do_build after do_rootfs_finalize > + > # Last so that the image type can overwrite tasks if needed > inherit ${IMAGE_TYPE} > diff --git a/meta/classes/wic-img.bbclass > b/meta/classes/wic-img.bbclass index 573537c..0f5932b 100644 > --- a/meta/classes/wic-img.bbclass > +++ b/meta/classes/wic-img.bbclass > @@ -142,12 +142,12 @@ python do_wic_image() { > bb.build.exec_func("wic_do_mounts", d) > try: > bb.build.exec_func("generate_wic_image", d) > - bb.build.exec_func("check_for_wic_warnings", d) > finally: > bb.build.exec_func("wic_undo_mounts", d) > bb.utils.unlockfile(lock) > + bb.build.exec_func("check_for_wic_warnings", d) > } > -addtask wic_image before do_image after do_image_tools > do_rootfs_finalize +addtask wic_image before do_image > do_rootfs_unmount after do_image_tools > wic_do_mounts() { > buildchroot_do_mounts