public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v6 6/6] Revert "buildchroot: Unmount buildchroot mounts if not needed"
Date: Mon, 23 Aug 2021 13:23:42 +0300	[thread overview]
Message-ID: <20210823102342.3674387-7-amikan@ilbers.de> (raw)
In-Reply-To: <20210823102342.3674387-1-amikan@ilbers.de>

Reference counter protected per-task resource unmounting can't yet be
used because some /dev and /sys mounts can stay still locked even after
task finish in CI environment on high jobs load.
This leads to the following error:

Execution of 'enable-fsck/1.0-r0/temp/run.buildchroot_undo_mounts.43890' failed with exit code 32:
umount: buildchroot-host/1.0-r0/rootfs/sys/fs/cgroup: target is busy.

We should revert commit 3360b7d9ff85172dc3d2275c35caec71149b35ef until
the reason of this issue will be found and fixed.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/buildchroot.bbclass              | 47 -------------------
 meta/classes/dpkg-base.bbclass                |  2 -
 meta/classes/ext4-img.bbclass                 |  2 -
 meta/classes/fit-img.bbclass                  |  2 -
 meta/classes/image-tools-extension.bbclass    |  2 -
 meta/classes/image.bbclass                    |  9 ----
 meta/classes/ubi-img.bbclass                  |  2 -
 meta/classes/ubifs-img.bbclass                |  2 -
 meta/classes/wic-img.bbclass                  |  1 -
 .../buildchroot/buildchroot.inc               |  8 ----
 10 files changed, 77 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index f77e4f0..e9eb9af 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -28,19 +28,8 @@ buildchroot_do_mounts() {
         ( flock 9
         set -e
 
-        count="1"
-        if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
-            count=$(($(cat '${BUILDCHROOT_DIR}.mount') + 1))
-        fi
-        echo $count > '${BUILDCHROOT_DIR}.mount'
-        if [ $count -gt 1 ]; then
-            exit 0
-        fi
-
-        mkdir -p '${BUILDCHROOT_DIR}/isar-apt'
         mountpoint -q '${BUILDCHROOT_DIR}/isar-apt' ||
             mount --bind '${REPO_ISAR_DIR}/${DISTRO}' '${BUILDCHROOT_DIR}/isar-apt'
-        mkdir -p '${BUILDCHROOT_DIR}/downloads'
         mountpoint -q '${BUILDCHROOT_DIR}/downloads' ||
             mount --bind '${DL_DIR}' '${BUILDCHROOT_DIR}/downloads'
         mountpoint -q '${BUILDCHROOT_DIR}/dev' ||
@@ -71,39 +60,3 @@ buildchroot_do_mounts() {
         ) 9>'${MOUNT_LOCKFILE}'
 EOSUDO
 }
-
-buildchroot_undo_mounts() {
-    sudo -s <<'EOSUDO'
-        ( flock 9
-        set -e
-
-        if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
-            count=$(($(cat '${BUILDCHROOT_DIR}.mount') - 1))
-            echo $count > '${BUILDCHROOT_DIR}.mount'
-        else
-            echo "Could not find mount counter"
-            exit 1
-        fi
-        if [ $count -gt 0 ]; then
-            exit 0
-        fi
-        rm ${BUILDCHROOT_DIR}.mount
-
-        mountpoint -q '${BUILDCHROOT_DIR}/base-apt' && \
-            umount ${BUILDCHROOT_DIR}/base-apt && \
-            rmdir --ignore-fail-on-non-empty ${BUILDCHROOT_DIR}/base-apt
-        mountpoint -q '${BUILDCHROOT_DIR}/sys' && \
-            umount -R ${BUILDCHROOT_DIR}/sys
-        mountpoint -q '${BUILDCHROOT_DIR}/proc' && \
-            umount -R ${BUILDCHROOT_DIR}/proc
-        mountpoint -q '${BUILDCHROOT_DIR}/dev' && \
-            umount -R ${BUILDCHROOT_DIR}/dev
-        mountpoint -q '${BUILDCHROOT_DIR}/downloads' && \
-            umount ${BUILDCHROOT_DIR}/downloads && \
-            rmdir --ignore-fail-on-non-empty ${BUILDCHROOT_DIR}/downloads
-        mountpoint -q '${BUILDCHROOT_DIR}/isar-apt' && \
-            umount ${BUILDCHROOT_DIR}/isar-apt && \
-            rmdir --ignore-fail-on-non-empty ${BUILDCHROOT_DIR}/isar-apt
-        ) 9>'${MOUNT_LOCKFILE}'
-EOSUDO
-}
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 7364a7f..aa529ca 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -169,8 +169,6 @@ dpkg_undo_mounts() {
         i=`expr $i + 1`
     done
     sudo rmdir ${BUILDROOT}
-
-    buildchroot_undo_mounts
 }
 
 # Placeholder for actual dpkg_runbuild() implementation
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 26e0137..334dc64 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -17,8 +17,6 @@ do_ext4_image() {
 
     sudo chroot ${BUILDCHROOT_DIR} /sbin/mke2fs ${MKE2FS_ARGS} \
                 -F -d '${PP_ROOTFS}' '${PP_DEPLOY}/${EXT4_IMAGE_FILE}'
-
-    image_undo_mounts
 }
 
 addtask ext4_image before do_image after do_image_tools
diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
index 98ed8eb..82b96d8 100644
--- a/meta/classes/fit-img.bbclass
+++ b/meta/classes/fit-img.bbclass
@@ -24,7 +24,5 @@ do_fit_image() {
     sudo chroot ${BUILDCHROOT_DIR} /usr/bin/mkimage ${MKIMAGE_ARGS} \
                 -f '${PP_WORK}/${FIT_IMAGE_SOURCE}' '${PP_DEPLOY}/${FIT_IMAGE_FILE}'
     sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${FIT_IMAGE_FILE}'
-
-    image_undo_mounts
 }
 addtask fit_image before do_image after do_image_tools do_transform_template
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index 9646a14..9f28800 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -40,7 +40,5 @@ do_install_imager_deps() {
         apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
             --allow-unauthenticated --allow-downgrades install \
             ${IMAGER_INSTALL}'
-
-    buildchroot_undo_mounts
 }
 addtask install_imager_deps before do_image_tools
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 9f9b3f8..ec93cab 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -62,15 +62,6 @@ image_do_mounts() {
     buildchroot_do_mounts
 }
 
-image_undo_mounts() {
-    buildchroot_undo_mounts
-    sudo flock ${MOUNT_LOCKFILE} -c ' \
-        umount "${BUILDROOT_DEPLOY}"
-        umount "${BUILDROOT_ROOTFS}"
-        umount "${BUILDROOT_WORK}"
-    '
-}
-
 ROOTFSDIR = "${IMAGE_ROOTFS}"
 ROOTFS_FEATURES += "clean-package-cache generate-manifest export-dpkg-status"
 ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
index 5ce7686..c69ac4d 100644
--- a/meta/classes/ubi-img.bbclass
+++ b/meta/classes/ubi-img.bbclass
@@ -27,7 +27,5 @@ do_ubi_image() {
     sudo chroot ${BUILDCHROOT_DIR} /usr/sbin/ubinize ${UBINIZE_ARGS} \
                 -o '${PP_DEPLOY}/${UBI_IMAGE_FILE}' '${PP_WORK}/${UBINIZE_CFG}'
     sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${UBI_IMAGE_FILE}'
-
-    image_undo_mounts
 }
 addtask ubi_image before do_image after do_image_tools do_transform_template
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
index ea06561..fcbfbbc 100644
--- a/meta/classes/ubifs-img.bbclass
+++ b/meta/classes/ubifs-img.bbclass
@@ -22,8 +22,6 @@ do_ubifs_image() {
     sudo chroot ${BUILDCHROOT_DIR} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
                 -r '${PP_ROOTFS}' '${PP_DEPLOY}/${UBIFS_IMAGE_FILE}'
     sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${UBIFS_IMAGE_FILE}'
-
-    image_undo_mounts
 }
 
 addtask ubifs_image before do_image after do_image_tools
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index f641312..170b83e 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -209,5 +209,4 @@ EOSUDO
         done
         ) 9>${MOUNT_LOCKFILE}
 EOSUDO
