From nobody Mon Feb 9 23:03:24 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1586260713; cv=none; d=zohomail.com; s=zohoarc; b=JnZ91Bco8ibruHKn8Y/r2UdgrTtBiaEh5rnU8MYyOI5Qqti/hr5n7Hr3w3M7KleGddL8hOF4CTTqKTiEuBqvy/h3ZIs512sjRhqv3u20LR9+XJAi12e/pLDRmiPkiBPwRjZZHeGkdiTl8bhqqkQ/T3o8gpmcwMlkevrnF/HpaUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586260713; 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=ahG+yoLOi0GeS35+yWESnIVYp9En8BS6OGOWEdgFedc=; b=DM6BjqdNzbhwmJruOoX+28zQXIY30pBUEJ25sfLTxezvTTrj4G/+u2+PthS9twBGl6S7l6m4MOtewJ2K7CItJkE+lE1VQWitWM8Dp1irbfvPAusPKoIpxW726Qn1mKddmioSqXDN/OqoSejxts3LzmBFhZIQc29rbqg9KlVlkjM= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586260713985278.1775337485507; Tue, 7 Apr 2020 04:58:33 -0700 (PDT) Received: from localhost ([::1]:45932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLmsC-0003os-Oe for importer@patchew.org; Tue, 07 Apr 2020 07:58:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLmrH-0002ge-F1 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 07:57:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLmrG-0007W7-He for qemu-devel@nongnu.org; Tue, 07 Apr 2020 07:57:35 -0400 Received: from proxmox-new.maurer-it.com ([212.186.127.180]:25799) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jLmrE-0007SF-68; Tue, 07 Apr 2020 07:57:32 -0400 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5FC1645944; Tue, 7 Apr 2020 13:57:22 +0200 (CEST) From: Stefan Reiter To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [PATCH for-5.0 v5 2/3] replication: assert we own context before job_cancel_sync Date: Tue, 7 Apr 2020 13:56:50 +0200 Message-Id: <20200407115651.69472-3-s.reiter@proxmox.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407115651.69472-1-s.reiter@proxmox.com> References: <20200407115651.69472-1-s.reiter@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.186.127.180 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: kwolf@redhat.com, vsementsov@virtuozzo.com, t.lamprecht@proxmox.com, slp@redhat.com, mreitz@redhat.com, stefanha@redhat.com, jsnow@redhat.com, dietmar@proxmox.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" job_cancel_sync requires the job's lock to be held, all other callers already do this (replication_stop, drive_backup_abort, blockdev_backup_abort, job_cancel_sync_all, cancel_common). In this case we're in a BlockDriver handler, so we already have a lock, just assert that it is the same as the one used for the commit_job. Signed-off-by: Stefan Reiter --- block/replication.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/replication.c b/block/replication.c index 413d95407d..da013c2041 100644 --- a/block/replication.c +++ b/block/replication.c @@ -144,12 +144,15 @@ fail: static void replication_close(BlockDriverState *bs) { BDRVReplicationState *s =3D bs->opaque; + Job *commit_job; =20 if (s->stage =3D=3D BLOCK_REPLICATION_RUNNING) { replication_stop(s->rs, false, NULL); } if (s->stage =3D=3D BLOCK_REPLICATION_FAILOVER) { - job_cancel_sync(&s->commit_job->job); + commit_job =3D &s->commit_job->job; + assert(commit_job->aio_context =3D=3D qemu_get_current_aio_context= ()); + job_cancel_sync(commit_job); } =20 if (s->mode =3D=3D REPLICATION_MODE_SECONDARY) { --=20 2.26.0