From nobody Wed Nov 19 07:03:49 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615293909; cv=none; d=zohomail.com; s=zohoarc; b=dHrz95IpvSO6zgS4PNwzejiRcFErVwjRaEke1X7t7JnGKFKirJ2TBccQ9EmwkyBAvn6foDyGbIu2jC71Lc2KIulANTB4dpl5apvNFloQW6xlwA+hLZlJQfZO46zg23LzEMUuvZcX6i3B4vWudRAWllj+0yKFVjhwWbiIJmy+5NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615293909; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=VFKS7+/mtl2EOkx0uLn6TxabWibmzofrxB17dgl7oFw=; b=ZsSDvSFOLDdEZM81/BeGzgMYvl9yZyrRNEj1ddzozgEFtRdwwKnIAK6rQrNRtuiJywsZ+4YV3m1XCVL5C+RuErudUzCIX4FTk2a4Fyg2kMwqYMX8crNb2o6oRiRD0Vy458XIOENGjCMIMquc7TrOH3UKtwvHkXqldiIJR3sKlPQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1615293909881426.83009434589167; Tue, 9 Mar 2021 04:45:09 -0800 (PST) Received: from localhost ([::1]:57598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJbjY-0004PW-PS for importer@patchew.org; Tue, 09 Mar 2021 07:45:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJbJh-0004OE-BC for qemu-devel@nongnu.org; Tue, 09 Mar 2021 07:18:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lJbJe-00021i-UA for qemu-devel@nongnu.org; Tue, 09 Mar 2021 07:18:25 -0500 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-363-LBNCD76LNkSE8w9B52WB8A-1; Tue, 09 Mar 2021 07:18:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E65A81A281; Tue, 9 Mar 2021 12:18:17 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-169.ams2.redhat.com [10.36.114.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 790666F971; Tue, 9 Mar 2021 12:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615292301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VFKS7+/mtl2EOkx0uLn6TxabWibmzofrxB17dgl7oFw=; b=LEc75c3/E/HwNUBs0FbgvbLPuy6qLPGh8q+ODAdo3QBP4HWnfq4jgWBd8KS/wJiv3nP1Wi fPIvC3RKQow2LC23gejrcvH896dlpkKfsRjBc8V6pxjX3sQk4U66TOn7fBr7DirNtLy/Sa JeCr6foJCrUBNYmuqf77uUra0d9wAxQ= X-MC-Unique: LBNCD76LNkSE8w9B52WB8A-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH] storage-daemon: Call job_cancel_sync_all() on shutdown Date: Tue, 9 Mar 2021 13:18:14 +0100 Message-Id: <20210309121814.31078-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" bdrv_close_all() asserts that no jobs are running any more, so we need to cancel all jobs first to avoid failing the assertion. Fixes: b55a3c8860b763b62b2cc2f4a6f55379977bbde5 Reported-by: Nini Gu Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- storage-daemon/qemu-storage-daemon.c | 1 + tests/qemu-iotests/tests/qsd-jobs | 66 +++++++++++++++++++++++++++ tests/qemu-iotests/tests/qsd-jobs.out | 22 +++++++++ 3 files changed, 89 insertions(+) create mode 100755 tests/qemu-iotests/tests/qsd-jobs create mode 100644 tests/qemu-iotests/tests/qsd-jobs.out diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 23756fc8e5..a39a22386a 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -368,6 +368,7 @@ int main(int argc, char *argv[]) =20 blk_exp_close_all(); bdrv_drain_all_begin(); + job_cancel_sync_all(); bdrv_close_all(); =20 monitor_cleanup(); diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/q= sd-jobs new file mode 100755 index 0000000000..1a1c534fac --- /dev/null +++ b/tests/qemu-iotests/tests/qsd-jobs @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# group: rw auto quick qsd +# +# Job tests related specifically to qemu-storage-daemon +# +# Copyright (C) 2021 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D"$(basename $0)" +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +cd .. +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto generic + +size=3D128M + +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size +_make_test_img -b "$TEST_IMG.base" -F $IMGFMT + +echo +echo "=3D=3D=3D Job still present at shutdown =3D=3D=3D" +echo + +# Just make sure that this doesn't crash +$QSD --chardev stdio,id=3Dstdio --monitor chardev=3Dstdio \ + --blockdev node-name=3Dfile0,driver=3Dfile,filename=3D"$TEST_IMG" \ + --blockdev node-name=3Dfmt0,driver=3Dqcow2,file=3Dfile0 <