From nobody Tue Nov 26 11:27:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1574154880; cv=none; d=zoho.com; s=zohoarc; b=iBRjBalXU5gzr0ynUZkhK/YKFWpr7i/fV7Q4SPaVmbNzqJNyrUIenw22w/HuJkqxyC4tmuBx8CxWqZEDiyeohAlae/4YHNTdLIeDmSUsYDx4CywfX1N7Cla/JVLLHQ1TSyZVnY/yIXR2t2G0FJ9jheMsRxqvfHkG4nwRa8cPsfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574154880; 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=kEVt83WBDQ0BTpK1InFGsMIUaJMaW5pe2zVrezIx4eE=; b=HG2FhXkviUo1hzsDnJEMwJDeX09Gi3roORn31pQfPHqDBKSWF9SpHgbTQCWGTZszLB7lhRkil1aUBRHCbhon/A4HxKAQ7CDg4I13s9UuS6ttmq/7NgpcKkvGEGWlGk4HwcKzCTegN1P1p/LKcLSzaNzhDL8Cd6McjmYLCaoq1Aw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1574154880233463.71684928283094; Tue, 19 Nov 2019 01:14:40 -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-388-Fo1oPewANuKIA9bL6DZ4kQ-1; Tue, 19 Nov 2019 04:14:37 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C224A802693; Tue, 19 Nov 2019 09:14:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80B4860251; Tue, 19 Nov 2019 09:14:29 +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 2B2EE18089CF; Tue, 19 Nov 2019 09:14:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJ9EIqo017776 for ; Tue, 19 Nov 2019 04:14:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B2ED4462; Tue, 19 Nov 2019 09:14:18 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AD731E9 for ; Tue, 19 Nov 2019 09:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574154878; 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=kEVt83WBDQ0BTpK1InFGsMIUaJMaW5pe2zVrezIx4eE=; b=ZXZOA1k3CjcmvTv4yiZNQrRtIKok1lAwDBOgRGQw5uvSNS9fE4TZtfzdYy29IzzDMm13KU 1e2b2Ou6ETdt0gO6st8+FfLkr/HIY+smpyZ6EvfZZ/xO6IFbZ+hM/iJa1p+/mL3wqbfg9A rv58c+BYEkkk/E3r7Y8rJ+HfMWiazvc= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 10:14:08 +0100 Message-Id: <2bba22d069193da44e55cd66432d704aaf9b0f90.1574154764.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Separate image metadata removal into a function 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.12 X-MC-Unique: Fo1oPewANuKIA9bL6DZ4kQ-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" There are four places where we remove image XATTRs and in all of them we have the same for() loop with the same body. Move it into a separate function because I'm about to introduce fifth place where the same needs to be done. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 25 ++++++++++++++++++++++ src/qemu/qemu_block.h | 6 ++++++ src/qemu/qemu_blockjob.c | 45 ++++------------------------------------ 3 files changed, 35 insertions(+), 41 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index b8f0208742..1140a33114 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -22,6 +22,7 @@ #include "qemu_command.h" #include "qemu_domain.h" #include "qemu_alias.h" +#include "qemu_security.h" =20 #include "viralloc.h" #include "virstring.h" @@ -2588,3 +2589,27 @@ qemuBlockStorageSourceCreateDetectSize(virHashTableP= tr blockNamedNodeData, =20 return 0; } + + +int +qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *diskTarget, + virStorageSourcePtr src) +{ + virStorageSourcePtr n; + int ret =3D 0; + + for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { + if (qemuSecurityMoveImageMetadata(driver, vm, n, NULL) < 0) { + VIR_WARN("Unable to remove disk metadata on " + "vm %s from %s (disk target %s)", + vm->def->name, + NULLSTR(n->path), + diskTarget); + ret =3D -1; + } + } + + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 5ddeeaf6e2..5854641027 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -197,3 +197,9 @@ int qemuBlockStorageSourceCreateDetectSize(virHashTablePtr blockNamedNodeData, virStorageSourcePtr src, virStorageSourcePtr templ); + +int +qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *diskTarget, + virStorageSourcePtr src); diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 5c294f8024..92e4d391c9 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -658,36 +658,18 @@ qemuBlockJobEventProcessLegacyCompleted(virQEMUDriver= Ptr driver, virObjectUnref(disk->src); disk->src =3D disk->mirror; } else { - virStorageSourcePtr n; - if (disk->mirror) { virDomainLockImageDetach(driver->lockManager, vm, disk->mirror= ); =20 /* Ideally, we would restore seclabels on the backing chain he= re * but we don't know if somebody else is not using parts of it. * Remove security driver metadata so that they are not leaked= . */ - for (n =3D disk->mirror; virStorageSourceIsBacking(n); n =3D n= ->backingStore) { - if (qemuSecurityMoveImageMetadata(driver, vm, n, NULL) < 0= ) { - VIR_WARN("Unable to remove disk metadata on " - "vm %s from %s (disk target %s)", - vm->def->name, - NULLSTR(disk->src->path), - disk->dst); - } - } + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirr= or); =20 virObjectUnref(disk->mirror); } =20 - for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backi= ngStore) { - if (qemuSecurityMoveImageMetadata(driver, vm, n, NULL) < 0) { - VIR_WARN("Unable to remove disk metadata on " - "vm %s from %s (disk target %s)", - vm->def->name, - NULLSTR(n->path), - disk->dst); - } - } + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src); } =20 /* Recompute the cached backing chain to match our @@ -754,22 +736,12 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr drive= r, case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_CANCELED: if (disk->mirror) { - virStorageSourcePtr n; - virDomainLockImageDetach(driver->lockManager, vm, disk->mirror= ); =20 /* Ideally, we would restore seclabels on the backing chain he= re * but we don't know if somebody else is not using parts of it. * Remove security driver metadata so that they are not leaked= . */ - for (n =3D disk->mirror; virStorageSourceIsBacking(n); n =3D n= ->backingStore) { - if (qemuSecurityMoveImageMetadata(driver, vm, n, NULL) < 0= ) { - VIR_WARN("Unable to remove disk metadata on " - "vm %s from %s (disk target %s)", - vm->def->name, - NULLSTR(disk->src->path), - disk->dst); - } - } + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirr= or); =20 virObjectUnref(disk->mirror); disk->mirror =3D NULL; @@ -1177,7 +1149,6 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDri= verPtr driver, qemuBlockJobDataPtr job) { virDomainDiskDefPtr disk =3D job->disk; - virStorageSourcePtr n; =20 VIR_DEBUG("active commit job '%s' on VM '%s' failed", job->name, vm->d= ef->name); =20 @@ -1187,15 +1158,7 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDr= iverPtr driver, /* Ideally, we would make the backing chain read only again (yes, SELi= nux * can do that using different labels). But that is not implemented ye= t and * not leaking security driver metadata is more important. */ - for (n =3D disk->mirror; virStorageSourceIsBacking(n); n =3D n->backin= gStore) { - if (qemuSecurityMoveImageMetadata(driver, vm, n, NULL) < 0) { - VIR_WARN("Unable to remove disk metadata on " - "vm %s from %s (disk target %s)", - vm->def->name, - NULLSTR(disk->src->path), - disk->dst); - } - } + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror); =20 virObjectUnref(disk->mirror); disk->mirror =3D NULL; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 11:27:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1574154870; cv=none; d=zoho.com; s=zohoarc; b=W/E9/XjfxPwzWJyKtLPDp5KYaWiJP6+XTHySRKMmDa+/khMYuxnkqiBBghKsdPafG0xL76ZRiOBYHaAR3uNfz9qwDgGyYOKdmgAmxHlaYhcXuIArqWcNZuOmr+cTmLg1Yd9GlM2lsb8izc8zzSnkXetfe69FITsQnq8MaFrDWlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574154870; 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=u1TfTgi/1HBE9CquI+8FzbkVr7PNNBlA4hQWMvwZp6Q=; b=Pvp90pIkebUomRLgEyxvrnyt0jLuie9UNzNok8Cc2YMc8L/+WDDNlGviebJkzZfmY/GTXOaFzjbdQZcTZGARSd90WerwlMoJ3XuIqXQm67vUvAPRIFXtq+43m5Yacufow9Pc4CqasiCgpnhxG96qEDbidQEIiVsj1LCAprIeTT8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1574154870900786.5465717721596; Tue, 19 Nov 2019 01:14:30 -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-419-ORUX84vsOqWQRu3Gbg3KUw-1; Tue, 19 Nov 2019 04:14:27 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B85C88024CD; Tue, 19 Nov 2019 09:14:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A2495E243; Tue, 19 Nov 2019 09:14:20 +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 2E19E18089C8; Tue, 19 Nov 2019 09:14:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJ9EIKM017784 for ; Tue, 19 Nov 2019 04:14:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id DB7731E9; Tue, 19 Nov 2019 09:14:18 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66B2E1B462 for ; Tue, 19 Nov 2019 09:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574154869; 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=u1TfTgi/1HBE9CquI+8FzbkVr7PNNBlA4hQWMvwZp6Q=; b=d3gjwgclAS7ED5hDGxtd6c8Wrl63x0ynZ6Aqx3flU6q56/NY5toSqgoQUS8ky2yHuE9Fzk ly8tl1QyfE/t3ATQox8EU4vleuS5eWKiNeX8BZBpCDYj6MpLh16mG/QemIISa1f9f/QVtH wo/3u4/5B37wdi337cV8Nh9ybqYh3fk= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 10:14:09 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemuProcessStop: Simulate blockjob --abort on destroy 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.14 X-MC-Unique: ORUX84vsOqWQRu3Gbg3KUw-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 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. In this case we don't ever clear the access we granted at the beginning. https://bugzilla.redhat.com/show_bug.cgi?id=3D1741456#c19 Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8cb12ac9a6..fa9167441e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7617,6 +7617,15 @@ void qemuProcessStop(virQEMUDriverPtr driver, for (i =3D 0; i < vm->def->niothreadids; i++) vm->def->iothreadids[i]->thread_id =3D 0; =20 + for (i =3D 0; i < def->ndisks; i++) { + virDomainDiskDefPtr disk =3D def->disks[i]; + + if (!disk->mirror) + continue; + + qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror); + } + /* 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 From nobody Tue Nov 26 11:27:51 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