From nobody Tue Nov 26 13:43:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574169333; cv=none; d=zoho.com; s=zohoarc; b=MiLLpx8iQ1XqjY/aBItNox7arXnfGmRTZ9133rp/Ssj9WdVaaSK8SAW93k4FOeDMGuUHsFvomGjZJ1RERCF6gL9og5j5z/YG9yMKwaCgg/eeSQIISljuDrIKWDpsB5IFaS2wKc0ICzpKydv5ldLm0HI/HmNhKbl0tKmLdn9lUv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574169333; h=Content-Type:Content-Transfer-Encoding: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=lXwnNQcprwvg3ypvZ9dBywdOXxzPs1GnLAc9vJjQ/bk=; b=nuARoHQVZsshTykm2Q0wOfLxtSPM0ML7PvyzjK/uFZgXQv+z7tnZG0+u7lfaKYhAY1gQNgVlCI4BD8snpNtumN3vC1jDCW5GEYmM8ZghG/BAamkyjl2qOonxPAyG3Y9mJgRguMsmMXyeAokgX4RgGhMrZq4h2uUZggJA6D4Xr08= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1574169333537954.0131270482366; Tue, 19 Nov 2019 05:15:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-fWPtGbR1PtCE7gjOP5yu_A-1; Tue, 19 Nov 2019 08:15:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6B1818B9FD0; Tue, 19 Nov 2019 13:15:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 922F9627DE; Tue, 19 Nov 2019 13:15:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 318564BB65; Tue, 19 Nov 2019 13:15:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJDFKXx025191 for ; Tue, 19 Nov 2019 08:15:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA47E5E247; Tue, 19 Nov 2019 13:15:20 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45BD65DF2B for ; Tue, 19 Nov 2019 13:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574169332; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lXwnNQcprwvg3ypvZ9dBywdOXxzPs1GnLAc9vJjQ/bk=; b=bAAOkDyYtscMkybqSpCltlUrjzeF2pg4VsiyJehsW25AU9AOi28BUyNHEvcC3Tx4fr5FcW JNoNQZPI1SOxQyvP4K8SauuERBLwiyCOozqBC9vwkxh2M1CdzgU92zW7rplQGcfPhMFbAF BcrEWL1mub3kSoM0sigdZ0R2324hJdc= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 14:15:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/2] qemuProcessStop: Remove image metadata for running mirror jobs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: fWPtGbR1PtCE7gjOP5yu_A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If user starts a blockcommit without --pivot or a blockcopy also without --pivot then we modify access for qemu on both images and leave it like that until pivot is executed. So far so good. Problem is, if user instead of issuing pivot calls destroy on the domain or if qemu dies whilst executing the block job. In this case we don't ever clear the access we granted at the beginning. To fix this, we need to mimic what block job code does for aborting a block job -> remove image metadata from disk->mirror and disk->src chains. https://bugzilla.redhat.com/show_bug.cgi?id=3D1741456#c19 Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- Diff to v2: - updated commit message - do more remove - for disk->src chain too - put a comment about the importance of code placement src/qemu/qemu_process.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 209d07cfe8..b9dd433f54 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7615,6 +7615,18 @@ void qemuProcessStop(virQEMUDriverPtr driver, for (i =3D 0; i < vm->def->niothreadids; i++) vm->def->iothreadids[i]->thread_id =3D 0; =20 + /* Do this explicitly after vm->pid is reset so that security drivers = don't + * try to enter the domain's namespace which is non-existent by now as= qemu + * is no longer running. */ + for (i =3D 0; i < def->ndisks; i++) { + virDomainDiskDefPtr disk =3D def->disks[i]; + + if (disk->mirror) + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirr= or); + + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src); + } + /* clear all private data entries which are no longer needed */ qemuDomainObjPrivateDataClear(priv); =20 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list