qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-8.0 v2 1/1] modules: load modules from /var/run/qemu/<version


From: Siddhi Katage
Subject: [PATCH for-8.0 v2 1/1] modules: load modules from /var/run/qemu/<version> directory firstly
Date: Thu, 23 Mar 2023 14:24:03 +0000

From: Siddhi Katage <siddhi.katage@oracle.com>

An old running QEMU will try to load modules with new build-id first, this
will fail as expected, then QEMU will fallback to load the old modules that
matches its build-id from /var/run/qemu/<version> directory.
Make /var/run/qemu/<version> directory as first search path to load modules.

Fixes: bd83c861c0 ("modules: load modules from versioned /var/run dir")
Signed-off-by: Siddhi Katage <siddhi.katage@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
v2: Added reviewed-by tag
 
 util/module.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/util/module.c b/util/module.c
index 32e2631..b723d65 100644
--- a/util/module.c
+++ b/util/module.c
@@ -233,17 +233,17 @@ int module_load(const char *prefix, const char *name, 
Error **errp)
     g_hash_table_add(loaded_modules, module_name);
 
     search_dir = getenv("QEMU_MODULE_DIR");
-    if (search_dir != NULL) {
-        dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
-    }
-    dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);
-
 #ifdef CONFIG_MODULE_UPGRADES
     version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
                              G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
                              '_');
     dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
 #endif
+    if (search_dir != NULL) {
+        dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
+    }
+    dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);
+
     assert(n_dirs <= ARRAY_SIZE(dirs));
 
     /* end of resources managed by the out: label */
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]