qemu-kvm/kvm-qga-skip-bind-mounts-in-fs-list.patch
Miroslav Rezanina 307deeb5ff * Mon Jan 06 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-8
- kvm-linux-headers-Update-to-Linux-v6.12-rc5.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa10-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa11-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa12-changes.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa13-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-ptff-Query-Time-Stamp-Event-QTSE-.patch [RHEL-50212]
- kvm-linux-headers-Update-to-Linux-6.13-rc1.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Concurrent-functions-facility-sup.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Vector-Enhancements-facility-3.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Miscellaneous-Instruction-Extensi.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Vector-Packed-Decimal-Enhancement.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Ineffective-nonconstrained-transa.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-Sequential-Instruction-Fetching-f.patch [RHEL-50212]
- kvm-s390x-cpumodel-correct-PLO-feature-wording.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-PLO-extension-facility.patch [RHEL-50212]
- kvm-s390x-cpumodel-gen17-model.patch [RHEL-50212]
- kvm-qga-skip-bind-mounts-in-fs-list.patch [RHEL-71940]
- kvm-vhost-fail-device-start-if-iotlb-update-fails.patch [RHEL-27832]
- kvm-hw-char-pl011-Use-correct-masks-for-IBRD-and-FBRD.patch [RHEL-67107]
- Resolves: RHEL-50212
  ([IBM 9.6 FEAT] KVM: CPU model for new IBM Z HW - qemu part)
- Resolves: RHEL-71940
  (qemu-ga cannot freeze filesystems with sentinelone)
- Resolves: RHEL-27832
  (The post-copy migration of RT-VM leads to race while accessing vhost-user device and hung/stalled target VM)
- Resolves: RHEL-67107
  ([aarch64] [rhel-9.6] Backport some important post 9.1 qemu fixes)
2025-01-06 02:19:14 -05:00

95 lines
3.3 KiB
Diff

From 5f23535420c40755a2da63915b3c5a1c3eb185bd Mon Sep 17 00:00:00 2001
From: Jean-Louis Dupond <jean-louis@dupond.be>
Date: Wed, 2 Oct 2024 12:06:35 +0200
Subject: [PATCH 17/19] qga: skip bind mounts in fs list
RH-Author: Konstantin Kostiuk <None>
RH-MergeRequest: 306: qga: skip bind mounts in fs list
RH-Jira: RHEL-71940
RH-Acked-by: yvugenfi <None>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [1/1] 02f3a54f06caec953351bfdd6b25b91986d822c9 (kkostiuk/redhat-centos-stream-src-qemu-kvm)
The filesystem list in build_fs_mount_list should skip bind mounts.
This because we end up in locking situations when doing fsFreeze. Like
mentioned in [1] and [2].
Next to that, the build_fs_mount_list call did a fallback via
build_fs_mount_list_from_mtab if mountinfo did not exist.
There it skipped bind mounts, but this is broken for newer OS.
This as mounts does not return the path of the bind mount but the
underlying dev/partition, so S_ISDIR will never return true in
dev_major_minor call.
This patch simply checks the existing devmajor:devminor tuple in the
mounts, and if it already exists, this means we have the same devices
mounted again, a bind mount. So skip this.
Same approach is used in open-vm-tools [3].
[1]: https://gitlab.com/qemu-project/qemu/-/issues/592
[2]: https://gitlab.com/qemu-project/qemu/-/issues/520
[3]: https://github.com/vmware/open-vm-tools/commit/d58847b497e212737007958c945af1df22a8ab58
Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/r/20241002100634.162499-2-jean-louis@dupond.be
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands-linux.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/qga/commands-linux.c b/qga/commands-linux.c
index 51d5e3d927..426b040ab8 100644
--- a/qga/commands-linux.c
+++ b/qga/commands-linux.c
@@ -59,6 +59,22 @@ static int dev_major_minor(const char *devpath,
return -1;
}
+/*
+ * Check if we already have the devmajor:devminor in the mounts
+ * If thats the case return true.
+ */
+static bool dev_exists(FsMountList *mounts, unsigned int devmajor, unsigned int devminor)
+{
+ FsMount *mount;
+
+ QTAILQ_FOREACH(mount, mounts, next) {
+ if (mount->devmajor == devmajor && mount->devminor == devminor) {
+ return true;
+ }
+ }
+ return false;
+}
+
static bool build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp)
{
struct mntent *ment;
@@ -89,6 +105,10 @@ static bool build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp)
/* Skip bind mounts */
continue;
}
+ if (dev_exists(mounts, devmajor, devminor)) {
+ /* Skip already existing devices (bind mounts) */
+ continue;
+ }
mount = g_new0(FsMount, 1);
mount->dirname = g_strdup(ment->mnt_dir);
@@ -172,6 +192,11 @@ bool build_fs_mount_list(FsMountList *mounts, Error **errp)
}
}
+ if (dev_exists(mounts, devmajor, devminor)) {
+ /* Skip already existing devices (bind mounts) */
+ continue;
+ }
+
mount = g_new0(FsMount, 1);
mount->dirname = g_strdup(line + dir_s);
mount->devtype = g_strdup(dash + type_s);
--
2.39.3