From patchwork Fri Aug 27 16:50:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raphael Norwitz X-Patchwork-Id: 12462361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BD14C432BE for ; Fri, 27 Aug 2021 16:52:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BB25604D7 for ; Fri, 27 Aug 2021 16:52:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8BB25604D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJf5q-0003k3-Mr for qemu-devel@archiver.kernel.org; Fri, 27 Aug 2021 12:52:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJf43-0002Kb-DX for qemu-devel@nongnu.org; Fri, 27 Aug 2021 12:50:48 -0400 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:49568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJf40-0006Oj-EY for qemu-devel@nongnu.org; Fri, 27 Aug 2021 12:50:47 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17RFpP61006291; Fri, 27 Aug 2021 09:50:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=f3Kwpyo03YMiiV7q/BoojQVsRJZabb97uysPy/GQqd0=; b=ii0lamc4pPsnREXm//n0fqm0kk5Wx+pE87Ygn/UFz1/tYdr/6JA9uafhZFzH9g2kkwXL 0DgoEIBzY2HONmlnI16R7KDNSAv76wrK0PeCeWfiWLqyNTj8SOdVMvn6uZltVOOBUGL+ YTNv8HQ3MZL3ho7YBZi9yYcqpt7SoT3Mc3il3jD6gHuAYHVEpE+bn0+KzD65QVLt/cHW hAxpHq5lTwpIrGfOD8pRK1cfq59d6tLT4rz3sXGsF3i05FRDEyx+Lrml3xNTEPd1Qn2N 2Y4CPWQIwRcMUAS1o7T6zZdaBdh1YG67ON0eEHBkfWi2270GHAWdBUfXRlMfan/gyQGa bQ== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2044.outbound.protection.outlook.com [104.47.74.44] (may be forged)) by mx0a-002c1b01.pphosted.com with ESMTP id 3apusf8xnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Aug 2021 09:50:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=apSlwlsmB1y9Z0DvbZTfGMSPSegv6s76r4t5NMagAqMcurSmq+NEQIZ29R3sQ4zH3GZX9RJoMKzh6EZsxviDZPJVDzwtrjBIi7DuXDufUmvBDAG+RWOULOnhG0v3r0BarWDA19eJWYPEU3P4k8Rui53iBcNqjdtvaNKFIySZLsXBFzspmXL72lERqVpQFvbVcP5nbxa3qU72nhXGjB4vvwL2k5t9fHyFoJeqa6WPqnIv1eReDCk68GLzB3E9BKg72eS2/oR4J3YA/9Q9976CzPJOBij2XdX39BfPGellOCcfCQHky94tuc1wTHrdnE/Eq7s+Iti46e7hj+krtSxZqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f3Kwpyo03YMiiV7q/BoojQVsRJZabb97uysPy/GQqd0=; b=NUM4CYoI/vRPNqs3x9DoDUWQ4Wqz0QcaWDbeys7a8CCHQUY9JuXtUb4oFGZcJ4tsMYSQiY/PaC+bxYozF8q6Vvvq7JWHVD58q8zd3BRKY4w5e52L6Bbyp7If31tWlxizGn8BO8Bre192pGCMdiLNonlKUFnrQ3Mkxe5QTEqvf0u1QmHQc8CWnG6G4CcIr6SIAQW0YCtVm8x891rz7VjPqEL0CeCxSfCvN6qqoCOxaitfMNOoyW59mKSwM2wTsoU2kDoS/chCnLLaqQ3UODWr77OqMGpM9IHzjgevzQb/yYJjriXPP2DLmRlqd14s5/clHEZn+azoJE54mrJxVQmGMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from DM6PR02MB4539.namprd02.prod.outlook.com (2603:10b6:5:2d::12) by DM5PR02MB3717.namprd02.prod.outlook.com (2603:10b6:4:af::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Fri, 27 Aug 2021 16:50:36 +0000 Received: from DM6PR02MB4539.namprd02.prod.outlook.com ([fe80::84d9:8819:4e4d:e73d]) by DM6PR02MB4539.namprd02.prod.outlook.com ([fe80::84d9:8819:4e4d:e73d%5]) with mapi id 15.20.4457.020; Fri, 27 Aug 2021 16:50:35 +0000 From: Raphael Norwitz To: "mst@redhat.com" , "peter.maydell@linaro.org" Subject: [PATCH 1/2] storage-daemon: add opt to print when initialized Thread-Topic: [PATCH 1/2] storage-daemon: add opt to print when initialized Thread-Index: AQHXm2Oo61Tm7fDuAkWMts24tps1Kg== Date: Fri, 27 Aug 2021 16:50:35 +0000 Message-ID: <20210827164954.13951-1-raphael.norwitz@nutanix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.20.1 authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=nutanix.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e54cba8a-4e76-42d1-97c1-08d9697acadb x-ms-traffictypediagnostic: DM5PR02MB3717: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zTTJYAX7n6Ju6EQLyLx7ju/QLXrMDhn9lVdCRa/VsOEVDIvotezYSBOQhjWrro34eXV9Oaj+Vww6bBgaIkvXcKdCKGibm0GFH2AgDiy+AN98sKVMGJDEUka1559C1i4HV5c+q5+tBdlQO+ruQCi33UKkua/yyljHUU1+HCIT0KmcZI8+0dIggTB4+GJgi9Z452RHftLKqZU53AgOm+272y0d6hLdQuI6JvKC1zsxhe29nmpIvxuYK452FCxIq1Blc54LMzQe4YtP/EEO+47wEiUzcRo9RFvZXB7RYb3MJifJ3NS7yXr0TkCzcxn95QVpbA2Lcbszb9t+ivESBqI7yLymAFyjMxlMVprkP3bB0sk+GCow+LoUCNRJVFu33WN8h78ZW9qGfO2WIGAXydIA3cCq335TLkPXHIW4Ut7PfM4PNd1cs4iOczykVHNJguj95UB4vIsK/ZYont1FoNl8w0mE4D1jgZZEpLCiUcATYcCb33wQYbx8ouOqmOhcG9ug7kZitGekmxG33moju1bv42AXiWK7qrcdMLHLWuSUHvQt0gaxw6g8n40vWMGULAxQki+/4jro3dDt+j1RTDXzNKPuqxyehCygjz8mj48PRusuDcRY1FUjZGTdG4KMH74Nu+z7+d/Vi95F8HyJ7Admnv/06Evm4cSQlQthZWzEQ9n7KfgWOkJJsFqjk0c7OqGaJuGYS/QHsii8ALRVgQNa7A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR02MB4539.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(376002)(136003)(39860400002)(366004)(346002)(122000001)(71200400001)(110136005)(64756008)(36756003)(6512007)(66476007)(4326008)(38100700002)(66556008)(26005)(8676002)(107886003)(83380400001)(44832011)(316002)(91956017)(2616005)(478600001)(6506007)(66446008)(38070700005)(66946007)(8936002)(6486002)(86362001)(5660300002)(76116006)(2906002)(186003)(1076003)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?NbihPPl4OjUIDra8Sv2aqCM?= =?iso-8859-1?q?DLSK/IONedijDVszu+rGvUa8H9nAcn+C+nGyH6j9whcFyv7u/jhKgUXXb0V3?= =?iso-8859-1?q?vGdFb+efMbfcRFIWgBf341VLrztbbqKRR7f/SXvX9Wst61J/qBK2Mz2i518V?= =?iso-8859-1?q?p0d5I7rimZANyu/RNGQM60jT1mlF9lJ+0Xh4wT1xfqQUasgZ8fMvaUZTd0L9?= =?iso-8859-1?q?2gFXeln6aV6rf+SjkUCcgwj/yx8OrAYA2XM+zry3VL/dYXxyrUopFAZ/682C?= =?iso-8859-1?q?7ULkkC3z+XHZ0UQSucGWybYNjMRf3p1+I0ym54UFc5gd6j5y699tliswT4Az?= =?iso-8859-1?q?XIQx7PB2A/lKbu0LWtYuFUznnLB6UKd5G4ci2TttLtzH98QXvYxBWlKRRfSm?= =?iso-8859-1?q?67lEozFh85b+g1oTZMrr21D8oZGSFZRPfoKGmLCNaMT0H6u+CnD5HZe6f5Cs?= =?iso-8859-1?q?A2cVAduiOusT7SkltCYXWCBaq9rV27oOCtIltUTya+ju3j2Cqqo1JAUVozAb?= =?iso-8859-1?q?Hr+dh3OusJdlNgAFj+IuiC61ecwTVc17+MrXJwvjedUWewPBG/Wxm4jgWs/f?= =?iso-8859-1?q?dO5/LaEDY8MbjNWCiDSmntULst53boT8ZReQ2a1g2L/UVAkcjM/oXCc4dndA?= =?iso-8859-1?q?eH/hbC0+Tqb5A94ArDk4Gyev51lRByvBPSoAg0GhvhjvgyacwCzw1GqkZAYJ?= =?iso-8859-1?q?rLkm6qCAqsiZAYUUtG1G/+UAcU6AlrUge7yGsQwhP1RyxTeoAr2/ttAGcxdp?= =?iso-8859-1?q?ub0MEaRaKF8WgOdOfoGEwl9jyJ63jvorUDu5+EttxM1T3UpMY++A7p+/rPpo?= =?iso-8859-1?q?hxuaKxV9vZNcQulxjf+qfmEDprtv0HAOkepovmzAM+gtdIrtMIUhUGuZJ2nq?= =?iso-8859-1?q?uTT4hgjhCT5O5Oc2iFhbhkGIfsk0gBUxXNE90NMFZvVdkHsYJXtQhQvTrEF5?= =?iso-8859-1?q?9kUg2LML+umMM+JWeKb+02QHlQrAG7v9e8POg35erDhLS2tp5cjuOrv1UPw8?= =?iso-8859-1?q?LwYhWNU7VS4Ct7nDnNBxFwyGeUApMnHS0RIpSHrCLMvjBluhuf/B3w4bTjF2?= =?iso-8859-1?q?QBhnKIg5T5Q11RkzcQe8dd35X0cVc66YTRnzpD4uIA73GaER47L/51P2yUnF?= =?iso-8859-1?q?5pP0n7xsyP5wRtsZPZMKZxkm1Y8r0Ljgc4aXVq4ssBLIDHYkZpCMc7j8xkRP?= =?iso-8859-1?q?EVRsRwZdON2xWfeitrj+akh1YS84AWxct54K3NYDp6rhEg//n8kiOAtGo+eb?= =?iso-8859-1?q?fef9T1GIerpA/2R3LHrZfd/BBS3yQCvk0RjH9s37XAWKU3oBs8Qg2oIxwFzl?= =?iso-8859-1?q?bQ3fuvvH1hKkJddcSu3lIPgu5LRTNj6FdnCXpAuNX3VflYwowH/Hb8UbvWyq?= =?iso-8859-1?q?drkx1q+zFThzAeR/S1s8VHg=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR02MB4539.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e54cba8a-4e76-42d1-97c1-08d9697acadb X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Aug 2021 16:50:35.9331 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BbFTY4c8FEQe4BE1VSSogSeA15ag0tXuQa6CttiTS9sPGIA8gtpR/DF3KgPRb4TcgVhMwhh5AhkoAI+ra/77TKK5sXBUWHidRu/AwE4/Uog= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3717 X-Proofpoint-ORIG-GUID: u2Clyb1sMcA_isyJhOYyhbZkCVLjUy54 X-Proofpoint-GUID: u2Clyb1sMcA_isyJhOYyhbZkCVLjUy54 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-27_05,2021-08-26_02,2020-04-07_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=raphael.norwitz@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.743, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: "qemu-devel@nongnu.org" , "mreitz@redhat.com" , "stefanha@redhat.com" , "pbonzini@redhat.com" , Raphael Norwitz , "eblake@redhat.com" , "sgarzare@redhat.com" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This change adds a command line option to print a line to standard out when the storage daemon has completed initialization and is ready to serve client connections. This option will be used to resolve a hang in the vhost-user-blk-test. Signed-off-by: Raphael Norwitz --- storage-daemon/qemu-storage-daemon.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c index fc8b150629..c4f76d1564 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -61,6 +61,9 @@ static const char *pid_file; static volatile bool exit_requested = false; +static bool print_setup; + +const char *init_msg = "Block exports setup\n"; void qemu_system_killed(int signal, pid_t pid) { @@ -82,6 +85,7 @@ static void help(void) " -T, --trace [[enable=]][,events=][,file=]\n" " specify tracing options\n" " -V, --version output version information and exit\n" +" -P, --printset print to stdout once server is fully initialized\n" "\n" " --blockdev [driver=][,node-name=][,discard=ignore|unmap]\n" " [,cache.direct=on|off][,cache.no-flush=on|off]\n" @@ -174,6 +178,7 @@ static void process_options(int argc, char *argv[]) {"nbd-server", required_argument, NULL, OPTION_NBD_SERVER}, {"object", required_argument, NULL, OPTION_OBJECT}, {"pidfile", required_argument, NULL, OPTION_PIDFILE}, + {"printset", no_argument, NULL, 'P'}, {"trace", required_argument, NULL, 'T'}, {"version", no_argument, NULL, 'V'}, {0, 0, 0, 0} @@ -195,6 +200,9 @@ static void process_options(int argc, char *argv[]) trace_opt_parse(optarg); trace_init_file(); break; + case 'P': + print_setup = true; + break; case 'V': printf("qemu-storage-daemon version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); @@ -310,6 +318,7 @@ static void pid_file_init(void) int main(int argc, char *argv[]) { + int err; #ifdef CONFIG_POSIX signal(SIGPIPE, SIG_IGN); #endif @@ -341,6 +350,18 @@ int main(int argc, char *argv[]) */ pid_file_init(); + /* + * If requested to pipe output once exports are initialized, print to + * stdout. + */ + if (print_setup) { + err = write(1, init_msg, strlen(init_msg)); + if (err == -1) { + fprintf(stderr, "Write to pipe failed: %m\n"); + return -1; + } + } + while (!exit_requested) { main_loop_wait(false); } From patchwork Fri Aug 27 16:50:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raphael Norwitz X-Patchwork-Id: 12462363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43792C432BE for ; Fri, 27 Aug 2021 16:53:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C73A960EE5 for ; Fri, 27 Aug 2021 16:53:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C73A960EE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:56666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJf6t-0004cp-Oz for qemu-devel@archiver.kernel.org; Fri, 27 Aug 2021 12:53:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJf48-0002Lk-Jb for qemu-devel@nongnu.org; Fri, 27 Aug 2021 12:50:54 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]:51854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJf46-0006Vc-Kw for qemu-devel@nongnu.org; Fri, 27 Aug 2021 12:50:52 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17RDbrJB020321; Fri, 27 Aug 2021 09:50:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=gIC5/Sme10wkVhhuKv8RHZSy/zwxuOzmHPXu3LkdX4Y=; b=t0+DD2Te6qf635qqFI1DRvAaEIlSpOkvIc4PbAea6Eb28oyBZqtHRr5P0fCeMWA3ue64 lYjl6AGQ1d1h5feQ+axdeapGwdHnI7zQHRdW6qM/bmC5ONIdm+VpZZKgBf8XvXdSPXIl anVFKvgXEgTrpf6OCuxPvZOrcm6Sdv5wRJDaD5KWueSQeph7OugNlFas8/83LPrxk6G3 nATGDB2IzNUq2jX5morPCpg1+euSAynSyPaUNVjxb2vqYxuQ/EjkP0aqZP1hnUo2e5G4 OnEsYqnIF8LYRxU+Cd+CnhrWHob3vpGHrQj5cc9GjfJ/hRVTyYTgC+dlxJxsDbg7zN6E OA== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2046.outbound.protection.outlook.com [104.47.74.46]) by mx0b-002c1b01.pphosted.com with ESMTP id 3apsqds78b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Aug 2021 09:50:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ie0t3giAyjUrSd8g7pw7IBVl2Bvg/zVB44Lqbp3QjHN3VVkcgWLFpIwu0vsJUOqWgLTbUZzWKhsrltR2ynHcmp9xc19DThSBML4HLTPC9O4PMzEb8EnoND4APc4QhgKX5fvwDm+fC/YzHjzkB5o8lyPxj4egKdnPM/DTnsAaEmCpxQUUIZM97yJepjxxUJXvJ8o5QEO68aZx2jRqGYxfVsVZyStAmCGLsAUmPFfd/ugUUXV/8Di/lJY6YO1zVB9M3YM1UEb/BgXqFv9Hcxit3qkVMlGoLM2ihCHozRB6yWELdXRMIftTtrORB03xYHo+H024d9YqM8CeSBEV5UzlAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gIC5/Sme10wkVhhuKv8RHZSy/zwxuOzmHPXu3LkdX4Y=; b=VDE9pI9AqjPuI+Q8ednKZS5orDUEwq+vRFZOVLS/43MdB3IGckTffdNHr6xKheh5oAu50kqrB1puyJoXLijFBwHFWUjEboxqZXvexlqKB0dIyJ0jmIAkQYXM1nNv+rK5eYCmYqLncyk8ykKKYC9MglzGzSrhWFj7hHpeCcH7ENTWYyIo3fN77Zam5vEmR2je3V7PBiZxtRgxx1PjBPrEc5AzB6fzzDCxKvvPm7GMiMmX4IauEbGlIhno0EQt67rdjI84gRUog395u5t0bVxuSXaG2lM5tXwGQ733z7wL4ZNM2uNf8KpavBjSGnvVFg5Bl2Y+hn4Rt7DY7RUADqI+8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from DM6PR02MB4539.namprd02.prod.outlook.com (2603:10b6:5:2d::12) by DM5PR02MB3717.namprd02.prod.outlook.com (2603:10b6:4:af::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Fri, 27 Aug 2021 16:50:47 +0000 Received: from DM6PR02MB4539.namprd02.prod.outlook.com ([fe80::84d9:8819:4e4d:e73d]) by DM6PR02MB4539.namprd02.prod.outlook.com ([fe80::84d9:8819:4e4d:e73d%5]) with mapi id 15.20.4457.020; Fri, 27 Aug 2021 16:50:47 +0000 From: Raphael Norwitz To: "mst@redhat.com" , "peter.maydell@linaro.org" Subject: [PATCH 2/2] Prevent vhost-user-blk-test hang Thread-Topic: [PATCH 2/2] Prevent vhost-user-blk-test hang Thread-Index: AQHXm2OvqZ0e2ZotrEG7pS+9OWEqGA== Date: Fri, 27 Aug 2021 16:50:47 +0000 Message-ID: <20210827164954.13951-2-raphael.norwitz@nutanix.com> References: <20210827164954.13951-1-raphael.norwitz@nutanix.com> In-Reply-To: <20210827164954.13951-1-raphael.norwitz@nutanix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.20.1 authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=nutanix.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a40da87f-0b01-4d97-31b7-08d9697ad1b5 x-ms-traffictypediagnostic: DM5PR02MB3717: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:1079; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ux/PhW0F1ofTYAXTYvI4+aGz//je5PT1d31ClEOyprKrMdN+DOZCI3qZZmWdFLY8nKmeLDwWe5Kx1IbxL0Uiyy3ARnedYBlxIBtxonC7KOGyLFRjgvnOIra2gPT0l6mdGJ8mkcN9O6zWkKS4PymX0N7Qw8CmiyGXIX1hTTxQDSPH0N7Nr6lY7U04tGwctSm+0h25ow/PEPv6Trmlcl7TL9H0Uueohoh9WTSfiAnOHgRoHGTK1uL2tVWictO68Nhj/U7G/zpJGgLTIvotNW+mtzxah0XeLCNSG6k/R+Q7KgpRqWWCjb4GF9oSSrc42hTkfhrLCj+5UR9UGsPNPpxwSTV47JWKOWgTPCGQoK7NKYV4cOGWIrpZgi+QHITLMU7k/akQyhrZkyjc322D46t05x+X+O1X7QPvsALUM0lJ5oxePgrByDAGwQ36QjVxe1O/OHxxfrehCiMQF3icj+Hoqx26cxXLIhKNAVkig0PYZ2vtHH0N9eV8m9La9vHGUjqtCQteyr0dwjp96GKPXi01gIAUXSiDS35I8D+5PItOCGc3yUdK8e35tUaO2k4QxLRHrHr7Hb9Uqdd7JhxpmMvkOIUTJEnmwVNgv4U3j39aFLfFSedQfkmYH0C8deVvWarBH/T65uwJtc6ntjYL+6bs3A+33q0PJN+RznddVDHLDuRaCZBkE51U3A+QxTii1a90WON8Bd53BlL4sYpiGvmmep5yG2iz7gPz8BSQDXCw1vwlI+gbWHfGY5dNKRGYudHkJ5Cmytz+SkYZPtUwNn3+y68VZa1AaZfiLWfBBr8922k= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR02MB4539.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(376002)(136003)(39860400002)(366004)(346002)(122000001)(71200400001)(110136005)(64756008)(36756003)(6512007)(66476007)(4326008)(38100700002)(66556008)(26005)(8676002)(107886003)(83380400001)(44832011)(316002)(91956017)(2616005)(478600001)(6506007)(66446008)(38070700005)(66946007)(8936002)(6486002)(86362001)(966005)(5660300002)(76116006)(2906002)(186003)(1076003)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?J5zUNXUM0zmrDnji25b4ndV?= =?iso-8859-1?q?Pz0LKyHRMzAgKE8IoXNZ6ReyoMdokUBLIYBgoR2dIb2MLsUtKTGYmS+QH5NF?= =?iso-8859-1?q?JB0OHIVPEA7zkBx5IGS6zja2s001hW54eyCOTygDK9kuOBbtElIe+g/LraEX?= =?iso-8859-1?q?6OJHfgAnZ5dvxNtyQl8M1FIxsF2fvoE2rCgr+3hsoWIEnH61m13SNojTEczK?= =?iso-8859-1?q?yXJDYdgyIr1NXenf8ss8NCR9IKfO/CNOCU1qZj/Bo8JB102N0rVj29e9Ti0Y?= =?iso-8859-1?q?Te+GJjp+Z1jONTtPnjfcQjH1IndLN8nRCzTdWCOgoTNS49UfmwnosvvHQsxt?= =?iso-8859-1?q?IDO+o+YSS1Bm3qNtEHAZsSJapirGJBTDsE1w4oe0Gs/rcYJbaY6KMoK6++25?= =?iso-8859-1?q?235NAHVwpVr4mtsM128XyOLLvAag5SPp6P1sQMlFuwiGHJ6/gGvLzlmDCSVY?= =?iso-8859-1?q?a++1VVckPlWVs/6jgcJEah/0l+E3yR00jDg/CjSzbioucPmKKiTSznl1n2sM?= =?iso-8859-1?q?EBbFcMBdKMKkzm7BUKbqN1jLI6hyuhgFRkYNTJ3KHAoPzlBTgW2GNZtxUIf/?= =?iso-8859-1?q?1Fyv2qn1wXmdMPOd5x9axb/DRLkZrd0CMVoOYyISlerWj+QxG7Vu7eewZjaY?= =?iso-8859-1?q?fNL4t0s46NzkeJXUUWAS9t+jR4MDCYId84bd86TkI+soXuqiwu6aUggcjPGx?= =?iso-8859-1?q?pqJBgBA5moFvQ0hkdoduF93cej7r9x9R+pz0nxi6cIIfATROqN8K7RaMXh00?= =?iso-8859-1?q?tsEJILbb7qf5oAxUZnQI6ryY05TkcwiSZlKRsHLAo3X/gvSrpWd3DDbcnE8b?= =?iso-8859-1?q?hBGTImR6hT1/DFgTsXNvTjZ4lx+308oEWWNySZW8eHwH7L5EArcj46daRNAb?= =?iso-8859-1?q?pSbJGghY2xBVOF8ht0PPw/JnuIKnGqnnkAINPUFPBoEYzHTLIFCdcZQnVuvp?= =?iso-8859-1?q?Aey/YODolSoOY/X/NJVBGEnPv7yJXc+x2duFmoJHVoz/n7Cs2+Hxk2LFh3sl?= =?iso-8859-1?q?r57iX/qTc+4Py/lakemsPx4lVEqLdcoVeiacqfeDR7luAfxBPdiLxyUVwJcC?= =?iso-8859-1?q?q3IRO5dRg6i4vPK6OdYILDMNR3zfAR97XweTVzJt5ePfioM8TU8NKKOUgr8l?= =?iso-8859-1?q?V7arTaynA8YQQfv9OOHgprbPsupy7ApihaOk+gFl9VKBDyD6aSK5mUDULeGA?= =?iso-8859-1?q?xsBTdy4kX24NeVV3Mcqp452LKDIvFqsrby2NDKWzd3eJsDu+7MVOLrKcHYw+?= =?iso-8859-1?q?Vc1pz3PvC/YgcmKy4ck2DMVbQf2siJl4DywEKHI3hPoIBMenLcQqxR+uAH/O?= =?iso-8859-1?q?0E5DaE/q5n3g9y13Dw9XNERjd5NgK+YCFeXUEnoGIs3l1FA5HZwW1lEDfzOU?= =?iso-8859-1?q?E?= MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR02MB4539.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a40da87f-0b01-4d97-31b7-08d9697ad1b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Aug 2021 16:50:47.3686 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EEn3TPak5tUTg29ZAHzodWwCWVR+UaDbQhoLGNaMybITcBHrKQmX0qojlw6UN6MOq/P2SMoOvmg0AMv583oi4sIRA/HAMcqZg9mYPfYsFe8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3717 X-Proofpoint-ORIG-GUID: xTtkJGAeIh-cf1-GY_jUQkBSEpuHbhgm X-Proofpoint-GUID: xTtkJGAeIh-cf1-GY_jUQkBSEpuHbhgm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-27_05,2021-08-26_02,2020-04-07_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=raphael.norwitz@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.743, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: "qemu-devel@nongnu.org" , "mreitz@redhat.com" , "stefanha@redhat.com" , "pbonzini@redhat.com" , Raphael Norwitz , "eblake@redhat.com" , "sgarzare@redhat.com" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" In the vhost-user-blk-test, as of now there is nothing stoping vhost-user-blk in QEMU writing to the socket right after forking off the storage daemon before it has a chance to come up properly, leaving the test hanging forever. This intermittently hanging test has caused QEMU automation failures reported multiple times on the mailing list [1]. This change makes the storage-daemon notify the vhost-user-blk-test that it is fully initialized and ready to handle client connections via a pipefd before allowing the test to proceed. This ensures that the storage-daemon backend won't miss vhost-user messages and thereby resolves the hang. [1] https://lore.kernel.org/qemu-devel/CAFEAcA8kYpz9LiPNxnWJAPSjc=nv532bEdyfynaBeMeohqBp3A@mail.gmail.com/ Signed-off-by: Raphael Norwitz --- tests/qtest/vhost-user-blk-test.c | 33 ++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 6f108a1b62..b62af449df 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -21,6 +21,8 @@ #include "libqos/vhost-user-blk.h" #include "libqos/libqos-pc.h" +const char *daemon_msg = "Block exports setup\n"; + #define TEST_IMAGE_SIZE (64 * 1024 * 1024) #define QVIRTIO_BLK_TIMEOUT_US (30 * 1000 * 1000) #define PCI_SLOT_HP 0x06 @@ -885,7 +887,8 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, int num_queues) { const char *vhost_user_blk_bin = qtest_qemu_storage_daemon_binary(); - int i; + int i, err, pipe_fds[2]; + char buf[32] = {0}; gchar *img_path; GString *storage_daemon_command = g_string_new(NULL); QemuStorageDaemonState *qsd; @@ -898,6 +901,12 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, " -object memory-backend-memfd,id=mem,size=256M,share=on " " -M memory-backend=mem -m 256M "); + err = pipe(pipe_fds); + if (err != 0) { + fprintf(stderr, "start_vhost_user_blk: pipe() failed %m\n"); + abort(); + } + for (i = 0; i < vus_instances; i++) { int fd; char *sock_path = create_listen_socket(&fd); @@ -914,22 +923,40 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, i + 1, sock_path); } + g_string_append_printf(storage_daemon_command, "--printset"); + g_test_message("starting vhost-user backend: %s", storage_daemon_command->str); + pid_t pid = fork(); if (pid == 0) { + close(pipe_fds[0]); + /* * Close standard file descriptors so tap-driver.pl pipe detects when * our parent terminates. */ close(0); - close(1); open("/dev/null", O_RDONLY); - open("/dev/null", O_WRONLY); + close(1); + dup2(pipe_fds[1], 1); execlp("/bin/sh", "sh", "-c", storage_daemon_command->str, NULL); exit(1); } + + close(pipe_fds[1]); + + err = read(pipe_fds[0], buf, 20); + if (err < 0) { + fprintf(stderr, "Failed to read from storage-daemon pipe %m\n"); + abort(); + } else if (strcmp(buf, daemon_msg) != 0) { + fprintf(stderr, "qemu-storage-daemon did not write expected messaage " + "to the pipe. Total bytes read: %d. Got: %s\n", err, buf); + abort(); + } + g_string_free(storage_daemon_command, true); qsd = g_new(QemuStorageDaemonState, 1);