From nobody Sun Nov 16 02:26:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762201927; cv=none; d=zohomail.com; s=zohoarc; b=jgvT8mIKt8OLaeg8xrSXAdzNTwzoDGIJImhy6lxMIUToXYy1a9xEhwUqJM2vLDoa8vGK+XNiWmcoIJjPKcQeEI+28VUfE/rybhmxMo3ykAqJhMPgGW3rxMQzHUWavUy7bhjIW4ixL3jjbr3KDmRQlwPBD/D4hfUTZIdsLlTPRsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762201927; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0AzqrP4Q2MbNGpljBETQ9h1CiGOVkyDv1lMoTk5T+co=; b=JCgLWEE/FbaEUrHCsU8NqPSW+y5GO1x8VIRKoVrgYx//t7P6s4DZt4GlVYfE3cscOXpm8QwyQlKFVnZxC5kjcXcaO9V3f0gmMLuLErX/hYxSgDmfrLjh8JplDXHrGOYvubQa/LVeBlaSB417tKmHvjvBO3zMNbOBfRLkJgLkUXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762201927099268.6950386133959; Mon, 3 Nov 2025 12:32:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1B7-0003yX-Qz; Mon, 03 Nov 2025 15:29:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1B5-0003tH-47 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 15:29:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1B1-0007k9-WD for qemu-devel@nongnu.org; Mon, 03 Nov 2025 15:29:22 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-9E_zEs8JM4CsLTDqU-ECZg-1; Mon, 03 Nov 2025 15:29:16 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4133A1865FDC; Mon, 3 Nov 2025 20:29:10 +0000 (UTC) Received: from green.redhat.com (unknown [10.2.16.131]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D680830001A8; Mon, 3 Nov 2025 20:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762201758; 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: in-reply-to:in-reply-to:references:references; bh=0AzqrP4Q2MbNGpljBETQ9h1CiGOVkyDv1lMoTk5T+co=; b=LaJ6r7DCgXYc3H9V7qk7zbOSGNL/GdGMa3xpIo0Z/H/oHKqr5KBBZBmB6Q3sW1BMki6a5p 8hXbwrqprRksueRNwK4B0nWdVk9EqNXLPWt1JM9N8mYWUZ2gk0S7CSXXvAKuzshB2MUZtT WgvHHSEktRFvdaxf25oR9vM15bn1Vfs= X-MC-Unique: 9E_zEs8JM4CsLTDqU-ECZg-1 X-Mimecast-MFC-AGG-ID: 9E_zEs8JM4CsLTDqU-ECZg_1762201755 From: Eric Blake To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, berrange@redhat.com, kwolf@redhat.com, Vladimir Sementsov-Ogievskiy , Hanna Reitz Subject: [PATCH 8/8] iotests: Add coverage of recent NBD qio deadlock fix Date: Mon, 3 Nov 2025 14:10:59 -0600 Message-ID: <20251103202849.3687643-18-eblake@redhat.com> In-Reply-To: <20251103202849.3687643-10-eblake@redhat.com> References: <20251103202849.3687643-10-eblake@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1762201929957154100 Content-Type: text/plain; charset="utf-8" Test that all images in a qcow2 chain using an NBD backing file can be served by the same process. Prior to the recent QIONetListener fixes, this test would demonstrate deadlock. The test borrows heavily from the original formula by "John Doe" in the gitlab bug, but uses a Unix socket rather than TCP to avoid port contention, and uses a full-blown QEMU rather than qemu-storage-daemon since both programs were impacted. [While preparing this patch by making the new test executable, I noticed vvfat.out does not need execute permissions] Fixes: https://gitlab.com/qemu-project/qemu/-/issues/3169 Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/nbd-in-qcow2-chain | 84 +++++++++++++++++++ .../qemu-iotests/tests/nbd-in-qcow2-chain.out | 56 +++++++++++++ tests/qemu-iotests/tests/vvfat.out | 0 3 files changed, 140 insertions(+) create mode 100755 tests/qemu-iotests/tests/nbd-in-qcow2-chain create mode 100644 tests/qemu-iotests/tests/nbd-in-qcow2-chain.out mode change 100755 =3D> 100644 tests/qemu-iotests/tests/vvfat.out diff --git a/tests/qemu-iotests/tests/nbd-in-qcow2-chain b/tests/qemu-iotes= ts/tests/nbd-in-qcow2-chain new file mode 100755 index 00000000000..b89f74d4552 --- /dev/null +++ b/tests/qemu-iotests/tests/nbd-in-qcow2-chain @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# group: rw quick +# +# Test of opening both server and client NBD in a qcow2 backing chain +# +# Copyright (C) Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +# creator +owner=3Deblake@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_qemu + _cleanup_test_img + rm -f "$SOCK_DIR/nbd" +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +cd .. +. ./common.rc +. ./common.filter +. ./common.qemu +. ./common.nbd + +_supported_fmt qcow2 # Hardcoded to qcow2 command line and QMP below +_supported_proto file + +size=3D100M + +echo +echo "=3D=3D=3D Preparing base image =3D=3D=3D" + +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size + +echo +echo "=3D=3D=3D Starting QEMU and exposing base image =3D=3D=3D" + +_launch_qemu -machine q35 +h1=3D$QEMU_HANDLE +_send_qemu_cmd $QEMU_HANDLE '{"execute": "qmp_capabilities"}' 'return' +_send_qemu_cmd $QEMU_HANDLE '{"execute": "blockdev-add", + "arguments": {"node-name":"base", "driver":"qcow2", + "file":{"driver":"file", "filename":"'"$TEST_IMG.base"'"}}}' 'return' +_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start", + "arguments": {"addr":{"type":"unix", + "data":{"path":"'"$SOCK_DIR/nbd"'"}}}}' 'return' +_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add", + "arguments": {"device":"base","name":"base"}}' 'return' + +echo +echo "=3D=3D=3D Creating wrapper image =3D=3D=3D" + +_make_test_img -F raw -b "nbd+unix:///base?socket=3D$SOCK_DIR/nbd" $size + +echo +echo "=3D=3D=3D Adding wrapper image =3D=3D=3D" + +_send_qemu_cmd $QEMU_HANDLE '{"execute": "blockdev-add", + "arguments": {"node-name":"wrap", "driver":"qcow2", + "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' 'return' +_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add", + "arguments": {"device":"wrap","name":"wrap"}}' 'return' + +echo +echo "=3D=3D=3D Checking NBD server =3D=3D=3D" + +$QEMU_NBD --list -k $SOCK_DIR/nbd + +echo +echo "=3D=3D=3D Cleaning up =3D=3D=3D" + +_send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' '' + +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/tests/nbd-in-qcow2-chain.out b/tests/qemu-i= otests/tests/nbd-in-qcow2-chain.out new file mode 100644 index 00000000000..5f1d31ae2e0 --- /dev/null +++ b/tests/qemu-iotests/tests/nbd-in-qcow2-chain.out @@ -0,0 +1,56 @@ +QA output created by nbd-in-qcow2-chain + +=3D=3D=3D Preparing base image =3D=3D=3D +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D104857600 + +=3D=3D=3D Starting QEMU and exposing base image =3D=3D=3D +{"execute": "qmp_capabilities"} +{"return": {}} +{"execute": "blockdev-add", + "arguments": {"node-name":"base", "driver":"IMGFMT", + "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT.base"}}} +{"return": {}} +{"execute":"nbd-server-start", + "arguments": {"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd"}}}} +{"return": {}} +{"execute":"nbd-server-add", + "arguments": {"device":"base","name":"base"}} +{"return": {}} + +=3D=3D=3D Creating wrapper image =3D=3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D104857600 backing_file= =3Dnbd+unix:///base?socket=3DSOCK_DIR/nbd backing_fmt=3Draw + +=3D=3D=3D Adding wrapper image =3D=3D=3D +{"execute": "blockdev-add", + "arguments": {"node-name":"wrap", "driver":"IMGFMT", + "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT"}}} +{"return": {}} +{"execute":"nbd-server-add", + "arguments": {"device":"wrap","name":"wrap"}} +{"return": {}} + +=3D=3D=3D Checking NBD server =3D=3D=3D +exports available: 2 + export: 'base' + size: 104857600 + flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) + min block: 1 + opt block: 4096 + max block: 33554432 + transaction size: 64-bit + available meta contexts: 1 + base:allocation + export: 'wrap' + size: 104857600 + flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) + min block: 1 + opt block: 4096 + max block: 33554432 + transaction size: 64-bit + available meta contexts: 1 + base:allocation + +=3D=3D=3D Cleaning up =3D=3D=3D +{"execute":"quit"} +*** done diff --git a/tests/qemu-iotests/tests/vvfat.out b/tests/qemu-iotests/tests/= vvfat.out old mode 100755 new mode 100644 --=20 2.51.1