From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v6 5/6] Revert "rootfs: Unmount rootfs mounts if not needed"
Date: Mon, 23 Aug 2021 13:23:41 +0300 [thread overview]
Message-ID: <20210823102342.3674387-6-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 'buildchroot-host/1.0-r0/temp/run.rootfs_undo_mounts.65491' failed with exit code 32:
umount: buildchroot-host/1.0-r0/rootfs/sys/fs/cgroup: target is busy.
We should revert commit e438c8f62b9aacb2c9d5120e93f81637f091a83c until
the reason of this issue will be found and fixed.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/image.bbclass | 15 ++++++++
meta/classes/initramfs.bbclass | 2 --
meta/classes/rootfs.bbclass | 63 ++++------------------------------
3 files changed, 22 insertions(+), 58 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 12d1616..9f9b3f8 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -199,6 +199,21 @@ 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}/sys' && \
+ 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"
diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass
index e895afa..10a642b 100644
--- a/meta/classes/initramfs.bbclass
+++ b/meta/classes/initramfs.bbclass
@@ -38,7 +38,5 @@ do_generate_initramfs() {
rm -rf "${INITRAMFS_IMAGE_FILE}"
cp "${INITRAMFS_ROOTFS}/initrd.img" "${INITRAMFS_IMAGE_FILE}"
-
- rootfs_undo_mounts
}
addtask generate_initramfs after do_rootfs before do_build
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 6ce2cf9..f9151c5 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -26,23 +26,9 @@ export LANG = "C"
export LANGUAGE = "C"
export LC_ALL = "C"
-IMAGE_MOUNT_LOCKFILE = "${ROOTFSDIR}.lock"
-
rootfs_do_mounts[weight] = "3"
rootfs_do_mounts() {
sudo -s <<'EOSUDO'
- ( flock 9
- set -e
-
- count="1"
- if [ -f '${ROOTFSDIR}.mount' ]; then
- count=$(($(cat '${ROOTFSDIR}.mount') + 1))
- fi
- echo $count > '${ROOTFSDIR}.mount'
- if [ $count -gt 1 ]; then
- exit 0
- fi
-
mountpoint -q '${ROOTFSDIR}/dev' || \
mount --rbind /dev '${ROOTFSDIR}/dev'
mount --make-rslave '${ROOTFSDIR}/dev'
@@ -70,40 +56,6 @@ rootfs_do_mounts() {
mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt'
fi
- ) 9>'${IMAGE_MOUNT_LOCKFILE}'
-EOSUDO
-}
-
-rootfs_undo_mounts() {
- sudo -s <<'EOSUDO'
- ( flock 9
- set -e
-
- if [ -f '${ROOTFSDIR}.mount' ]; then
- count=$(($(cat '${ROOTFSDIR}.mount') - 1))
- echo $count > '${ROOTFSDIR}.mount'
- else
- echo "Could not find mount counter"
- exit 1
- fi
- if [ $count -gt 0 ]; then
- exit 0
- fi
- rm ${ROOTFSDIR}.mount
-
- mountpoint -q '${ROOTFSDIR}/base-apt' && \
- umount ${ROOTFSDIR}/base-apt && \
- rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
- mountpoint -q '${ROOTFSDIR}/isar-apt' && \
- umount ${ROOTFSDIR}/isar-apt && \
- rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt
- mountpoint -q '${ROOTFSDIR}/sys' && \
- umount -R ${ROOTFSDIR}/sys
- mountpoint -q '${ROOTFSDIR}/proc' && \
- umount -R ${ROOTFSDIR}/proc
- mountpoint -q '${ROOTFSDIR}/dev' && \
- umount -R ${ROOTFSDIR}/dev
- ) 9>'${IMAGE_MOUNT_LOCKFILE}'
EOSUDO
}
@@ -207,7 +159,7 @@ python do_rootfs_install() {
# Mount after configure commands, so that they have time to copy
# 'isar-apt' (sdkchroot):
- cmds = ['rootfs_prepare'] + configure_cmds + ['rootfs_do_mounts'] + install_cmds + ['rootfs_undo_mounts']
+ cmds = ['rootfs_prepare'] + configure_cmds + ['rootfs_do_mounts'] + install_cmds
# NOTE: The weights specify how long each task takes in seconds and are used
# by the MultiStageProgressReporter to render a progress bar for this task.
@@ -289,13 +241,12 @@ python do_rootfs_postprocess() {
progress_reporter.update(0)
cmds = d.getVar("ROOTFS_POSTPROCESS_COMMAND")
- if cmds is not None and cmds.strip():
- cmds = cmds.split()
- for i, cmd in enumerate(cmds):
- bb.build.exec_func(cmd, d)
- progress_reporter.update(int(i / len(cmds) * 100))
-
- bb.build.exec_func('rootfs_undo_mounts', d)
+ if cmds is None or not cmds.strip():
+ return
+ cmds = cmds.split()
+ for i, cmd in enumerate(cmds):
+ bb.build.exec_func(cmd, d)
+ progress_reporter.update(int(i / len(cmds) * 100))
}
addtask rootfs_postprocess before do_rootfs
--
2.25.1
next prev 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 ` Anton Mikanovich [this message]
2021-08-23 10:23 ` [PATCH v6 6/6] Revert "buildchroot: Unmount buildchroot mounts if not needed" Anton Mikanovich
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-6-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