From nobody Thu Nov 13 21:55:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1583314849; cv=none; d=zohomail.com; s=zohoarc; b=nvXLCB3CIE72pk/oVTJAHyluFlMx/9ipVc4JCdS+XJ55pTuKf1qlHs77ZSqxrLzAQJIlZEOXf+qbFxIMonN7CzQTPDRF1lLytyFtG0Yn2tflTIqWE/TWjukqp2IkJQG6saSLUdF1zkS9uG5Haoi3P3Zt8i4o4w9TswU+J8SGePs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583314849; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y6D01OPoecOf0syTFTu6PjrIuh1MMg6tMnBrSaS9tRU=; b=GmClnMA45VPYHH+bPrRAJBJbjnb5BJKvP+lJL8B64tWZzYlYK97wGcmsHn6aqf2JpZVV90LbWee7w90r8rc6SVHVP2nk89olGe4a3a7TDqibIxJ1qWKO4Nm3j2Jtlipgc/TNlclDH6BE4Nm44JLrkmYJmbPVig78wXHNzRM6IAI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583314849026711.2628457215285; Wed, 4 Mar 2020 01:40:49 -0800 (PST) Received: from localhost ([::1]:59684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9QWF-0008J8-Vh for importer@patchew.org; Wed, 04 Mar 2020 04:40:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33347) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9QVM-0007AN-Bn for qemu-devel@nongnu.org; Wed, 04 Mar 2020 04:39:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9QVL-0001Sz-6z for qemu-devel@nongnu.org; Wed, 04 Mar 2020 04:39:52 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:35321) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9QVL-0001SM-1Q for qemu-devel@nongnu.org; Wed, 04 Mar 2020 04:39:51 -0500 Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j9QVK-0007Rn-3G; Wed, 04 Mar 2020 09:39:50 +0000 From: Christian Ehrhardt To: qemu-devel@nongnu.org Subject: [PATCH] modules: load modules from versioned /var/run dir Date: Wed, 4 Mar 2020 10:39:46 +0100 Message-Id: <20200304093946.18682-1-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 91.189.89.112 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Christian Ehrhardt Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" On upgrades the old .so files usually are replaced. But on the other hand since a qemu process represents a guest instance it is usually kept around. That makes late addition of dynamic features e.g. 'hot-attach of a ceph disk' fail by trying to load a new version of e.f. block-rbd.so into an old still running qemu binary. This adds a fallback to also load modules from a versioned directory in the temporary /var/run path. That way qemu is providing a way for packaging to store modules of an upgraded qemu package as needed until the next reboo= t. An example how that can then be used in packaging can be seen in: https://git.launchpad.net/~paelzer/ubuntu/+source/qemu/log/?h=3Dbug-1847361= -miss-old-so-on-upgrade-UBUNTU Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1847361 Signed-off-by: Christian Ehrhardt --- util/module.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/module.c b/util/module.c index 236a7bb52a..d2446104be 100644 --- a/util/module.c +++ b/util/module.c @@ -19,6 +19,7 @@ #endif #include "qemu/queue.h" #include "qemu/module.h" +#include "qemu-version.h" =20 typedef struct ModuleEntry { @@ -170,6 +171,7 @@ bool module_load_one(const char *prefix, const char *li= b_name) #ifdef CONFIG_MODULES char *fname =3D NULL; char *exec_dir; + char *version_dir; const char *search_dir; char *dirs[4]; char *module_name; @@ -201,6 +203,11 @@ bool module_load_one(const char *prefix, const char *l= ib_name) dirs[n_dirs++] =3D g_strdup_printf("%s", CONFIG_QEMU_MODDIR); dirs[n_dirs++] =3D g_strdup_printf("%s/..", exec_dir ? : ""); dirs[n_dirs++] =3D g_strdup_printf("%s", exec_dir ? : ""); + version_dir =3D g_strcanon(g_strdup(QEMU_PKGVERSION), + G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~= ", + '_'); + dirs[n_dirs++] =3D g_strdup_printf("/var/run/qemu/%s", version_dir); + assert(n_dirs <=3D ARRAY_SIZE(dirs)); =20 g_free(exec_dir); --=20 2.25.1