From nobody Sun Oct 5 19:23:38 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=1599083715; cv=none; d=zohomail.com; s=zohoarc; b=hgvhxX4tBkf9fkUCNEj+7n4PTwyuO7+KqvT6e8axwBJoT25ki7JtTKdLCdfaAX8RlJhKDAEN58h3XSOZHd5VMWqDTqkaDxHAh3BqlyDaEMGcisPpex4xyszCx+4wMWQ1l1v8RFI4GQg6neHKeC7h+9LT6tem22jJmH9LFlMjGdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083715; 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=aTR/SwqKv1rzRHi5F4XVHdVeyzTXW49KuLMZt4Hgr6Y=; b=ZDH2GTutXB+gkvwmcnmVvDrhbxWKqkCpb4L9OAEWBLoDVGj2nhxS+dL+babgcbdjadXXmv3GRtFVL+cgd2OWJxbifEv50HFC+xl+fP/9dWeAj2/+I918+Q9nfZqTOCwGc8iVGKFVQ0nJzTqK6yT63NWU3wjpn/ljbJ5ERZZG5Fk= 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 1599083715533756.4330161555765; Wed, 2 Sep 2020 14:55:15 -0700 (PDT) Received: from localhost ([::1]:60702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDaio-0000l8-9E for importer@patchew.org; Wed, 02 Sep 2020 17:55:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDaho-0007qc-BF for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:12 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:47234 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDahj-0002Zp-8c for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:11 -0400 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-450-K9k-J0WmNRqzoL03NGLV7Q-1; Wed, 02 Sep 2020 17:54:03 -0400 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 CDC2B10ABDB1; Wed, 2 Sep 2020 21:54:02 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FE3276E01; Wed, 2 Sep 2020 21:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083646; 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=aTR/SwqKv1rzRHi5F4XVHdVeyzTXW49KuLMZt4Hgr6Y=; b=XPIPdJYy1Jv1ZshTON4oqvKPWiSAOWVgah1jaQ+nDvlVPDNOJtfKhh97uWQzpr7BiCc5uk I8jzOBppmf8/PG5mqZnyGKE82u3+hKN/qUT0Kgu2gpUI8QxJ+ZtpSBM+FEpFX1voTA0e/q HSQvMO/F8Wz1DVpZwzJAYwFah7abepI= X-MC-Unique: K9k-J0WmNRqzoL03NGLV7Q-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 1/6] iotests/059: Fix reference output Date: Wed, 2 Sep 2020 16:53:55 -0500 Message-Id: <20200902215400.2673028-2-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.001 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=205.139.110.61; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 17:27:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 , "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 As of the patch to flush qemu-img's "Formatting" message before the error message, 059 has been broken for vmdk. Fix it. Fixes: 4e2f4418784da09cb106264340241856cd2846df ("qemu-img: Flush stdout before before potential stderr messages") Signed-off-by: Max Reitz Message-Id: <20200811084150.326377-1-mreitz@redhat.com> Reviewed-by: Eric blake Signed-off-by: Eric Blake --- tests/qemu-iotests/059.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index 6d127e28d8a6..2b83c0c8b66b 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -19,8 +19,8 @@ file format: IMGFMT virtual size: 2 GiB (2147483648 bytes) =3D=3D=3D Testing monolithicFlat with zeroed_grain =3D=3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2147483648 qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2147483648 =3D=3D=3D Testing big twoGbMaxExtentFlat =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824000 --=20 2.28.0 From nobody Sun Oct 5 19:23:38 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=1599083813; cv=none; d=zohomail.com; s=zohoarc; b=kYlw1Jmz+tjT8ePQs/EA/FK8H5fLp75/biM4VSqktab73rVHvUOjqo0oVkR8/IA9q+oQDJBjwQ5QRUxphBtF0mvyX1Os/mBnPGCxzB/Sn4EgNKyvvTI0+bGxGTdOXDGA2eplK2GZwiR832yZe48vOJOc9UZIMPArq3h6VPJ3VTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083813; 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=IOvHRzBDlGh16AJzQZ7ZZ3jriOEZlCNFhKTqMi1Gfbc=; b=kVFanuWxumkLNHT7t7+PiQQdRf+dwlTcqpfkTKStRFcCD3j3tz02lsFNa+n2hNPKNeVULyUx+lSUS7xg57VtFlaQFgoxXT6QOdLLs1wVaOP30WnlyEo2WRua8033vG59oJG0+oGrSRcm32cPHKe4y6/D1Z0jPOyNA18uvCmxwQk= 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 1599083813012146.2900326695036; Wed, 2 Sep 2020 14:56:53 -0700 (PDT) Received: from localhost ([::1]:39412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDakO-0003f2-9x for importer@patchew.org; Wed, 02 Sep 2020 17:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDahq-0007vR-WF for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDaho-0002as-0I for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:14 -0400 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-412-NEoNEDqYNTCE8QqKPHO-yw-1; Wed, 02 Sep 2020 17:54:04 -0400 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 59C52802B63; Wed, 2 Sep 2020 21:54:03 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3E5B76E01; Wed, 2 Sep 2020 21:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083648; 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=IOvHRzBDlGh16AJzQZ7ZZ3jriOEZlCNFhKTqMi1Gfbc=; b=Bf6FJOkdj/4SDXzpDdqXfzMk1CdoxqJAAaqEkeh34lg5rqWI8yZWRd9/Usloj29zaF0mFu 9NUNqpbTN6dSqsv9KsGMcF1CEHVvTn5E2J6R/ZJO0saqojezbm6roZnjJQmuMgpY03eNre vpVYSJ28lyBl+K/ucANs3WaBJIe1/Sg= X-MC-Unique: NEoNEDqYNTCE8QqKPHO-yw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 2/6] iotests/259: Fix reference output Date: Wed, 2 Sep 2020 16:53:56 -0500 Message-Id: <20200902215400.2673028-3-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.001 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 02:42:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , "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 The error message has changed recently, breaking the test. Fix it. Fixes: a2b333c01880f56056d50c238834d62e32001e54 ("block: nbd: Fix convert qcow2 compressed to nbd") Signed-off-by: Max Reitz Message-Id: <20200811080830.289136-1-mreitz@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- tests/qemu-iotests/259.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/259.out b/tests/qemu-iotests/259.out index e27b9ff38d75..1aaadfda4ead 100644 --- a/tests/qemu-iotests/259.out +++ b/tests/qemu-iotests/259.out @@ -10,5 +10,5 @@ disk size: unavailable --- Testing creation for which the node would need to grow --- Formatting 'TEST_DIR/t.IMGFMT', fmt=3Dqcow2 size=3D67108864 preallocation= =3Dmetadata -qemu-img: TEST_DIR/t.IMGFMT: Could not resize image: Image format driver d= oes not support resize +qemu-img: TEST_DIR/t.IMGFMT: Could not resize image: Cannot grow NBD nodes *** done --=20 2.28.0 From nobody Sun Oct 5 19:23:38 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=1599083719; cv=none; d=zohomail.com; s=zohoarc; b=GippS6UgW0B41DklGyFgqN+9m/5xy1c0ioOJw3fKh1vSW1gf9qy6T5AK82040lDhD5PRBDBsj1z15jnin66mTyr0cCywx45QKlCZCMj0lyK+0PopyH/h927aJWjuvvll9n0+CO0gvqlPC+FRQbjmnBFCbi971z2txpK66wiXoVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083719; 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=71+WRF1kScJNHLwsOcF2FDQd1Dtqs5Xvhap0vNkNF/Q=; b=fbrYqgkSYgQM7olESlwpKxiRQzqeuNEhbVIfVx9uJEzs7Ofw9EX7DzW53iNqbhxrEN08AozPF+cFtD9kmovu/VFD+e6z8MrirsXk+Ry4o8LOOZihFYugCzzuPrt0/AwmSp3ecrwocZPm6BIf8NSowcze+rjcU9h9vOXBs5Hdsko= 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 15990837195771009.216935853152; Wed, 2 Sep 2020 14:55:19 -0700 (PDT) Received: from localhost ([::1]:32818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDais-0000tQ-Qy for importer@patchew.org; Wed, 02 Sep 2020 17:55:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDahq-0007uO-HG for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:14 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:44567 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDahn-0002aE-VG for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:14 -0400 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-147-98EPpeJMNmKFgv8xRZJBGA-1; Wed, 02 Sep 2020 17:54:05 -0400 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 32B531DE00; Wed, 2 Sep 2020 21:54:04 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8263A7EEB6; Wed, 2 Sep 2020 21:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083648; 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=71+WRF1kScJNHLwsOcF2FDQd1Dtqs5Xvhap0vNkNF/Q=; b=D67fH57j9POKNgjOOv4v/M7bEBQc5WzwX767S5SsGVGCEV9RXlAsmhFTdYo4yUR+BQ9jkq /+UAfI74sEOEnzrA0Ti/IauQC69kRdAfvn7K0vXQ40Rz8QDJsPMIkZloKd7yYKq5OCe6u7 FRKWrvwXJ1gdvOgvX3DPbGa+zettg0s= X-MC-Unique: 98EPpeJMNmKFgv8xRZJBGA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 3/6] block/nbd: use non-blocking connect: fix vm hang on connect() Date: Wed, 2 Sep 2020 16:53:57 -0500 Message-Id: <20200902215400.2673028-4-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.002 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=207.211.31.81; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 17:54:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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 This makes nbd's connection_co yield during reconnects, so that reconnect doesn't block the main thread. This is very important in case of an unavailable nbd server host: connect() call may take a long time, blocking the main thread (and due to reconnect, it will hang again and again with small gaps of working time during pauses between connection attempts). Realization notes: - We don't want to implement non-blocking connect() over non-blocking socket, because getaddrinfo() doesn't have portable non-blocking realization anyway, so let's just use a thread for both getaddrinfo() and connect(). - We can't use qio_channel_socket_connect_async (which behaves similarly and starts a thread to execute connect() call), as it's relying on someone iterating main loop (g_main_loop_run() or something like this), which is not always the case. - We can't use thread_pool_submit_co API, as thread pool waits for all threads to finish (but we don't want to wait for blocking reconnect attempt on shutdown. So, we just create the thread by hand. Some additional difficulties are: - We want our connect to avoid blocking drained sections and aio context switches. To achieve this, we make it possible to "cancel" synchronous wait for the connect (which is a coroutine yield actually), still, the thread continues in background, and if successful, its result may be reused on next reconnect attempt. - We don't want to wait for reconnect on shutdown, so there is CONNECT_THREAD_RUNNING_DETACHED thread state, which means that the block layer is no longer interested in a result, and thread should close new connected socket on finish and free the state. How to reproduce the bug, fixed with this commit: 1. Create an image on node1: qemu-img create -f qcow2 xx 100M 2. Start NBD server on node1: qemu-nbd xx 3. Start vm with second nbd disk on node2, like this: ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -drive \ file=3D/work/images/cent7.qcow2 -drive file=3Dnbd+tcp://192.168.100.2 \ -vnc :0 -qmp stdio -m 2G -enable-kvm -vga std 4. Access the vm through vnc (or some other way?), and check that NBD drive works: dd if=3D/dev/sdb of=3D/dev/null bs=3D1M count=3D10 - the command should succeed. 5. Now, let's trigger nbd-reconnect loop in Qemu process. For this: 5.1 Kill NBD server on node1 5.2 run "dd if=3D/dev/sdb of=3D/dev/null bs=3D1M count=3D10" in the guest again. The command should fail and a lot of error messages about failing disk may appear as well. Now NBD client driver in Qemu tries to reconnect. Still, VM works well. 6. Make node1 unavailable on NBD port, so connect() from node2 will last for a long time: On node1 (Note, that 10809 is just a default NBD port): sudo iptables -A INPUT -p tcp --dport 10809 -j DROP After some time the guest hangs, and you may check in gdb that Qemu hangs in connect() call, issued from the main thread. This is the BUG. 7. Don't forget to drop iptables rule from your node1: sudo iptables -D INPUT -p tcp --dport 10809 -j DROP Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20200812145237.4396-1-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: minor wording and formatting tweaks] Signed-off-by: Eric Blake --- block/nbd.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 265 insertions(+), 1 deletion(-) diff --git a/block/nbd.c b/block/nbd.c index 7bb881fef49c..9daf003bea30 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -38,6 +38,7 @@ #include "qapi/qapi-visit-sockets.h" #include "qapi/qmp/qstring.h" +#include "qapi/clone-visitor.h" #include "block/qdict.h" #include "block/nbd.h" @@ -62,6 +63,47 @@ typedef enum NBDClientState { NBD_CLIENT_QUIT } NBDClientState; +typedef enum NBDConnectThreadState { + /* No thread, no pending results */ + CONNECT_THREAD_NONE, + + /* Thread is running, no results for now */ + CONNECT_THREAD_RUNNING, + + /* + * Thread is running, but requestor exited. Thread should close + * the new socket and free the connect state on exit. + */ + CONNECT_THREAD_RUNNING_DETACHED, + + /* Thread finished, results are stored in a state */ + CONNECT_THREAD_FAIL, + CONNECT_THREAD_SUCCESS +} NBDConnectThreadState; + +typedef struct NBDConnectThread { + /* Initialization constants */ + SocketAddress *saddr; /* address to connect to */ + /* + * Bottom half to schedule on completion. Scheduled only if bh_ctx is = not + * NULL + */ + QEMUBHFunc *bh_func; + void *bh_opaque; + + /* + * Result of last attempt. Valid in FAIL and SUCCESS states. + * If you want to steal error, don't forget to set pointer to NULL. + */ + QIOChannelSocket *sioc; + Error *err; + + /* state and bh_ctx are protected by mutex */ + QemuMutex mutex; + NBDConnectThreadState state; /* current state of the thread */ + AioContext *bh_ctx; /* where to schedule bh (NULL means don't schedule= ) */ +} NBDConnectThread; + typedef struct BDRVNBDState { QIOChannelSocket *sioc; /* The master data channel */ QIOChannel *ioc; /* The current I/O channel which may differ (eg TLS) = */ @@ -91,10 +133,17 @@ typedef struct BDRVNBDState { QCryptoTLSCreds *tlscreds; const char *hostname; char *x_dirty_bitmap; + + bool wait_connect; + NBDConnectThread *connect_thread; } BDRVNBDState; static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr, Error **errp); +static QIOChannelSocket *nbd_co_establish_connection(BlockDriverState *bs, + Error **errp); +static void nbd_co_establish_connection_cancel(BlockDriverState *bs, + bool detach); static int nbd_client_handshake(BlockDriverState *bs, QIOChannelSocket *si= oc, Error **errp); @@ -191,6 +240,8 @@ static void coroutine_fn nbd_client_co_drain_begin(Bloc= kDriverState *bs) if (s->connection_co_sleep_ns_state) { qemu_co_sleep_wake(s->connection_co_sleep_ns_state); } + + nbd_co_establish_connection_cancel(bs, false); } static void coroutine_fn nbd_client_co_drain_end(BlockDriverState *bs) @@ -223,6 +274,7 @@ static void nbd_teardown_connection(BlockDriverState *b= s) if (s->connection_co_sleep_ns_state) { qemu_co_sleep_wake(s->connection_co_sleep_ns_state); } + nbd_co_establish_connection_cancel(bs, true); } if (qemu_in_coroutine()) { s->teardown_co =3D qemu_coroutine_self(); @@ -246,6 +298,216 @@ static bool nbd_client_connecting_wait(BDRVNBDState *= s) return s->state =3D=3D NBD_CLIENT_CONNECTING_WAIT; } +static void connect_bh(void *opaque) +{ + BDRVNBDState *state =3D opaque; + + assert(state->wait_connect); + state->wait_connect =3D false; + aio_co_wake(state->connection_co); +} + +static void nbd_init_connect_thread(BDRVNBDState *s) +{ + s->connect_thread =3D g_new(NBDConnectThread, 1); + + *s->connect_thread =3D (NBDConnectThread) { + .saddr =3D QAPI_CLONE(SocketAddress, s->saddr), + .state =3D CONNECT_THREAD_NONE, + .bh_func =3D connect_bh, + .bh_opaque =3D s, + }; + + qemu_mutex_init(&s->connect_thread->mutex); +} + +static void nbd_free_connect_thread(NBDConnectThread *thr) +{ + if (thr->sioc) { + qio_channel_close(QIO_CHANNEL(thr->sioc), NULL); + } + error_free(thr->err); + qapi_free_SocketAddress(thr->saddr); + g_free(thr); +} + +static void *connect_thread_func(void *opaque) +{ + NBDConnectThread *thr =3D opaque; + int ret; + bool do_free =3D false; + + thr->sioc =3D qio_channel_socket_new(); + + error_free(thr->err); + thr->err =3D NULL; + ret =3D qio_channel_socket_connect_sync(thr->sioc, thr->saddr, &thr->e= rr); + if (ret < 0) { + object_unref(OBJECT(thr->sioc)); + thr->sioc =3D NULL; + } + + qemu_mutex_lock(&thr->mutex); + + switch (thr->state) { + case CONNECT_THREAD_RUNNING: + thr->state =3D ret < 0 ? CONNECT_THREAD_FAIL : CONNECT_THREAD_SUCC= ESS; + if (thr->bh_ctx) { + aio_bh_schedule_oneshot(thr->bh_ctx, thr->bh_func, thr->bh_opa= que); + + /* play safe, don't reuse bh_ctx on further connection attempt= s */ + thr->bh_ctx =3D NULL; + } + break; + case CONNECT_THREAD_RUNNING_DETACHED: + do_free =3D true; + break; + default: + abort(); + } + + qemu_mutex_unlock(&thr->mutex); + + if (do_free) { + nbd_free_connect_thread(thr); + } + + return NULL; +} + +static QIOChannelSocket *coroutine_fn +nbd_co_establish_connection(BlockDriverState *bs, Error **errp) +{ + QemuThread thread; + BDRVNBDState *s =3D bs->opaque; + QIOChannelSocket *res; + NBDConnectThread *thr =3D s->connect_thread; + + qemu_mutex_lock(&thr->mutex); + + switch (thr->state) { + case CONNECT_THREAD_FAIL: + case CONNECT_THREAD_NONE: + error_free(thr->err); + thr->err =3D NULL; + thr->state =3D CONNECT_THREAD_RUNNING; + qemu_thread_create(&thread, "nbd-connect", + connect_thread_func, thr, QEMU_THREAD_DETACHED); + break; + case CONNECT_THREAD_SUCCESS: + /* Previous attempt finally succeeded in background */ + thr->state =3D CONNECT_THREAD_NONE; + res =3D thr->sioc; + thr->sioc =3D NULL; + qemu_mutex_unlock(&thr->mutex); + return res; + case CONNECT_THREAD_RUNNING: + /* Already running, will wait */ + break; + default: + abort(); + } + + thr->bh_ctx =3D qemu_get_current_aio_context(); + + qemu_mutex_unlock(&thr->mutex); + + + /* + * We are going to wait for connect-thread finish, but + * nbd_client_co_drain_begin() can interrupt. + * + * Note that wait_connect variable is not visible for connect-thread. = It + * doesn't need mutex protection, it used only inside home aio context= of + * bs. + */ + s->wait_connect =3D true; + qemu_coroutine_yield(); + + qemu_mutex_lock(&thr->mutex); + + switch (thr->state) { + case CONNECT_THREAD_SUCCESS: + case CONNECT_THREAD_FAIL: + thr->state =3D CONNECT_THREAD_NONE; + error_propagate(errp, thr->err); + thr->err =3D NULL; + res =3D thr->sioc; + thr->sioc =3D NULL; + break; + case CONNECT_THREAD_RUNNING: + case CONNECT_THREAD_RUNNING_DETACHED: + /* + * Obviously, drained section wants to start. Report the attempt as + * failed. Still connect thread is executing in background, and its + * result may be used for next connection attempt. + */ + res =3D NULL; + error_setg(errp, "Connection attempt cancelled by other operation"= ); + break; + + case CONNECT_THREAD_NONE: + /* + * Impossible. We've seen this thread running. So it should be + * running or at least give some results. + */ + abort(); + + default: + abort(); + } + + qemu_mutex_unlock(&thr->mutex); + + return res; +} + +/* + * nbd_co_establish_connection_cancel + * Cancel nbd_co_establish_connection asynchronously: it will finish soon,= to + * allow drained section to begin. + * + * If detach is true, also cleanup the state (or if thread is running, mov= e it + * to CONNECT_THREAD_RUNNING_DETACHED state). s->connect_thread becomes NU= LL if + * detach is true. + */ +static void nbd_co_establish_connection_cancel(BlockDriverState *bs, + bool detach) +{ + BDRVNBDState *s =3D bs->opaque; + NBDConnectThread *thr =3D s->connect_thread; + bool wake =3D false; + bool do_free =3D false; + + qemu_mutex_lock(&thr->mutex); + + if (thr->state =3D=3D CONNECT_THREAD_RUNNING) { + /* We can cancel only in running state, when bh is not yet schedul= ed */ + thr->bh_ctx =3D NULL; + if (s->wait_connect) { + s->wait_connect =3D false; + wake =3D true; + } + if (detach) { + thr->state =3D CONNECT_THREAD_RUNNING_DETACHED; + s->connect_thread =3D NULL; + } + } else if (detach) { + do_free =3D true; + } + + qemu_mutex_unlock(&thr->mutex); + + if (do_free) { + nbd_free_connect_thread(thr); + s->connect_thread =3D NULL; + } + + if (wake) { + aio_co_wake(s->connection_co); + } +} + static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s) { int ret; @@ -289,7 +551,7 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDS= tate *s) s->ioc =3D NULL; } - sioc =3D nbd_establish_connection(s->saddr, &local_err); + sioc =3D nbd_co_establish_connection(s->bs, &local_err); if (!sioc) { ret =3D -ECONNREFUSED; goto out; @@ -1946,6 +2208,8 @@ static int nbd_open(BlockDriverState *bs, QDict *opti= ons, int flags, /* successfully connected */ s->state =3D NBD_CLIENT_CONNECTED; + nbd_init_connect_thread(s); + s->connection_co =3D qemu_coroutine_create(nbd_connection_entry, s); bdrv_inc_in_flight(bs); aio_co_schedule(bdrv_get_aio_context(bs), s->connection_co); --=20 2.28.0 From nobody Sun Oct 5 19:23:38 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=1599083805; cv=none; d=zohomail.com; s=zohoarc; b=G0BWcQTset94h/JP5C//2qxU7aGA3N3js4at1VDiy+1jTa2yjsIvU31booDLRSVLYxiQLH6yyDxl6EEB5ZnEVRgtFCj48ZO4lCWppFy3p+FaWFGzzlSeZr5WXYfKoQbOcpoUPsU8sgd5V9UvDQYRPojVAs8g+wusjJfOoks2MU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083805; 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=dgJoFYMM2RMQrtDwiNxObbgz2MMdgrhssuAOXPQMNMo=; b=SrIqxfC8I7ssa5fgD72Y4x8xO/dRy6wf6XZ6PCx0CTIFzdWttHJLr9OMgNY/b/J5w91OYvyNAA+sGFobmf9/Wn6EyOo2cZYRPlIFpWd4sUuU304xr3YPsVWwkQlUwvMtg334O5DNrdkJ8epd2tPbJ6cwJdXqobO5/jcGKO3cNB8= 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 1599083805365129.30829920077622; Wed, 2 Sep 2020 14:56:45 -0700 (PDT) Received: from localhost ([::1]:38698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDakF-0003Nt-Jb for importer@patchew.org; Wed, 02 Sep 2020 17:56:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDahp-0007sn-G5 for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:13 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:35356 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDahn-0002aC-Sd for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:13 -0400 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-177-0YkFeXWWPDeQ0Ymb5YQcsQ-1; Wed, 02 Sep 2020 17:54:05 -0400 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 C5C761DE02; Wed, 2 Sep 2020 21:54:04 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CA8076E01; Wed, 2 Sep 2020 21:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083647; 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=dgJoFYMM2RMQrtDwiNxObbgz2MMdgrhssuAOXPQMNMo=; b=DxBPdvoq/dUYAAHEeve3f5P4OhDnsmSwSWZsvYxXKQbph741OB5XuGXuFHZTJYiZugsRF0 DhumWXUqOfPIXe2eQTZhgr0V8ggh/pz4wBMExSylcp4bDl0NcUmVUP0ruPJYdyzY+o5oxp Vy/KU6OvaKMXUaadPtPPA+UBa7Ee334= X-MC-Unique: 0YkFeXWWPDeQ0Ymb5YQcsQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 4/6] block: add missing socket_init() calls to tools Date: Wed, 2 Sep 2020 16:53:58 -0500 Message-Id: <20200902215400.2673028-5-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.002 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=207.211.31.81; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 17:54:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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=2E=20Berrang=C3=A9?= , "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) From: Daniel P. Berrang=C3=A9 Any tool that uses sockets needs to call socket_init() in order to work on the Windows platform. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20200825103850.119911-2-berrange@redhat.com> Signed-off-by: Eric Blake --- qemu-img.c | 2 ++ qemu-io.c | 2 ++ qemu-nbd.c | 1 + 3 files changed, 5 insertions(+) diff --git a/qemu-img.c b/qemu-img.c index 5308773811f3..eb2fc1f86243 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -41,6 +41,7 @@ #include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/sockets.h" #include "qemu/units.h" #include "qom/object_interfaces.h" #include "sysemu/block-backend.h" @@ -5410,6 +5411,7 @@ int main(int argc, char **argv) signal(SIGPIPE, SIG_IGN); #endif + socket_init(); error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); qemu_init_exec_dir(argv[0]); diff --git a/qemu-io.c b/qemu-io.c index 3adc5a7d0d3f..7cc832b3d618 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -25,6 +25,7 @@ #include "qemu/config-file.h" #include "qemu/readline.h" #include "qemu/log.h" +#include "qemu/sockets.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" #include "qom/object_interfaces.h" @@ -542,6 +543,7 @@ int main(int argc, char **argv) signal(SIGPIPE, SIG_IGN); #endif + socket_init(); error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); qemu_init_exec_dir(argv[0]); diff --git a/qemu-nbd.c b/qemu-nbd.c index d2657b8db50d..b102874f0f46 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -599,6 +599,7 @@ int main(int argc, char **argv) signal(SIGPIPE, SIG_IGN); #endif + socket_init(); error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); qcrypto_init(&error_fatal); --=20 2.28.0 From nobody Sun Oct 5 19:23:38 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=1599083726; cv=none; d=zohomail.com; s=zohoarc; b=ZiINOpochP0Cwmd742CcHF5E066VEbDGz4ssqltLXSUFpAO/8871nloE2IXCBBlwBOGC6JIoa9p+Z4wSWw+dApKNMuyzNl0uTRZwvtPGpTlL4P93aMSdueb5n/7nT76rJsZns7ZRiRvz5GC+pKT1SV2OY0RNghKk4a2GaTMtmqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083726; 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=pb71fkE0tUwfPUi4tgmAfYpIsBy8o2zxmXVpC6K95eQ=; b=KQDO+H5q2lYhPVl/6L0XmXJnxGO5RdVsk1PIR9bxPeNXROpH+bMffmPW5MPUHm2Lf7Wzz3Cr/SGvIN7T1oqLReEKTOX2IfzH8Ota63fHrAUZIRurLBydIzQYrSzrmzXAMmNrVRU/yYFaKVJPAWwTeb14iNwEw1FFMRPlI48HeKA= 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 159908372666358.84496733748324; Wed, 2 Sep 2020 14:55:26 -0700 (PDT) Received: from localhost ([::1]:33436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDaiz-00018Q-US for importer@patchew.org; Wed, 02 Sep 2020 17:55:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDahq-0007ug-Kk for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDahn-0002aV-UA for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:14 -0400 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-247-VfXys_E5NzaPf6N2GeFHpw-1; Wed, 02 Sep 2020 17:54:06 -0400 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 427E3802B6E; Wed, 2 Sep 2020 21:54:05 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAD1276E01; Wed, 2 Sep 2020 21:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083648; 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=pb71fkE0tUwfPUi4tgmAfYpIsBy8o2zxmXVpC6K95eQ=; b=P6Ufbs+JG9IFss3MkM5Td9s1Ik0Gxaxqg4ByuhFwLVah6YE8oEGASmf4hVwxlbPlk/ZkME njzreRxm6SPARbuCAgAvqS/jxGc42GbZJ0mWnbRnSStmdrhMpSoTL5uW58hTEWcJLPUorg rhF85cvDYJ9bqTJEAWrJyQCdw0Bf3+0= X-MC-Unique: VfXys_E5NzaPf6N2GeFHpw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 5/6] nbd: skip SIGTERM handler if NBD device support is not built Date: Wed, 2 Sep 2020 16:53:59 -0500 Message-Id: <20200902215400.2673028-6-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.003 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 17:54:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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: =?UTF-8?q?Daniel=20P=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) From: Daniel P. Berrang=C3=A9 The termsig_handler function is used by the client thread handling the host NBD device connection to do a graceful shutdown. IOW, if we have disabled NBD device support at compile time, we don't need the SIGTERM handler. This fixes a build issue for Windows. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20200825103850.119911-3-berrange@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- qemu-nbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index b102874f0f46..dc6ef089afd5 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -155,12 +155,13 @@ QEMU_COPYRIGHT "\n" , name); } +#if HAVE_NBD_DEVICE static void termsig_handler(int signum) { atomic_cmpxchg(&state, RUNNING, TERMINATE); qemu_notify_event(); } - +#endif /* HAVE_NBD_DEVICE */ static int qemu_nbd_client_list(SocketAddress *saddr, QCryptoTLSCreds *tls, const char *hostname) @@ -587,6 +588,7 @@ int main(int argc, char **argv) unsigned socket_activation; const char *pid_file_name =3D NULL; +#if HAVE_NBD_DEVICE /* The client thread uses SIGTERM to interrupt the server. A signal * handler ensures that "qemu-nbd -v -c" exits with a nice status code. */ @@ -594,6 +596,7 @@ int main(int argc, char **argv) memset(&sa_sigterm, 0, sizeof(sa_sigterm)); sa_sigterm.sa_handler =3D termsig_handler; sigaction(SIGTERM, &sa_sigterm, NULL); +#endif /* HAVE_NBD_DEVICE */ #ifdef CONFIG_POSIX signal(SIGPIPE, SIG_IGN); --=20 2.28.0 From nobody Sun Oct 5 19:23:38 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=1599083893; cv=none; d=zohomail.com; s=zohoarc; b=DrcMkb8+M2oKvusQt0M6f02jLOFm00rYsHe93PFJVpvZN5n1GJvxXGkLlv71T8yGJNHgtyrQ9J2WO8HgnwB44ReiDrd1zBtEF/N2JqZFZPs1nzxKZKm6jLlBbw7HRFd1Qa99+WAvlfS5pP85ZX7U8mc/VvUa/jnBW7iQVodP+5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599083893; 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=J2tYQkyVYDZ3Na2n5cIcAsIsopY2LFgv8iyHrh2+JYQ=; b=Zt/KJV9QiTQ07tRIQXN/SWC+4G9eWVubYJbBGcHyCb6xAvxVVseXB20Vhi4RRiaRl7EurgYGlmv6hNJVQ5ItLUcZLecGltaFNbE5GClc0oZ6vu7UD9eTmPEIo6WJbVsuK1P+gesWdyhf4mmFu6UWUEO72CHBF0IZxhSJw8LBJI0= 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 1599083893987943.6641382339119; Wed, 2 Sep 2020 14:58:13 -0700 (PDT) Received: from localhost ([::1]:44106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDalh-0005Y4-5U for importer@patchew.org; Wed, 02 Sep 2020 17:58:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDaht-00082k-Jx for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDahp-0002bV-NH for qemu-devel@nongnu.org; Wed, 02 Sep 2020 17:54:17 -0400 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-429-wzxyT1xyMpGPZDKCIgsUYg-1; Wed, 02 Sep 2020 17:54:06 -0400 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 BB9F5802B63; Wed, 2 Sep 2020 21:54:05 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C4A576E01; Wed, 2 Sep 2020 21:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599083653; 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=J2tYQkyVYDZ3Na2n5cIcAsIsopY2LFgv8iyHrh2+JYQ=; b=JTwpQNfMyLYz3FZS8ZJsE/90ULzCvD/SfTQ6pkQ+rdk5gLUjAa99bRzy65uKqpgTDWLMJC v4pp+tP6g/sjm+TE85m0lhp4ZWVut0bjVYhN26rWO9R8ITMIaJk+P5QYn6zxwzh9nKeRcP zsIC3N6QKUQ0ZQhbzaq80p2kwWRIbRU= X-MC-Unique: wzxyT1xyMpGPZDKCIgsUYg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 6/6] nbd: disable signals and forking on Windows builds Date: Wed, 2 Sep 2020 16:54:00 -0500 Message-Id: <20200902215400.2673028-7-eblake@redhat.com> In-Reply-To: <20200902215400.2673028-1-eblake@redhat.com> References: <20200902215400.2673028-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.001 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 17:54:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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: =?UTF-8?q?Daniel=20P=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) From: Daniel P. Berrang=C3=A9 Disabling these parts are sufficient to get the qemu-nbd program compiling in a Windows build. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20200825103850.119911-4-berrange@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- qemu-nbd.c | 5 +++++ meson.build | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index dc6ef089afd5..33476a1000c8 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -899,6 +899,7 @@ int main(int argc, char **argv) #endif if ((device && !verbose) || fork_process) { +#ifndef WIN32 int stderr_fd[2]; pid_t pid; int ret; @@ -962,6 +963,10 @@ int main(int argc, char **argv) */ exit(errors); } +#else /* WIN32 */ + error_report("Unable to fork into background on Windows hosts"); + exit(EXIT_FAILURE); +#endif /* WIN32 */ } if (device !=3D NULL && sockpath =3D=3D NULL) { diff --git a/meson.build b/meson.build index 55c7d2318cdb..5aaa3647305d 100644 --- a/meson.build +++ b/meson.build @@ -1095,12 +1095,9 @@ if have_tools dependencies: [authz, block, crypto, io, qom, qemuutil], inst= all: true) qemu_io =3D executable('qemu-io', files('qemu-io.c'), dependencies: [block, qemuutil], install: true) - qemu_block_tools +=3D [qemu_img, qemu_io] - if targetos !=3D 'windows' - qemu_nbd =3D executable('qemu-nbd', files('qemu-nbd.c'), + qemu_nbd =3D executable('qemu-nbd', files('qemu-nbd.c'), dependencies: [block, qemuutil], install: true) - qemu_block_tools +=3D [qemu_nbd] - endif + qemu_block_tools +=3D [qemu_img, qemu_io, qemu_nbd] subdir('storage-daemon') subdir('contrib/rdmacm-mux') --=20 2.28.0