* Sun Jan 05 2025 Jon Maloy <jmaloy@redhat.com> - 6.2.0-53.el8.3

- kvm-qga-skip-bind-mounts-in-fs-list.patch [RHEL-59214]
- Resolves: RHEL-59214
  (qemu-ga cannot freeze filesystems with sentinelone)
This commit is contained in:
Jon Maloy 2025-01-05 23:00:02 -05:00
parent 634bbe3b9b
commit dfa322d78e
2 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,94 @@
From 661c0fee958d993b5c8d4600998ba0fdbf43da11 Mon Sep 17 00:00:00 2001
From: Konstantin Kostiuk <kkostiuk@redhat.com>
Date: Wed, 18 Dec 2024 18:49:04 +0200
Subject: [PATCH] qga: skip bind mounts in fs list
RH-Author: Konstantin Kostiuk <None>
RH-MergeRequest: 423: qga: skip bind mounts in fs list
RH-Jira: RHEL-59214
RH-Acked-by: yvugenfi <None>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [1/1] 2ebf2a4dba0e2da9d077c116accd12dc7f3dbcd1
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-posix.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 75dbaab68e..dce0d1551f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -668,6 +668,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;
+}
+
/*
* Walk the mount table and build a list of local file systems
*/
@@ -701,6 +717,10 @@ static void 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);
@@ -780,6 +800,11 @@ static void build_fs_mount_list(FsMountList *mounts, Error **errp)
continue;
}
}
+
+ 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);
--
2.47.1

View File

@ -83,7 +83,7 @@ Obsoletes: %1-rhev <= %{epoch}:%{version}-%{release}
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
Version: 6.2.0
Release: 53%{?rcrel}%{?dist}.2
Release: 53%{?rcrel}%{?dist}.3
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
Epoch: 15
License: GPLv2 and GPLv2+ and CC-BY
@ -891,6 +891,8 @@ Patch364: kvm-block-move-bdrv_qiov_is_aligned-to-file-posix.patch
Patch365: kvm-block-use-the-request-length-for-iov-alignment.patch
# For RHEL-26197 - virtiofsd --help and manpage does not agree on --thread-pool-size default value
Patch366: kvm-Fix-thread-pool-size-default-value-in-the-man-page.patch
# For RHEL-59214 - qemu-ga cannot freeze filesystems with sentinelone
Patch367: kvm-qga-skip-bind-mounts-in-fs-list.patch
BuildRequires: wget
BuildRequires: rpm-build
@ -2060,6 +2062,11 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || :
%changelog
* Sun Jan 05 2025 Jon Maloy <jmaloy@redhat.com> - 6.2.0-53.el8.3
- kvm-qga-skip-bind-mounts-in-fs-list.patch [RHEL-59214]
- Resolves: RHEL-59214
(qemu-ga cannot freeze filesystems with sentinelone)
* Tue Oct 15 2024 Jon Maloy <jmaloy@redhat.com> - 6.2.0-53.el8.2
- kvm-Fix-thread-pool-size-default-value-in-the-man-page.patch [RHEL-26197]
- Resolves: RHEL-26197