From nobody Sun Oct 5 15:34:19 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=1613161121; cv=none; d=zohomail.com; s=zohoarc; b=TvxJ+ExSVCE0/HWXIazO7zHnKI/LWi8qZwbTY6JoXybqloRJalz7spLJel3I3fJ3ar78XBZuRqNgYc+ETUyIIzGc98ymrqeclSWZK/OfndkH14rdGhm/LNBKTiaoQSYf28Olh8W87kjHeGynShLyCBaO1JdbG8gpw2VDGTxXioI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161121; h=Content-Type: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=kSLklQL8x+Q9SXf0U3zJXRaUrG/FZM/PT3K4dcKAfYg=; b=TD5z66rDSJIyA/yzWvstoPNVPBIv8TeW3riSmDDrYDMUZ1ku/5dMhrbNTTEs+YNmhiQ+8TCPX4Y+rqPnFe7EJpIMzayF9rNvhv18i8TDOU5WKwc7YCOFwpF+G2O+lh+B3y3o13nIMTglotRinEvF6RmwUcg6bX2oimeKKD7YRUI= 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 1613161121327140.95660592107038; Fri, 12 Feb 2021 12:18:41 -0800 (PST) Received: from localhost ([::1]:45106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAeth-0005ye-1X for importer@patchew.org; Fri, 12 Feb 2021 15:18:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerd-00046X-LQ for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerb-0003pw-RK for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:29 -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-386-WW5pnnTWOjuva08xRSYAWA-1; Fri, 12 Feb 2021 15:16:23 -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 C39AC801982; Fri, 12 Feb 2021 20:16:22 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37435614EB; Fri, 12 Feb 2021 20:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160986; 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=kSLklQL8x+Q9SXf0U3zJXRaUrG/FZM/PT3K4dcKAfYg=; b=DIzBwbw3eQfl0y17cohRAR9f4+il/Nb3Kc0EaMMgFYjmGXAIpP/1VlHW44+6R5VDwhAvrv cD4l3XCCcmRuYJtLThgk5adLJgjlKEGP6zUaQ4ulOdl7fCtLTP5pzPSGFTddegZ4DAdVV4 5xw6CyAydMwc3gyjT2PWyhn+Csuoveg= X-MC-Unique: WW5pnnTWOjuva08xRSYAWA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 01/14] qemu-nbd: Use SOMAXCONN for socket listen() backlog Date: Fri, 12 Feb 2021 14:16:06 -0600 Message-Id: <20210212201619.1388255-2-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=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: Kevin Wolf , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "open list:Network Block Dev..." , qemu-stable@nongnu.org, "Richard W . M . Jones" , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Our default of a backlog of 1 connection is rather puny; it gets in the way when we are explicitly allowing multiple clients (such as qemu-nbd -e N [--shared], or nbd-server-start with its default "max-connections":0 for unlimited), but is even a problem when we stick to qemu-nbd's default of only 1 active client but use -t [--persistent] where a second client can start using the server once the first finishes. While the effects are less noticeable on TCP sockets (since the client can poll() to learn when the server is ready again), it is definitely observable on Unix sockets, where on Linux, a client will fail with EAGAIN and no recourse but to sleep an arbitrary amount of time before retrying if the server backlog is already full. Since QMP nbd-server-start is always persistent, it now always requests a backlog of SOMAXCONN; meanwhile, qemu-nbd will request SOMAXCONN if persistent, otherwise its backlog should be based on the expected number of clients. See https://bugzilla.redhat.com/1925045 for a demonstration of where our low backlog prevents libnbd from connecting as many parallel clients as it wants. Reported-by: Richard W.M. Jones Signed-off-by: Eric Blake CC: qemu-stable@nongnu.org Message-Id: <20210209152759.209074-2-eblake@redhat.com> Tested-by: Richard W.M. Jones Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Eric Blake --- blockdev-nbd.c | 7 ++++++- qemu-nbd.c | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/blockdev-nbd.c b/blockdev-nbd.c index d8443d235b73..b264620b98d8 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -134,7 +134,12 @@ void nbd_server_start(SocketAddress *addr, const char = *tls_creds, qio_net_listener_set_name(nbd_server->listener, "nbd-listener"); - if (qio_net_listener_open_sync(nbd_server->listener, addr, 1, errp) < = 0) { + /* + * Because this server is persistent, a backlog of SOMAXCONN is + * better than trying to size it to max_connections. + */ + if (qio_net_listener_open_sync(nbd_server->listener, addr, SOMAXCONN, + errp) < 0) { goto error; } diff --git a/qemu-nbd.c b/qemu-nbd.c index 608c63e82a25..1a340ea4858d 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -964,8 +964,16 @@ int main(int argc, char **argv) server =3D qio_net_listener_new(); if (socket_activation =3D=3D 0) { + int backlog; + + if (persistent) { + backlog =3D SOMAXCONN; + } else { + backlog =3D MIN(shared, SOMAXCONN); + } saddr =3D nbd_build_socket_address(sockpath, bindto, port); - if (qio_net_listener_open_sync(server, saddr, 1, &local_err) < 0) { + if (qio_net_listener_open_sync(server, saddr, backlog, + &local_err) < 0) { object_unref(OBJECT(server)); error_report_err(local_err); exit(EXIT_FAILURE); --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161297; cv=none; d=zohomail.com; s=zohoarc; b=E5D1Rxr7Zo/dPKtzL7TeyjPm8r75S+qkukjgmee5/IZ7MfJYdw5sYkRMNuXvCT0gCVRI3CLubSIYZsiXtL5bMe77QTW7rfhg/gbHZNrBWk/PevqrFvXKw9ESQb1CF8SyleidMZURjqONj3eA3y3XprDYDXeW7qHyIT733yPY/ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161297; h=Content-Type: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=w7KSEOkdVjlNJs/Mr1z2NbCT8l71Fw7ARyPGR8CPT9Y=; b=NQcMjbmjEiZ3MAF0r2UcAxM88uj3Zzx0uc2N5NrOzurC1/aAAJxbPgGYFyXWaLfWSbKB+DMQnjs2cVr7g4LUc1lFE/CXVaP7nSU+57LOhRfvudm+nwAcIuE8iUcsmZu9Hhn23UyZZtpohQwJSsXURsK0DO8Q11dAh8ZIWMnIU2I= 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 1613161297426632.2015335623009; Fri, 12 Feb 2021 12:21:37 -0800 (PST) Received: from localhost ([::1]:53958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAewS-0001Ds-Vi for importer@patchew.org; Fri, 12 Feb 2021 15:21:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerk-0004A0-2u for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAere-0003rh-A5 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:35 -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-268-gjcaCjeEPUmNeq-w5kql3w-1; Fri, 12 Feb 2021 15:16:27 -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 4B4F9107ACE3; Fri, 12 Feb 2021 20:16:23 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1C756E51F; Fri, 12 Feb 2021 20:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160989; 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=w7KSEOkdVjlNJs/Mr1z2NbCT8l71Fw7ARyPGR8CPT9Y=; b=P1iSvTWHqRL6ghhBQbBUhGh4GU4hz7FsgMGE1M2OH6KCOyLow2lz4gK4GFze/rrvxhCDD9 7uU7rzHxz0rCtYDRYmTpPy3NPCs3zi2U7wM9YMmHPtmjo1+qG31rSDInqVv2x7EmKtmvsA mWtgcEWBEEKX9wx4zD7TCAikq2TkhVc= X-MC-Unique: gjcaCjeEPUmNeq-w5kql3w-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 02/14] qemu-nbd: Permit --shared=0 for unlimited clients Date: Fri, 12 Feb 2021 14:16:07 -0600 Message-Id: <20210212201619.1388255-3-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=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: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "open list:Network Block Dev..." Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This gives us better feature parity with QMP nbd-server-start, where max-connections defaults to 0 for unlimited. Signed-off-by: Eric Blake Message-Id: <20210209152759.209074-3-eblake@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/tools/qemu-nbd.rst | 4 ++-- qemu-nbd.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst index fe41336dc550..ee862fa0bc02 100644 --- a/docs/tools/qemu-nbd.rst +++ b/docs/tools/qemu-nbd.rst @@ -136,8 +136,8 @@ driver options if ``--image-opts`` is specified. .. option:: -e, --shared=3DNUM Allow up to *NUM* clients to share the device (default - ``1``). Safe for readers, but for now, consistency is not - guaranteed between multiple writers. + ``1``), 0 for unlimited. Safe for readers, but for now, + consistency is not guaranteed between multiple writers. .. option:: -t, --persistent diff --git a/qemu-nbd.c b/qemu-nbd.c index 1a340ea4858d..b1b9430a8f54 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -328,7 +328,7 @@ static void *nbd_client_thread(void *arg) static int nbd_can_accept(void) { - return state =3D=3D RUNNING && nb_fds < shared; + return state =3D=3D RUNNING && (shared =3D=3D 0 || nb_fds < shared); } static void nbd_update_server_watch(void); @@ -707,7 +707,7 @@ int main(int argc, char **argv) break; case 'e': if (qemu_strtoi(optarg, NULL, 0, &shared) < 0 || - shared < 1) { + shared < 0) { error_report("Invalid shared device number '%s'", optarg); exit(EXIT_FAILURE); } @@ -966,7 +966,7 @@ int main(int argc, char **argv) if (socket_activation =3D=3D 0) { int backlog; - if (persistent) { + if (persistent || shared =3D=3D 0) { backlog =3D SOMAXCONN; } else { backlog =3D MIN(shared, SOMAXCONN); --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161459; cv=none; d=zohomail.com; s=zohoarc; b=BlATszDFuEUbw+FN4/OXrOGxLOCHtZpqphpl4dQJK2CUbrtvK0keZ2GCC0yGzc0Hy7kpmCOBxpE2JERzDRrKGMajMt0Wzb+7HOtAJnFDqc/AX6ULtHTBvqnzYHmZLSAarkUaavNEDh0Ftys56vxsDwSrrRc9wuvKoA3Q+lnUC5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161459; h=Content-Type: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=h+cJgGGFf8il1Kc+826gN14F0x58VbcTfDVuVp9d1jc=; b=Iz/UGiCdiMtPZP8ksPcVFqR8GuXs0nsTeUUIYWMs861IXdN8FzHN345GOEeH6wcOSItu2k8p5gSUGoGbllTS9Bl2U8WeTiETJDch5tbWBOi2ROZQsbu841GQQl5GN8J0RMxMBYAy0mk6lv/FIvYwEg45VD8YcgwIeID/YIGVt8A= 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 1613161459050966.38114143727; Fri, 12 Feb 2021 12:24:19 -0800 (PST) Received: from localhost ([::1]:34172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAez3-0004uw-Uj for importer@patchew.org; Fri, 12 Feb 2021 15:24:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerk-0004BN-KX for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:29770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerd-0003r8-CF for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:36 -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-188-pIsrYeh2Nb2AHL_2p7ey2A-1; Fri, 12 Feb 2021 15:16:26 -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 2462D1934100; Fri, 12 Feb 2021 20:16:24 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77BBE614EB; Fri, 12 Feb 2021 20:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160988; 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=h+cJgGGFf8il1Kc+826gN14F0x58VbcTfDVuVp9d1jc=; b=GARNxPGxAaNFZjk/AuENlzGWGTSNcbQDi4MgMGH7YPaXtin4uIZA9MRqkZnacEbsqIUcbQ +4f6I+08yXOJqirZ1hT+icMb95umzw7g5ur50gf21/nmwNVd+sgF8JNyUfcTdpvYO/AYAe jqziKtU4Ki4NLEOUa+MoBjU/TwsmcG0= X-MC-Unique: pIsrYeh2Nb2AHL_2p7ey2A-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 03/14] iotests/210: Fix reference output Date: Fri, 12 Feb 2021 14:16:08 -0600 Message-Id: <20210212201619.1388255-4-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" , Max Reitz 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" From: Max Reitz Commit 69b55e03f has changed an error message, adjust the reference output to account for it. Fixes: 69b55e03f7e65a36eb954d0b7d4698b258df2708 ("block: refactor bdrv_check_request: add errp") Signed-off-by: Max Reitz Message-Id: <20210209181923.497688-1-mreitz@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Eric Blake --- tests/qemu-iotests/210.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/210.out b/tests/qemu-iotests/210.out index dc1a3c9786ee..2e9fc596ebdf 100644 --- a/tests/qemu-iotests/210.out +++ b/tests/qemu-iotests/210.out @@ -182,7 +182,7 @@ Job failed: The requested file size is too large =3D=3D=3D Resize image with invalid sizes =3D=3D=3D {"execute": "block_resize", "arguments": {"node-name": "node1", "size": 92= 23372036854775296}} -{"error": {"class": "GenericError", "desc": "Required too big image size, = it must be not greater than 9223372035781033984"}} +{"error": {"class": "GenericError", "desc": "offset(9223372036854775296) e= xceeds maximum(9223372035781033984)"}} {"execute": "block_resize", "arguments": {"node-name": "node1", "size": 92= 23372036854775808}} {"error": {"class": "GenericError", "desc": "Invalid parameter type for 's= ize', expected: integer"}} {"execute": "block_resize", "arguments": {"node-name": "node1", "size": 18= 446744073709551104}} --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161143; cv=none; d=zohomail.com; s=zohoarc; b=Qiz3Dz/BG+ud9dNBeERwB2AzdrdnVR5YCwzHAyXcNiV8hfsf9gaYoe9zgnLJes76yXg5DB5xQ8boBV/2y92kurl3l2VF0QH4PRFktYf13Rir/NyYMKmgHxFyg767wl9jI2FLWCECuv94HNaGe4WhhUc4PL4ZhJ6w6mVn5dacbps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161143; h=Content-Type: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=bIFMhONtHFFJQrXdCykz8Xygs7fyXrTSwinNlTOE1Qo=; b=cozBGgtYCMOsAozibY/9Dv4QvHcRbbyGIYJjqa6qQPLPo+Od5FQg13EM1dc4uUSjBDwYh7hfs3tvlbXzU6EHArDLHj4xG4zv7BglgZV4EfIt2n1FVrR3T9a30H7bbYXyu9GC4A0p+TT23viXHUbDLGEK+WVJysLZUBuCxCKnUYE= 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 1613161143001370.23984242936103; Fri, 12 Feb 2021 12:19:03 -0800 (PST) Received: from localhost ([::1]:46386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAeu5-0006UA-Qc for importer@patchew.org; Fri, 12 Feb 2021 15:19:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerf-00048W-54 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerd-0003qB-1V for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:30 -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-6-C5uQ13jzPqaDrCqjxEyLug-1; Fri, 12 Feb 2021 15:16:25 -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 B3131801965; Fri, 12 Feb 2021 20:16:24 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5208F614EB; Fri, 12 Feb 2021 20:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160987; 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=bIFMhONtHFFJQrXdCykz8Xygs7fyXrTSwinNlTOE1Qo=; b=TlYswC5ld4FiatBmxkSBDMMA0Vrh7K9h3C4WS8u4ru4ZYML1TNS9mFZ253XP9/na9WagQG 8mFPgbIIF0JlYFlxpuyvKVm5WGlvGBwy4SDm0XPvxztUf1R3sZ2Ee0D6LL/3UcQQbYQy16 ZQKhmNcXC1Qzg8gee1AG9cQAz285Mmk= X-MC-Unique: C5uQ13jzPqaDrCqjxEyLug-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 04/14] io: error_prepend() in qio_channel_readv_full_all() causes segfault Date: Fri, 12 Feb 2021 14:16:09 -0600 Message-Id: <20210212201619.1388255-5-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=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: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Jagannathan Raman , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Jagannathan Raman Using error_prepend() in qio_channel_readv_full_all() causes a segfault as errp is not set when ret is 0. This results in the failure of iotest 83. Replacing with error_setg() fixes the problem. Additionally, removes a full stop at the end of error message Reported-by: Max Reitz Signed-off-by: Jagannathan Raman Fixes: bebab91ebdfc591f8793a9a17370df1bfbe8b2ca (io: add qio_channel_readv_full_all_eof & qio_channel_readv_full_all help= ers) Message-Id: Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Eric Blake --- io/channel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/io/channel.c b/io/channel.c index 4555021b6246..e8b019dc36e2 100644 --- a/io/channel.c +++ b/io/channel.c @@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc, int ret =3D qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, = errp); if (ret =3D=3D 0) { - error_prepend(errp, - "Unexpected end-of-file before all data were read."); + error_setg(errp, "Unexpected end-of-file before all data were read= "); return -1; } if (ret =3D=3D 1) { --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161629; cv=none; d=zohomail.com; s=zohoarc; b=CxuO1xEo82DafG4QqoAoH4meaGKOTSBEj4wUaQRCdNgWV7t1sEuY8GmJS+q4uHYEJlixO0Ge1mJVNK2OkLlPXkg8rnF8Pk3gExzIXabxziMtp1djOHcvXuqynQpIqTVhwd31XqksC2pf68zCr5aCFsm/uR0jy523CZrNiOWQdm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161629; h=Content-Type: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=dzo3lQNYriI3VlYsQNKoiRYoeY31ThbC7dAulCBY7k4=; b=VjAVXD2KobreVKzCdr0VsodPpN5MTgdU8wOW6JM+y75B+SvbY9rBNrUuHpMNuzTJxymMH/E6UGiuO9y3Nsypwg808sCWuUtzlb+cEF855DqdvB4G0InzeFcltyUrl5ROfI7N4Q60gDLOxShLHtExCpc2fMiYusbs0LxLzGwv38c= 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 1613161629328664.1921797949917; Fri, 12 Feb 2021 12:27:09 -0800 (PST) Received: from localhost ([::1]:41970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf1t-0008N0-6A for importer@patchew.org; Fri, 12 Feb 2021 15:27:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerm-0004FD-9D for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAeri-0003s6-51 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:37 -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-512-GhO37UVYN2WfEozXQ3KnKg-1; Fri, 12 Feb 2021 15:16:30 -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 772A9801994; Fri, 12 Feb 2021 20:16:29 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id E57437A8DD; Fri, 12 Feb 2021 20:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160992; 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=dzo3lQNYriI3VlYsQNKoiRYoeY31ThbC7dAulCBY7k4=; b=TPXmUpA0g0mDx8Mm3sZUjSqgqUpZB76anJpO/Nel0l3g1CExeAi0bMz4rAjpMIX58JQBE3 YD8MYflMKxYqL7lhmaYpHmBzRnvudkxzejQqKs5yZ14wX1XWsh3OAeXrmvExX0Qwf/OpfM BS6vPKgvWZRIntnfh8tB1/zX5N697Vg= X-MC-Unique: GhO37UVYN2WfEozXQ3KnKg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 05/14] block: add new BlockDriver handler: bdrv_cancel_in_flight Date: Fri, 12 Feb 2021 14:16:10 -0600 Message-Id: <20210212201619.1388255-6-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=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: Fam Zheng , Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block I/O path" , Max Reitz , Stefan Hajnoczi 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" From: Vladimir Sementsov-Ogievskiy It will be used to stop retrying NBD requests on mirror cancel. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-2-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- include/block/block.h | 3 +++ include/block/block_int.h | 9 +++++++++ block/io.c | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 0a9f2c187cdb..2f2698074e30 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -849,4 +849,7 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int= 64_t src_offset, BdrvChild *dst, int64_t dst_offset, int64_t bytes, BdrvRequestFlags read_f= lags, BdrvRequestFlags write_flags); + +void bdrv_cancel_in_flight(BlockDriverState *bs); + #endif diff --git a/include/block/block_int.h b/include/block/block_int.h index 22a2789d3516..88e411193981 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -352,6 +352,15 @@ struct BlockDriver { bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, BlockDriverState **file); + /* + * This informs the driver that we are no longer interested in the res= ult + * of in-flight requests, so don't waste the time if possible. + * + * One example usage is to avoid waiting for an nbd target node reconn= ect + * timeout during job-cancel. + */ + void (*bdrv_cancel_in_flight)(BlockDriverState *bs); + /* * Invalidate any cached meta-data. */ diff --git a/block/io.c b/block/io.c index b0435ed6707c..ca2dca30070e 100644 --- a/block/io.c +++ b/block/io.c @@ -3460,3 +3460,14 @@ out: return ret; } + +void bdrv_cancel_in_flight(BlockDriverState *bs) +{ + if (!bs || !bs->drv) { + return; + } + + if (bs->drv->bdrv_cancel_in_flight) { + bs->drv->bdrv_cancel_in_flight(bs); + } +} --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161270; cv=none; d=zohomail.com; s=zohoarc; b=mX1ugwZpj94Um3xoKjxJmEl+ueTjUMVsPELMIIbWqlXa3dCsDLFezzEmM0beG183+Uh65/3N1L9K+IRfAFQ+F/pt+UC52gOAPWaCnNFBmHHaTX7LMdC61dnOeP7EtfFe6YVIprkagGTABL87+XwU7V07zhQR1LIo9e0rDHDY7A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161270; h=Content-Type: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=vmgkwd3GZ3WDtD2SuR6rBfdgEJ8/qhaQNF0kYao3QJ8=; b=kvBQH6x5Qbcb5UYsNXtEO1DY4ICA4WMuHhpW52z0/3l+W+4Q1KM+tn4k7LDwcD/ftIZPY502udxL3/MLwdyNBMeLhdYEWrsXh6CBaoTFT4Idm2SnC1n8kG1XJ8sbL6K8WXFIjtnfwUktX3uFiWpWQS3+I6SeXjcKAue5O5sFsfU= 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 1613161270018481.68719978972194; Fri, 12 Feb 2021 12:21:10 -0800 (PST) Received: from localhost ([::1]:52802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAew5-0000gz-UE for importer@patchew.org; Fri, 12 Feb 2021 15:21:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAero-0004HM-3C for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerj-0003sV-9s for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:38 -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-284-Bm9Ushb5M8SN25g9QO2S5Q-1; Fri, 12 Feb 2021 15:16:31 -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 1943B108BD18; Fri, 12 Feb 2021 20:16:30 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id A08E06E51F; Fri, 12 Feb 2021 20:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160993; 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=vmgkwd3GZ3WDtD2SuR6rBfdgEJ8/qhaQNF0kYao3QJ8=; b=Efq97of2Bphae94mIZ5cNGhqxAeCZmfLV9tyxF6ErgScWQTus0Ip157Qg0FAuDBbOU6f8I jPPDrbR7zOST2sgUlmVYR1BLDcEQb07wJ5i5Qcr84YRMXRo9XyTnf1g1o0VSQcjomBIroE mto854yqlAmHDoc5FNf5fGMXFbFwnL4= X-MC-Unique: Bm9Ushb5M8SN25g9QO2S5Q-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 06/14] block/nbd: implement .bdrv_cancel_in_flight Date: Fri, 12 Feb 2021 14:16:11 -0600 Message-Id: <20210212201619.1388255-7-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Network Block Dev..." , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy Just stop waiting for connection in existing requests. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-3-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/nbd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/block/nbd.c b/block/nbd.c index b3cbbeb4b0cb..c26dc5a54f52 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -2458,6 +2458,18 @@ static const char *const nbd_strong_runtime_opts[] = =3D { NULL }; +static void nbd_cancel_in_flight(BlockDriverState *bs) +{ + BDRVNBDState *s =3D (BDRVNBDState *)bs->opaque; + + reconnect_delay_timer_del(s); + + if (s->state =3D=3D NBD_CLIENT_CONNECTING_WAIT) { + s->state =3D NBD_CLIENT_CONNECTING_NOWAIT; + qemu_co_queue_restart_all(&s->free_sema); + } +} + static BlockDriver bdrv_nbd =3D { .format_name =3D "nbd", .protocol_name =3D "nbd", @@ -2484,6 +2496,7 @@ static BlockDriver bdrv_nbd =3D { .bdrv_co_block_status =3D nbd_client_co_block_status, .bdrv_dirname =3D nbd_dirname, .strong_runtime_opts =3D nbd_strong_runtime_opts, + .bdrv_cancel_in_flight =3D nbd_cancel_in_flight, }; static BlockDriver bdrv_nbd_tcp =3D { @@ -2512,6 +2525,7 @@ static BlockDriver bdrv_nbd_tcp =3D { .bdrv_co_block_status =3D nbd_client_co_block_status, .bdrv_dirname =3D nbd_dirname, .strong_runtime_opts =3D nbd_strong_runtime_opts, + .bdrv_cancel_in_flight =3D nbd_cancel_in_flight, }; static BlockDriver bdrv_nbd_unix =3D { @@ -2540,6 +2554,7 @@ static BlockDriver bdrv_nbd_unix =3D { .bdrv_co_block_status =3D nbd_client_co_block_status, .bdrv_dirname =3D nbd_dirname, .strong_runtime_opts =3D nbd_strong_runtime_opts, + .bdrv_cancel_in_flight =3D nbd_cancel_in_flight, }; static void bdrv_nbd_init(void) --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161754; cv=none; d=zohomail.com; s=zohoarc; b=nGsAatoEhiOhfdBe/Oo+2C+DAMktic9uvF6P81ETELitvZHPVwki9uq3y3CW0vBuKtWA8vIvayN2Z6EQeHT7JL2msW/pj/oyLRxHJLBiSOsNb1GriCBLk74cbRgz1LIFUmnV4gsiJ0ommp8id/Gc4GRzQWNyeu5XgTzjYb65scQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161754; h=Content-Type: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=uDMWf/HvEi/wk1Ifayydj4NfnlHyn1DPR3IotdzmBek=; b=iuGIqNN1VjheU9S1bD/zy+c9X1rrgAbYSZbGfp2F8SyQ0t+NPBMRAu6CFVE12rzHLU1xIlrWBBmw8Vq52BsA5Rf2cNKkaSEWZptzYkV0rKwMhp37CcliPzWhzUwZQNfR6bm4os/AgPeCISDsCz/JyIf/udk2N/avS0Lrl+Z/4pc= 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 1613161754328437.07461539866597; Fri, 12 Feb 2021 12:29:14 -0800 (PST) Received: from localhost ([::1]:48698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf3u-0002rH-6C for importer@patchew.org; Fri, 12 Feb 2021 15:29:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAero-0004Jx-1B for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerj-0003su-A0 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:39 -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-43-bZKiwFUAMh6M1vqdDEGzSw-1; Fri, 12 Feb 2021 15:16:31 -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 B141C801977; Fri, 12 Feb 2021 20:16:30 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448F66E528; Fri, 12 Feb 2021 20:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160994; 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=uDMWf/HvEi/wk1Ifayydj4NfnlHyn1DPR3IotdzmBek=; b=M1wgAHIPTRDtniOzvHPpC+Pq5jzmFz8oHLfvgjrZBBw4vTUylmil7UmgoLLs2VjmvHNbK2 l7E9uPp2sDeaK0K3JvVy4q6FJEK+PbznScbBOUVpEGoRtmjLC8QF3kdUXKS8k9sB4q63/H YAgPEGcDhktcqUha+ypC/1qt4v5cgyQ= X-MC-Unique: bZKiwFUAMh6M1vqdDEGzSw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 07/14] block/raw-format: implement .bdrv_cancel_in_flight handler Date: Fri, 12 Feb 2021 14:16:12 -0600 Message-Id: <20210212201619.1388255-8-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:raw" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy We are going to cancel in-flight requests on mirror nbd target on job cancel. Still nbd is often used not directly but as raw-format child. So, add pass-through handler here. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-4-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/raw-format.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/raw-format.c b/block/raw-format.c index 42ec50802bcd..7717578ed6ab 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -575,6 +575,11 @@ static const char *const raw_strong_runtime_opts[] =3D= { NULL }; +static void raw_cancel_in_flight(BlockDriverState *bs) +{ + bdrv_cancel_in_flight(bs->file->bs); +} + BlockDriver bdrv_raw =3D { .format_name =3D "raw", .instance_size =3D sizeof(BDRVRawState), @@ -608,6 +613,7 @@ BlockDriver bdrv_raw =3D { .bdrv_has_zero_init =3D &raw_has_zero_init, .strong_runtime_opts =3D raw_strong_runtime_opts, .mutable_opts =3D mutable_opts, + .bdrv_cancel_in_flight =3D raw_cancel_in_flight, }; static void bdrv_raw_init(void) --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161143; cv=none; d=zohomail.com; s=zohoarc; b=eDwp6kRQSQ1gEcuKkc1mR43ajVQCn4nxxTzU9SNJo9/iio8+qttDVB6ScYOJsExykYnaHityYEevUqymx1563vSjCac37sE6KVqh0z7Ep9t6rMq11pv2bf+fZOnUU1MLRH0ZNMM3zldVh3cHLPkJ354/puB6Ty6I1rNa5rt7kXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161143; h=Content-Type: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=CO+o1TEaSb7GV3Min+1FT7ANGUgrTFANiZySe6ig7m0=; b=lqv+i+CpFIJtmyhbweI0BgouZtgaALJqnnXArDc++BYRuvmPRweeX/04KLjCIWmL/FO4A+2zauGj2IzUZuN9i1NIQy8+QBHXtEKjnbA8q5vsc8WAc7bGdVquvoivA8MkDKQP6w4ewGtiOrOK4l+4ettWj+uCb9LAJb78Ro3X83E= 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 161316114352232.53411934022233; Fri, 12 Feb 2021 12:19:03 -0800 (PST) Received: from localhost ([::1]:46438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAeu5-0006VR-UZ for importer@patchew.org; Fri, 12 Feb 2021 15:19:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAern-0004In-Jf for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35191) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerj-0003sv-A8 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:39 -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-526--585gfT9OFuw8rSwH9uFIA-1; Fri, 12 Feb 2021 15:16:32 -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 4AAE963AD2; Fri, 12 Feb 2021 20:16:31 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id E04266B8E5; Fri, 12 Feb 2021 20:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160994; 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=CO+o1TEaSb7GV3Min+1FT7ANGUgrTFANiZySe6ig7m0=; b=S6VzJbAVmxfkcZGzCRpa7C1cByUDBycOXejoKBIEauC4jpXOQxEgGJgY5F634Z/NuJbI0M AMBSwrANoLfl4dr+XLhyRvlIuoPgahmrCFyorZh5oj7cYdwHnG4bzyRpRPR5xIBB6Qc+zf mKgZP+EiZNvTNX4R3Zj/5LAqlwY3OB4= X-MC-Unique: -585gfT9OFuw8rSwH9uFIA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 08/14] job: add .cancel handler for the driver Date: Fri, 12 Feb 2021 14:16:13 -0600 Message-Id: <20210212201619.1388255-9-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: Vladimir Sementsov-Ogievskiy , John Snow , "open list:Block Jobs" 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" From: Vladimir Sementsov-Ogievskiy To be used in mirror in the following commit to cancel in-flight io on target to not waste the time. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20210205163720.887197-5-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- include/qemu/job.h | 5 +++++ job.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/include/qemu/job.h b/include/qemu/job.h index 32aabb1c6000..efc6fa754498 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -251,6 +251,11 @@ struct JobDriver { */ void (*clean)(Job *job); + /** + * If the callback is not NULL, it will be invoked in job_cancel_async + */ + void (*cancel)(Job *job); + /** Called when the job is freed */ void (*free)(Job *job); diff --git a/job.c b/job.c index 3aaaebafe2c8..289edee14374 100644 --- a/job.c +++ b/job.c @@ -715,6 +715,9 @@ static int job_finalize_single(Job *job) static void job_cancel_async(Job *job, bool force) { + if (job->driver->cancel) { + job->driver->cancel(job); + } if (job->user_paused) { /* Do not call job_enter here, the caller will handle it. */ if (job->driver->user_resume) { --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161536; cv=none; d=zohomail.com; s=zohoarc; b=QLNw5xW1h/RBX1pWK8+badgJQHXEwugPGIG8rllDEOWQfo3m3PEqC4zz+a9qv0kkdCqJM4FxcQvP7o6Fba26u/rBeK0Ct6wiqXKftT9zd344POmkljiwtjACd6WooThh9uhxr2RyZA2rCOuGk4v3KF4riamhhVo1IrZHpjQRToI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161536; h=Content-Type: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=nk3bFncIH2/WA14kDwbaEOUPFjgrUPQv4ZfhI+mYvYY=; b=b+xREbY0OvbmbAXlZQTpQKHMCjpbnpfT+2lTaj1gD0Yut0JPJGpqglU1QgpDFOwqg8RipIfdvPIJ6YxpbNBpK8hrw2XD58gSUfCpPW347H/L0qz5jf/hx2JAkogNM9XNo/tPWr6+0/vJvJjvacazH3h3ox5E5JhoQnbw3mIQHCU= 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 1613161536185579.1117609941532; Fri, 12 Feb 2021 12:25:36 -0800 (PST) Received: from localhost ([::1]:36834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf0Q-00063e-1G for importer@patchew.org; Fri, 12 Feb 2021 15:25:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerp-0004N5-9U for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerl-0003tT-0W for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:40 -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-163-d7m4AMroM-26mfBdcv4C8Q-1; Fri, 12 Feb 2021 15:16:33 -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 F1A9F193410D; Fri, 12 Feb 2021 20:16:31 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 757206B8E5; Fri, 12 Feb 2021 20:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160996; 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=nk3bFncIH2/WA14kDwbaEOUPFjgrUPQv4ZfhI+mYvYY=; b=hPHcv9p4C2HO/sBwxCoq0fdHLNxCCU2Gludyd8J/05HnORp3PLI0Yb1unXUa6+BKLbPpmX 6KYrgpoqWzWcQV8Vwf7yv/HFAdOXCp8aoR5Ip3cCEtLu506MpT6pkqbPhYBoNbT98jwyPX HE/pIXYDg05yEj8TYiiO9ZKlAjkK9R4= X-MC-Unique: d7m4AMroM-26mfBdcv4C8Q-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 09/14] block/mirror: implement .cancel job handler Date: Fri, 12 Feb 2021 14:16:14 -0600 Message-Id: <20210212201619.1388255-10-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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=unavailable 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , John Snow , "open list:Block Jobs" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy Cancel in-flight io on target to not waste the time. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-6-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/mirror.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index 8e1ad6eceb57..9faffe470774 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1179,6 +1179,14 @@ static bool mirror_drained_poll(BlockJob *job) return !!s->in_flight; } +static void mirror_cancel(Job *job) +{ + MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); + BlockDriverState *target =3D blk_bs(s->target); + + bdrv_cancel_in_flight(target); +} + static const BlockJobDriver mirror_job_driver =3D { .job_driver =3D { .instance_size =3D sizeof(MirrorBlockJob), @@ -1190,6 +1198,7 @@ static const BlockJobDriver mirror_job_driver =3D { .abort =3D mirror_abort, .pause =3D mirror_pause, .complete =3D mirror_complete, + .cancel =3D mirror_cancel, }, .drained_poll =3D mirror_drained_poll, }; --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161465; cv=none; d=zohomail.com; s=zohoarc; b=hkI9CbV/jc7jJg37If2Xqgnl+HwlSLSPtHE5n5Ehadz4QAmXYYp6Vjlc8m33X5caGFAxU95tlZPwY4pilImN4/S3R5v0GXm400n/SzpVweDL0zymuRLJO31maNT5eHQUhXbDfg2XJ1STuaq7muM95y5cesstNmgqPAeBu+/Gnvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161465; h=Content-Type: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=4tscrRoPX0ZHiUmRctX161JhNDWtOIs+r+QFKBWqOL0=; b=j/vJxGzpwm2zm9aBFnfiqcv5+MoWkjTgYYxJKreQuD+8+mU3wr0VvRFvXBV+vTdr+JdeuI0vl3NpT3NgYUhH3wbokBTHh/W+3EHQc0TRjkZLJjUmWPEXkNfliaBYVIn3PGDtc3my7z4A5hds4pw8VE5UneXwfGY/Bejhr7fprik= 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 1613161465346378.70038921226603; Fri, 12 Feb 2021 12:24:25 -0800 (PST) Received: from localhost ([::1]:34444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAezC-000521-Bw for importer@patchew.org; Fri, 12 Feb 2021 15:24:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAert-0004UI-DM for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAern-0003vP-9T for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:45 -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-273-02Q0QncQOwihS_WnNecvhA-1; Fri, 12 Feb 2021 15:16:33 -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 9CB19835E33; Fri, 12 Feb 2021 20:16:32 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 307CC6B8E5; Fri, 12 Feb 2021 20:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160998; 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=4tscrRoPX0ZHiUmRctX161JhNDWtOIs+r+QFKBWqOL0=; b=jQHqZt9lQp6q+DZ3+Bct73Ue6v2jAU1GRnRMHls9NIRqu4qstHMSyVMPUk8643Wn7RiXWs LdNbP7ZjhChcjLL7H5C9W1lZrCTxDoRKl85q0Kp7X0jGbxNq0JSL8HGueadjh2JZnAFn6X w8qhc50Em9hcnmqseTsB8knWQYNhwfQ= X-MC-Unique: 02Q0QncQOwihS_WnNecvhA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 10/14] iotests/264: move to python unittest Date: Fri, 12 Feb 2021 14:16:15 -0600 Message-Id: <20210212201619.1388255-11-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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=unavailable 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy We are going to add more test cases, so use the library supporting test cases. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-7-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/264 | 109 +++++++++++++++++++++---------------- tests/qemu-iotests/264.out | 20 ++----- 2 files changed, 66 insertions(+), 63 deletions(-) diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index e725cefd47b5..6feeaa405632 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -20,13 +20,10 @@ # import time +import os import iotests -from iotests import qemu_img_create, file_path, qemu_nbd_popen, log - -iotests.script_initialize( - supported_fmts=3D['qcow2'], -) +from iotests import qemu_img_create, file_path, qemu_nbd_popen disk_a, disk_b, nbd_sock =3D file_path('disk_a', 'disk_b', 'nbd-sock') nbd_uri =3D 'nbd+unix:///?socket=3D' + nbd_sock @@ -34,46 +31,62 @@ size =3D 5 * 1024 * 1024 wait_limit =3D 3.0 wait_step =3D 0.2 -qemu_img_create('-f', iotests.imgfmt, disk_a, str(size)) -qemu_img_create('-f', iotests.imgfmt, disk_b, str(size)) - -with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): - vm =3D iotests.VM().add_drive(disk_a) - vm.launch() - vm.hmp_qemu_io('drive0', 'write 0 {}'.format(size)) - - vm.qmp_log('blockdev-add', filters=3D[iotests.filter_qmp_testfiles], - **{'node_name': 'backup0', - 'driver': 'raw', - 'file': {'driver': 'nbd', - 'server': {'type': 'unix', 'path': nbd_sock}, - 'reconnect-delay': 10}}) - vm.qmp_log('blockdev-backup', device=3D'drive0', sync=3D'full', - target=3D'backup0', speed=3D(1 * 1024 * 1024)) - - # Wait for some progress - t =3D 0.0 - while t < wait_limit: - jobs =3D vm.qmp('query-block-jobs')['return'] - if jobs and jobs[0]['offset'] > 0: - break - time.sleep(wait_step) - t +=3D wait_step - - if jobs and jobs[0]['offset'] > 0: - log('Backup job is started') - -jobs =3D vm.qmp('query-block-jobs')['return'] -if jobs and jobs[0]['offset'] < jobs[0]['len']: - log('Backup job is still in progress') - -vm.qmp_log('block-job-set-speed', device=3D'drive0', speed=3D0) - -# Emulate server down time for 1 second -time.sleep(1) - -with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): - e =3D vm.event_wait('BLOCK_JOB_COMPLETED') - log('Backup completed: {}'.format(e['data']['offset'])) - vm.qmp_log('blockdev-del', node_name=3D'backup0') - vm.shutdown() + +class TestNbdReconnect(iotests.QMPTestCase): + def setUp(self): + qemu_img_create('-f', iotests.imgfmt, disk_a, str(size)) + qemu_img_create('-f', iotests.imgfmt, disk_b, str(size)) + self.vm =3D iotests.VM().add_drive(disk_a) + self.vm.launch() + self.vm.hmp_qemu_io('drive0', 'write 0 {}'.format(size)) + + def tearDown(self): + self.vm.shutdown() + os.remove(disk_a) + os.remove(disk_b) + + def test(self): + with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): + result =3D self.vm.qmp('blockdev-add', + **{'node_name': 'backup0', + 'driver': 'raw', + 'file': {'driver': 'nbd', + 'server': {'type': 'unix', + 'path': nbd_sock}, + 'reconnect-delay': 10}}) + self.assert_qmp(result, 'return', {}) + result =3D self.vm.qmp('blockdev-backup', device=3D'drive0', + sync=3D'full', target=3D'backup0', + speed=3D(1 * 1024 * 1024)) + self.assert_qmp(result, 'return', {}) + + # Wait for some progress + t =3D 0.0 + while t < wait_limit: + jobs =3D self.vm.qmp('query-block-jobs')['return'] + if jobs and jobs[0]['offset'] > 0: + break + time.sleep(wait_step) + t +=3D wait_step + + self.assertTrue(jobs and jobs[0]['offset'] > 0) # job started + + jobs =3D self.vm.qmp('query-block-jobs')['return'] + # Check that job is still in progress + self.assertTrue(jobs and jobs[0]['offset'] < jobs[0]['len']) + + result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) + self.assert_qmp(result, 'return', {}) + + # Emulate server down time for 1 second + time.sleep(1) + + with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): + e =3D self.vm.event_wait('BLOCK_JOB_COMPLETED') + self.assertEqual(e['data']['offset'], size) + result =3D self.vm.qmp('blockdev-del', node_name=3D'backup0') + self.assert_qmp(result, 'return', {}) + + +if __name__ =3D=3D '__main__': + iotests.main(supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/264.out b/tests/qemu-iotests/264.out index c45b1e81ef26..ae1213e6f863 100644 --- a/tests/qemu-iotests/264.out +++ b/tests/qemu-iotests/264.out @@ -1,15 +1,5 @@ -Start NBD server -{"execute": "blockdev-add", "arguments": {"driver": "raw", "file": {"drive= r": "nbd", "reconnect-delay": 10, "server": {"path": "TEST_DIR/PID-nbd-sock= ", "type": "unix"}}, "node-name": "backup0"}} -{"return": {}} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "speed": = 1048576, "sync": "full", "target": "backup0"}} -{"return": {}} -Backup job is started -Kill NBD server -Backup job is still in progress -{"execute": "block-job-set-speed", "arguments": {"device": "drive0", "spee= d": 0}} -{"return": {}} -Start NBD server -Backup completed: 5242880 -{"execute": "blockdev-del", "arguments": {"node-name": "backup0"}} -{"return": {}} -Kill NBD server +. +---------------------------------------------------------------------- +Ran 1 tests + +OK --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161343; cv=none; d=zohomail.com; s=zohoarc; b=eSH1wW5X6zv6WU7DRtYcjb0fgi2EqPkIm3My9gtX9kG057+lub7J2VkAXgAsuGWSKDq+gok0aoNqfFnOBU/9ENtp+j3Yp2OLMNgpcPnlRsoYcvYaVq4+6W4Ozrm8n/lV8MNooXTX4Up+bIeFCOm05v8UoptWaw8s4c8+gu+ucg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161343; h=Content-Type: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=IIzr8nXRIKi0EILV8SDh80H5EorCfDfjVu/pg/m5BxY=; b=C/Zc1etPc5xad8SmwBrXblkCUuqARN65DA8q7QkK3QTOoIBfDst9Tqf4/N0pRPDg0X5ssb2b/6TzbK6uSn5Sz9ObvXrmj4Rgp9Y4CFNRhsoKB3ic+J5XEhgytpK1oXKNt2O/8qLuLyLZ63HxggWgd3Z2rhBjYqwv5rf10am7tRw= 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 1613161343217807.8465685880448; Fri, 12 Feb 2021 12:22:23 -0800 (PST) Received: from localhost ([::1]:55890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAexI-00026n-VR for importer@patchew.org; Fri, 12 Feb 2021 15:22:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAers-0004PD-4D for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerm-0003uq-6k for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:41 -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-579-6MIn6VZUPK-cGh-1Q2k9vQ-1; Fri, 12 Feb 2021 15:16:35 -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 47106801977; Fri, 12 Feb 2021 20:16:33 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF38B6E528; Fri, 12 Feb 2021 20:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160997; 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=IIzr8nXRIKi0EILV8SDh80H5EorCfDfjVu/pg/m5BxY=; b=eiMqXMd1aZpOkk3G98adu1yJQxXxNTJN4l9ZxFZJvQT9FUwXV0u0qancwOUeXA6LT2PnIZ Heplpqh25HE7b7Ft4Sn/3M382iyFu1b8qPrA661ZB0lruX3qbRfebnWGwYviQs7TRJlPIT Qp4I4EcPb5I9w5t5y9kt4sfU+pJZwws= X-MC-Unique: 6MIn6VZUPK-cGh-1Q2k9vQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 11/14] iotests.py: qemu_nbd_popen: remove pid file after use Date: Fri, 12 Feb 2021 14:16:16 -0600 Message-Id: <20210212201619.1388255-12-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy To not interfere with other qemu_nbd_popen() calls in same test. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-8-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/iotests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 00be68eca3e2..4e758308f247 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -296,7 +296,9 @@ def qemu_nbd_list_log(*args: str) -> str: @contextmanager def qemu_nbd_popen(*args): '''Context manager running qemu-nbd within the context''' - pid_file =3D file_path("pid") + pid_file =3D file_path("qemu_nbd_popen-nbd-pid-file") + + assert not os.path.exists(pid_file) cmd =3D list(qemu_nbd_args) cmd.extend(('--persistent', '--pid-file', pid_file)) @@ -314,6 +316,8 @@ def qemu_nbd_popen(*args): time.sleep(0.01) yield finally: + if os.path.exists(pid_file): + os.remove(pid_file) log('Kill NBD server') p.kill() p.wait() --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161629; cv=none; d=zohomail.com; s=zohoarc; b=Uc4w4aktgwnagE4wubba6g7Wj8ZeMr2lmTd7q89s0/QrQgYF5h/wx23uCkiYsf4hGuSW+1LSt0TSKfZyGgN0uI4lje5aXtF6f7BRcyZW8JuK0riXeaKfUcQza2f8+zrUsSxU5B2MPA8NlehwbtpZmaoOvFbkFdkT1/ZoDmEyiY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161629; h=Content-Type: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=JQxWEcr0Iu+MW/pITfaGMDDXYVcjTULZrpdjdEWY4ic=; b=NuSUzjjENqmSTyJTM2du5P5zW+TI6kEerlvwx3zV29vpyukKoaWXewVmqb8CTIbV8Z7j50Rx0dETRCWHwESShkEQG6C5IsiwhJ3rGW9HKLs6hp0NQgsJ9vefUqbPm5vHqW3JYCU1d6GYSDpgqGiEJgI9dbrO0xwa25Y1A7tK5WM= 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 161316162869485.29660654041993; Fri, 12 Feb 2021 12:27:08 -0800 (PST) Received: from localhost ([::1]:41908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf1s-0008LU-QB for importer@patchew.org; Fri, 12 Feb 2021 15:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAery-0004Vu-IK for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAers-0003z0-MV for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:50 -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-515-XXpYODF8NKicluG442ePrw-1; Fri, 12 Feb 2021 15:16:35 -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 E56ED801962; Fri, 12 Feb 2021 20:16:33 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7985A6B8E5; Fri, 12 Feb 2021 20:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613161003; 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=JQxWEcr0Iu+MW/pITfaGMDDXYVcjTULZrpdjdEWY4ic=; b=a8C/H4Dn7iyeMtlouMXBbZFTSzsHRXrw9n/u4XI+f/20AO+Wa4MBCaarM44RNLl81jMGtw COFabcKLWSwiG0gyvNQ1IbhZM0gZA0ZHoxWYJarkrmlcZNCk3SiGn4w90YAtmxk61dD0l9 sNxEef+cMFA1EZp2fB3CxxRi3rYjrKA= X-MC-Unique: XXpYODF8NKicluG442ePrw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 12/14] iotests/264: add mirror-cancel test-case Date: Fri, 12 Feb 2021 14:16:17 -0600 Message-Id: <20210212201619.1388255-13-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy Check that cancel doesn't wait for 10s of nbd reconnect timeout. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-9-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/264 | 38 ++++++++++++++++++++++++++++++-------- tests/qemu-iotests/264.out | 4 ++-- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index 6feeaa405632..347e53add51b 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -27,25 +27,26 @@ from iotests import qemu_img_create, file_path, qemu_nb= d_popen disk_a, disk_b, nbd_sock =3D file_path('disk_a', 'disk_b', 'nbd-sock') nbd_uri =3D 'nbd+unix:///?socket=3D' + nbd_sock -size =3D 5 * 1024 * 1024 wait_limit =3D 3.0 wait_step =3D 0.2 class TestNbdReconnect(iotests.QMPTestCase): - def setUp(self): - qemu_img_create('-f', iotests.imgfmt, disk_a, str(size)) - qemu_img_create('-f', iotests.imgfmt, disk_b, str(size)) + def init_vm(self, disk_size): + qemu_img_create('-f', iotests.imgfmt, disk_a, str(disk_size)) + qemu_img_create('-f', iotests.imgfmt, disk_b, str(disk_size)) self.vm =3D iotests.VM().add_drive(disk_a) self.vm.launch() - self.vm.hmp_qemu_io('drive0', 'write 0 {}'.format(size)) + self.vm.hmp_qemu_io('drive0', 'write 0 {}'.format(disk_size)) def tearDown(self): self.vm.shutdown() os.remove(disk_a) os.remove(disk_b) - def test(self): + def start_job(self, job): + """Stat job with nbd target and kill the server""" + assert job in ('blockdev-backup', 'blockdev-mirror') with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): result =3D self.vm.qmp('blockdev-add', **{'node_name': 'backup0', @@ -55,7 +56,7 @@ class TestNbdReconnect(iotests.QMPTestCase): 'path': nbd_sock}, 'reconnect-delay': 10}}) self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-backup', device=3D'drive0', + result =3D self.vm.qmp(job, device=3D'drive0', sync=3D'full', target=3D'backup0', speed=3D(1 * 1024 * 1024)) self.assert_qmp(result, 'return', {}) @@ -73,7 +74,8 @@ class TestNbdReconnect(iotests.QMPTestCase): jobs =3D self.vm.qmp('query-block-jobs')['return'] # Check that job is still in progress - self.assertTrue(jobs and jobs[0]['offset'] < jobs[0]['len']) + self.assertTrue(jobs) + self.assertTrue(jobs[0]['offset'] < jobs[0]['len']) result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) self.assert_qmp(result, 'return', {}) @@ -81,12 +83,32 @@ class TestNbdReconnect(iotests.QMPTestCase): # Emulate server down time for 1 second time.sleep(1) + def test_backup(self): + size =3D 5 * 1024 * 1024 + self.init_vm(size) + self.start_job('blockdev-backup') + with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): e =3D self.vm.event_wait('BLOCK_JOB_COMPLETED') self.assertEqual(e['data']['offset'], size) result =3D self.vm.qmp('blockdev-del', node_name=3D'backup0') self.assert_qmp(result, 'return', {}) + def test_mirror_cancel(self): + # Mirror speed limit doesn't work well enough, it seems that mirror + # will run many parallel requests anyway. MAX_IN_FLIGHT is 16 and + # MAX_IO_BYTES is 1M in mirror.c, so let's use 20M disk. + self.init_vm(20 * 1024 * 1024) + self.start_job('blockdev-mirror') + + result =3D self.vm.qmp('block-job-cancel', device=3D'drive0') + self.assert_qmp(result, 'return', {}) + + start_t =3D time.time() + self.vm.event_wait('BLOCK_JOB_CANCELLED') + delta_t =3D time.time() - start_t + self.assertTrue(delta_t < 2.0) + if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/264.out b/tests/qemu-iotests/264.out index ae1213e6f863..fbc63e62f885 100644 --- a/tests/qemu-iotests/264.out +++ b/tests/qemu-iotests/264.out @@ -1,5 +1,5 @@ -. +.. ---------------------------------------------------------------------- -Ran 1 tests +Ran 2 tests OK --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161980; cv=none; d=zohomail.com; s=zohoarc; b=Kgw+SPBKGbvSPT3+HUnh70RxDqiRQXiLu5aF23JZpltp4B5vQwQezmuocLi3KHHogBD6R+2O4UOI200VvxcoNXKPELle4jGBt8pTubw9w5GCv7MDAGbGsQkClIzbAFWWeIgL+36I/HpdZSnst4473P0oxhimx6u87tsHLkQMTjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161980; h=Content-Type: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=Nh3v1M6YI7AQnqOodrG3tI7MkQ7UyPMVC1DxfFVpaO0=; b=SRJtaWJLLmkZGSIgOAVwH38YrWjWdVuGCE5yg3Nx0Z4daiWuR262guyqqLPbfhCCGuv5zq7nBI5t8TmXFZM+OAz7WUmlmqAESMrOiH0g8+RkiSOwulLiyTGti304+zaQFwyW9Ob+ub8+qSVHA6/IbblmBQsNRs0L4V+ALehEFxI= 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 1613161979980632.6604831046626; Fri, 12 Feb 2021 12:32:59 -0800 (PST) Received: from localhost ([::1]:56812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf7Y-0006Qr-JZ for importer@patchew.org; Fri, 12 Feb 2021 15:32:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerq-0004QG-Rz for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAerm-0003vE-SL for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:42 -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-105-8JvHjRc4MzKoLZQ25PlQfA-1; Fri, 12 Feb 2021 15:16:35 -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 9C213107ACFB; Fri, 12 Feb 2021 20:16:34 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F97C6B8E5; Fri, 12 Feb 2021 20:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160998; 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=Nh3v1M6YI7AQnqOodrG3tI7MkQ7UyPMVC1DxfFVpaO0=; b=GPP0kTTFRwfLa57LwV8OBniND3bODKf2xPLEwKlgpIbrnsHMiu0yfwFzrXXs62KlSySdNn foy1auIfp7x+AfhhzybXu4Y+ZqlGDaoFTGRIh81p8s8RnBC6pPXieIV/JkhJVJzYP/Ro98 q93KzNS/iOH0cgg93EiITB/VCI+xoWI= X-MC-Unique: 8JvHjRc4MzKoLZQ25PlQfA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 13/14] block/backup: implement .cancel job handler Date: Fri, 12 Feb 2021 14:16:18 -0600 Message-Id: <20210212201619.1388255-14-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , John Snow , "open list:Block Jobs" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy Cancel in-flight io on target to not waste the time. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-10-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/backup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/backup.c b/block/backup.c index cc525d55445e..94e6dcd72e33 100644 --- a/block/backup.c +++ b/block/backup.c @@ -35,6 +35,7 @@ typedef struct BackupBlockJob { BlockJob common; BlockDriverState *backup_top; BlockDriverState *source_bs; + BlockDriverState *target_bs; BdrvDirtyBitmap *sync_bitmap; @@ -329,6 +330,13 @@ static void coroutine_fn backup_set_speed(BlockJob *jo= b, int64_t speed) } } +static void backup_cancel(Job *job) +{ + BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); + + bdrv_cancel_in_flight(s->target_bs); +} + static const BlockJobDriver backup_job_driver =3D { .job_driver =3D { .instance_size =3D sizeof(BackupBlockJob), @@ -340,6 +348,7 @@ static const BlockJobDriver backup_job_driver =3D { .abort =3D backup_abort, .clean =3D backup_clean, .pause =3D backup_pause, + .cancel =3D backup_cancel, }, .set_speed =3D backup_set_speed, }; @@ -528,6 +537,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, job->backup_top =3D backup_top; job->source_bs =3D bs; + job->target_bs =3D target; job->on_source_error =3D on_source_error; job->on_target_error =3D on_target_error; job->sync_mode =3D sync_mode; --=20 2.30.1 From nobody Sun Oct 5 15:34:19 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=1613161649; cv=none; d=zohomail.com; s=zohoarc; b=C+6W4fyqgm97eU2pIT+GYO6sdRaRxb0FD4v+Xz2oT7dNCAEoT7thZPJWbycNkoWwQV0eg2lb7hhVzC1y8lqk/QpqVx4H3ua7uzS76ZabWLXFhQ2KQ+UFaYy04HvwUndhmcdT0R8fh3JGDZPuuWWfm1JSXJIow5+31Pl7DVO/2q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613161649; h=Content-Type: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=+ZtCvMsXL8J4aFQyPFcujwHjVw+wp+H0ImnLK/amocU=; b=QY31fmpZL26nfkVLxYoxABgDcZ7uPDF1dm8vPa7CtniMghCwGYKvDH/f77mlFKm/3mAa43fzkW+NXrpKn7QPu6fka/TkPo9fLmKH81vWmBCUkLTUceum5A5zfQ3l7T8hb+P4AnIhVKINX+h5Rgx2VBGxbPbhdcZiV0IOcgc0IS4= 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 1613161648891572.7732969008483; Fri, 12 Feb 2021 12:27:28 -0800 (PST) Received: from localhost ([::1]:43756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAf2E-0000kE-Os for importer@patchew.org; Fri, 12 Feb 2021 15:27:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAerr-0004RC-Gk for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAern-0003vS-Bq for qemu-devel@nongnu.org; Fri, 12 Feb 2021 15:16:43 -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-71-kilVflvxNMeWFGTwX0erxA-1; Fri, 12 Feb 2021 15:16:36 -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 446DB1934116; Fri, 12 Feb 2021 20:16:35 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCCCC6B8E5; Fri, 12 Feb 2021 20:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613160998; 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=+ZtCvMsXL8J4aFQyPFcujwHjVw+wp+H0ImnLK/amocU=; b=PY/GvHQlkAK/5hjaOsM9+4BIaSOv48rUEQvm7W8LmBq/Tbe6rr34hrJQmG02aWyQ1qnteq vAkNwjB33qG4PqC/hh+v8EdU7mySh/K+AjeiWlH/1VussFXZ+KOJP4E0uAlfyXn1s1EB2X gB4YH+BrvS6pkEzaZ5rbG8RHWgi7ZzQ= X-MC-Unique: kilVflvxNMeWFGTwX0erxA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 14/14] iotests/264: add backup-cancel test-case Date: Fri, 12 Feb 2021 14:16:19 -0600 Message-Id: <20210212201619.1388255-15-eblake@redhat.com> In-Reply-To: <20210212201619.1388255-1-eblake@redhat.com> References: <20210212201619.1388255-1-eblake@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=eblake@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=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, 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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy Check that cancel doesn't wait for 10s of nbd reconnect timeout. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210205163720.887197-11-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/264 | 21 ++++++++++++++------- tests/qemu-iotests/264.out | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index 347e53add51b..4f96825a22c2 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -94,20 +94,27 @@ class TestNbdReconnect(iotests.QMPTestCase): result =3D self.vm.qmp('blockdev-del', node_name=3D'backup0') self.assert_qmp(result, 'return', {}) + def cancel_job(self): + result =3D self.vm.qmp('block-job-cancel', device=3D'drive0') + self.assert_qmp(result, 'return', {}) + + start_t =3D time.time() + self.vm.event_wait('BLOCK_JOB_CANCELLED') + delta_t =3D time.time() - start_t + self.assertTrue(delta_t < 2.0) + def test_mirror_cancel(self): # Mirror speed limit doesn't work well enough, it seems that mirror # will run many parallel requests anyway. MAX_IN_FLIGHT is 16 and # MAX_IO_BYTES is 1M in mirror.c, so let's use 20M disk. self.init_vm(20 * 1024 * 1024) self.start_job('blockdev-mirror') + self.cancel_job() - result =3D self.vm.qmp('block-job-cancel', device=3D'drive0') - self.assert_qmp(result, 'return', {}) - - start_t =3D time.time() - self.vm.event_wait('BLOCK_JOB_CANCELLED') - delta_t =3D time.time() - start_t - self.assertTrue(delta_t < 2.0) + def test_backup_cancel(self): + self.init_vm(5 * 1024 * 1024) + self.start_job('blockdev-backup') + self.cancel_job() if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/264.out b/tests/qemu-iotests/264.out index fbc63e62f885..8d7e99670093 100644 --- a/tests/qemu-iotests/264.out +++ b/tests/qemu-iotests/264.out @@ -1,5 +1,5 @@ -.. +... ---------------------------------------------------------------------- -Ran 2 tests +Ran 3 tests OK --=20 2.30.1