-    buildchroot_undo_mounts
 }
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc
index 0c1fb7f..5a2befb 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.inc
+++ b/meta/recipes-devtools/buildchroot/buildchroot.inc
@@ -49,14 +49,6 @@ rootfs_do_mounts_append() {
 EOSUDO
 }
 
-rootfs_undo_mounts_append() {
-    sudo -s <<'EOSUDO'
-    mountpoint -q '${BUILDCHROOT_DIR}/downloads' && \
-        umount ${BUILDCHROOT_DIR}/downloads && \
-        rmdir --ignore-fail-on-non-empty ${BUILDCHROOT_DIR}/downloads
-EOSUDO
-}
-
 ROOTFS_POSTPROCESS_COMMAND =+ "buildchroot_install_files"
 buildchroot_install_files() {
     sudo mkdir -p "${BUILDCHROOT_DIR}/home/builder"
-- 
2.25.1


  parent reply	other threads:[~2021-08-23 10:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 10:23 [PATCH v6 0/6] Restore downstream mounts compatibility Anton Mikanovich
2021-08-23 10:23 ` [PATCH v6 1/6] Revert "dpkg: Make mount buildroot reliable" Anton Mikanovich
2021-08-23 10:23 ` [PATCH v6 2/6] dpkg: Limit unmount loop Anton Mikanovich
2021-08-23 10:23 ` [PATCH v6 3/6] dpkg-base: Clean up unmounting in do_dpkg_build() Anton Mikanovich
2021-08-23 10:23 ` [PATCH v6 4/6] events: Do not warn on left mounts by default Anton Mikanovich
2021-08-23 10:23 ` [PATCH v6 5/6] Revert "rootfs: Unmount rootfs mounts if not needed" Anton Mikanovich
2021-08-23 10:23 ` Anton Mikanovich [this message]
2021-08-27 17:16 ` [PATCH v6 0/6] Restore downstream mounts compatibility Anton Mikanovich
2021-08-30  8:25   ` Jan Kiszka
2021-08-30 18:46 ` Anton Mikanovich
2021-09-08 15:48 ` Henning Schild
2021-09-09  8:13   ` Anton Mikanovich
2021-09-09  9:17     ` Henning Schild
2021-09-13 15:03       ` Anton Mikanovich

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=20210823102342.3674387-7-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /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