From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622051849; cv=none; d=zohomail.com; s=zohoarc; b=neJtAFLCzxoAJQYYswz9S7sEQxZbjw5PhuN0Q8jUKQDeJ+C4m92Tnnj/NZvh85NkM2CEXSQpYvgBtStYxAQnbTvIX7EXmT6cOGMxy0KWmq1Wj/eyXke1buTlLBXDllGhI9qwjeyNVFYVpRfeoQnOJ9VSSU9AVRpFz9fkyPzsa3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622051849; 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=gTpWvv9zmttSq7SR+21M+c7fZ5YeaV4iOciTybmKbWU=; b=KOHQXAuKdxoDgB4t1uJEcFAJqEYAXYVSrmz/6rNFpzmZzMj05hQhpQ2OMW+3wA00pbTGRlOvICc6it0trlpAHkxrRXaZ6C6u+m3q97/1l9SlELnpDtkeOviFqeQMmrpA7rP6yZjDCrkK1hu3dXJD+CSXEyhLGyR3JIDoBBTI1Wk= 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+importer2=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 1622051848999524.9413712534207; Wed, 26 May 2021 10:57:28 -0700 (PDT) Received: from localhost ([::1]:53922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxmZ-0007Kj-V0 for importer2@patchew.org; Wed, 26 May 2021 13:57:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxba-0003PW-FL for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbU-0008J9-Lc for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:04 -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-192-kiO_R5vjNNiZmVsMD2OZoA-1; Wed, 26 May 2021 13:45:56 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D71F91005D53; Wed, 26 May 2021 17:45:55 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63F655D9C6; Wed, 26 May 2021 17:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051158; 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=gTpWvv9zmttSq7SR+21M+c7fZ5YeaV4iOciTybmKbWU=; b=LSp2/b7IqhZB9U4oqD/7QR8EWLhnnzfoYaGR6xDhqk7GDqqaeqpMAnl0wLzn5edTOM5zIL YziQR0hb8L89FxliigKlKHW1bOpkIT249wTEzzzrLOvGWgDrbX3MQFw2eSuI5YUKiDJaCG da9hy4w3zMXkRpP2c/bNzzrClucxSEE= X-MC-Unique: kiO_R5vjNNiZmVsMD2OZoA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 01/15] hmp: Fix loadvm to resume the VM on success instead of failure Date: Wed, 26 May 2021 18:45:26 +0100 Message-Id: <20210526174540.290588-2-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Kevin Wolf Commit f61fe11aa6f broke hmp_loadvm() by adding an incorrect negation when converting from 0/-errno return values to a bool value. The result is that loadvm resumes the VM now if it failed and keeps it stopped if it failed. Fix it to restore the old behaviour and do it the other way around. Fixes: f61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854 Cc: qemu-stable@nongnu.org Reported-by: Yanhui Ma Signed-off-by: Kevin Wolf Message-Id: <20210511163151.45167-1-kwolf@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- monitor/hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d9bef63373..d10ee14110 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1133,7 +1133,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) =20 vm_stop(RUN_STATE_RESTORE_VM); =20 - if (!load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running)= { + if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) { vm_start(); } hmp_handle_error(mon, err); --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052160; cv=none; d=zohomail.com; s=zohoarc; b=cDmqCQhmvLfkMjC9y+MWu64h5eNpWEbOlt7UHm7MLvrndZiUrThlAur/FGTuqYCmEtAW3eX173HBEDG7FiD3Dqi6s/0hWWgZjVl40035fUJInPROSWYZeQp7ne8Lu6R5CEFL09LkZj8apZFtne8WhqVuVogHqFcS6vK1Z6y211Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052160; 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=yBKh3cXcUuLqVYMfMYNZf35c7b50Z71DUrkEHsccM9A=; b=fsHQb6IV1rgyGNBv/gEyornfdR2/YbZBNnGPu8l7TmKKjM4yQLDjRWk6l4RtLqQDDUQSH0bleX1pvJG3XsZRRFgeL6KDrJ4JpJsrqb7CPNWFXewvxp/D4uhtFJCoC0P/jS8AdXoLSYY1cv1pYBhWFF4/WDJKGeqzpEZLNSche2E= 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+importer2=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 1622052160766921.8888557845281; Wed, 26 May 2021 11:02:40 -0700 (PDT) Received: from localhost ([::1]:34306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxrb-0004oF-Br for importer2@patchew.org; Wed, 26 May 2021 14:02:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbb-0003Pe-Rx for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbV-0008KM-Q1 for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:07 -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-316-BsobCquiNpCle0bM51kaQw-1; Wed, 26 May 2021 13:45:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2F3C1005D50; Wed, 26 May 2021 17:45:57 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 330C25D9C6; Wed, 26 May 2021 17:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051160; 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=yBKh3cXcUuLqVYMfMYNZf35c7b50Z71DUrkEHsccM9A=; b=TkmaMfdzcDSldGS2+jzeo4EMDLQg51QmGehjte9XAkYAHu7lasoUp1V8/8EMF1GnuF/MJX FHKY51E5RE/en5Bq9vW/q9QxAHsoXapoZ+uCcs2W3ar7UTrDAVQqYBy5j5Hfn9aa0M24jI UoCg1g/UUuVkuM/vSqDl3GuetXt7bfE= X-MC-Unique: BsobCquiNpCle0bM51kaQw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 02/15] virtiofsd: Check for EINTR in preadv() and retry Date: Wed, 26 May 2021 18:45:27 +0100 Message-Id: <20210526174540.290588-3-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal We don't seem to check for EINTR and retry. There are other places in code where we check for EINTR. So lets add a check. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-2-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 9efdbd8ffd..755d7fb25c 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -421,6 +421,9 @@ int virtio_send_data_iov(struct fuse_session *se, struc= t fuse_chan *ch, =20 if (ret =3D=3D -1) { ret =3D errno; + if (ret =3D=3D EINTR) { + continue; + } fuse_log(FUSE_LOG_DEBUG, "%s: preadv failed (%m) len=3D%zd\n", __func__, len); goto err; --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052485; cv=none; d=zohomail.com; s=zohoarc; b=CzZ/IwK31mcRwNqVsHmyedfZndSLwUgoFRtDiGGqumuF/b6/6k13mkIXYrDBvyduCawMKavZ+ZaZQL+zojF0GzfbpoLSPMcHe57zoHMmYruSB+LWqb9ZOxGMZEiZ/XUiYG4cHfGDBpu55mye/gZsSwaRpDXajIC2pSJ6KJvCknw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052485; 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=4cTVrU/0Ut8Mmumhr56B+hqG65B+t5xkN9u3oUXZ2y8=; b=Nf/fPhjVCKPIZbQfj6jTLuroTyaEp1y7IqIVI+GT8Kbs7QoDb8600TFeMDRNcRfaMJxB++RA0A3ie2AqiCb+Cqu/U3ODVidSrqtSDrP6s1+GWeEZRD73RDeRTWUhimBBNVn2jOZ63l1FtvfgFqdJkpxgi+LCGw6GQ4JbL7mKNDQ= 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+importer2=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 1622052485402190.3815108544685; Wed, 26 May 2021 11:08:05 -0700 (PDT) Received: from localhost ([::1]:42884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxwq-0002Ne-3n for importer2@patchew.org; Wed, 26 May 2021 14:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbc-0003Pg-MI for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbY-0008L8-3n for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:08 -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-12-Nbn37GrSOw60bk_0U_H_NA-1; Wed, 26 May 2021 13:46:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72F2D501E0; Wed, 26 May 2021 17:45:59 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDF1A5D9C6; Wed, 26 May 2021 17:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051163; 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=4cTVrU/0Ut8Mmumhr56B+hqG65B+t5xkN9u3oUXZ2y8=; b=gClOXpUCo4aFhDRfzqAlwiaWHYhPzb44Vioz7+k+eKlySLXR6ztqwayObP207Q7XpZsTKc MGsZa6u436rnyUxyowYFCsNvRoRmeMr3jkI/BGI+jWvslz0lt6pguwavKWCEft5SNWWdeo nKnp36NIFTCwmGwMVSOwanusv/Q9Fpc= X-MC-Unique: Nbn37GrSOw60bk_0U_H_NA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 03/15] virtiofsd: Get rid of unreachable code in read Date: Wed, 26 May 2021 18:45:28 +0100 Message-Id: <20210526174540.290588-4-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal pvreadv() can return following. - error - 0 in case of EOF - short read We seem to handle all the cases already. We are retrying read in case of short read. So another check for short read seems like dead code. Get rid of it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-3-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 755d7fb25c..28e2974d1a 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -446,11 +446,6 @@ int virtio_send_data_iov(struct fuse_session *se, stru= ct fuse_chan *ch, in_sg_left); break; } - if (ret !=3D len) { - fuse_log(FUSE_LOG_DEBUG, "%s: ret!=3Dlen\n", __func__); - ret =3D EIO; - goto err; - } in_sg_left -=3D ret; len -=3D ret; } while (in_sg_left); --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052497; cv=none; d=zohomail.com; s=zohoarc; b=FWONZkzoJqa4m70Fm4AvqrWKuN5Lxb326nY6TorlllgCfro3itDoMJ/zyV5YP4q0ZSTH6UQy1+WoGLOpIhpYJbHRI7fE/4vm0kANuGWfatGMYHWAT7vcsRtQOfSPx6ixuACuyXgeYMyoWwPQcCIGKbPjlWILm9UWaUZ/V3OPoMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052497; 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=PdE/bGQQSl3DZDjFaA81y3HI3JSSuNV6pjhr/qsG2AQ=; b=I9OjI/IUe/eHjs7xMRH2I37RyHJWQbiFnThK1pfwMkQ8RVsKABFrEmUKP/D77nLoDj5rSnIGd1jz8G+dxUwq+6S/h+SSBngqsTFCzMi7vE2sgNoMgOh99+KnS8Dk5quacylQgxk23mO8fnJWilH/Y+L4hHn2EQCIEvQOaSXRVqk= 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+importer2=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 1622052497184935.5823279145745; Wed, 26 May 2021 11:08:17 -0700 (PDT) Received: from localhost ([::1]:44176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxx2-0003JY-5j for importer2@patchew.org; Wed, 26 May 2021 14:08:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbk-0003RI-Sl for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37082) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxba-0008LG-7G for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46: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-505-Z5ApxgYkNrWnZCAbEp3IAA-1; Wed, 26 May 2021 13:46:02 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33C3B8015F5; Wed, 26 May 2021 17:46:01 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id B308E5D9C6; Wed, 26 May 2021 17:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051164; 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=PdE/bGQQSl3DZDjFaA81y3HI3JSSuNV6pjhr/qsG2AQ=; b=CZfNNo2gxXG3Ne3GIbD+mPXGVH5GkWacekjcydHXr+TNNn7aUYz3o8XRIMl3Py6uRTU13L Y3Tdw/4IH02h9u1nPh/AldGnzp3hYJZZEtULrmpdHXKS6KdDYqlNgb53L7rFSq+yYayK+L ch8Jw+L6fIQpopHYKcAiApuR5nlp/4c= X-MC-Unique: Z5ApxgYkNrWnZCAbEp3IAA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 04/15] virtiofsd: Use iov_discard_front() to skip bytes Date: Wed, 26 May 2021 18:45:29 +0100 Message-Id: <20210526174540.290588-5-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal There are places where we need to skip few bytes from front of the iovec array. We have our own custom code for that. Looks like iov_discard_front() can do same thing. So use that helper instead. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-4-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 28e2974d1a..09674f2e90 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -389,23 +389,15 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, memcpy(in_sg_cpy, in_sg, sizeof(struct iovec) * in_num); /* These get updated as we skip */ struct iovec *in_sg_ptr =3D in_sg_cpy; - int in_sg_cpy_count =3D in_num; + unsigned int in_sg_cpy_count =3D in_num; =20 /* skip over parts of in_sg that contained the header iov */ size_t skip_size =3D iov_len; =20 size_t in_sg_left =3D 0; do { - while (skip_size !=3D 0 && in_sg_cpy_count) { - if (skip_size >=3D in_sg_ptr[0].iov_len) { - skip_size -=3D in_sg_ptr[0].iov_len; - in_sg_ptr++; - in_sg_cpy_count--; - } else { - in_sg_ptr[0].iov_len -=3D skip_size; - in_sg_ptr[0].iov_base +=3D skip_size; - break; - } + if (skip_size !=3D 0) { + iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, skip_size); } =20 int i; --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052174; cv=none; d=zohomail.com; s=zohoarc; b=IPZsKb5xxf95PSoXG0s2e4kGWPxZ3IxUsL8uKpiVLMzE/3293ksMirIhJAIl9NMx7a3Lm25J8lgJ9gE70t6jCCC2B3d5Vbs/fk/mfMsDkZDHbbzGHdF9GBBqMiAAjHntE19jIcLojaU5z9CmPx5rMaPC8LONwbCnT6QMSIocOV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052174; 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=txuh2On61R7/jFWdy+8AOQtaIWfHlKo8LJdr7swPFwI=; b=RUKtpOJu6UJR9I7NFFM4h5zxdsiUIEpSjMSp9pRxK3nVnJK6l0olhKfgBFq3ceNgKzLaOTUSOdZMWsM4A6OIStagl+ANL8Zy6boYJljbDWuAwS9XJHxjRjme1kTczO3tq1ETFCf5ix0aPSqACbkEe9OjrlfPQMv98WfbC/LkodA= 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+importer2=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 162205217453421.076966120224824; Wed, 26 May 2021 11:02:54 -0700 (PDT) Received: from localhost ([::1]:35454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxrp-0005bK-D2 for importer2@patchew.org; Wed, 26 May 2021 14:02:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbg-0003QR-EX for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbe-0008PM-5s for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:12 -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-595-9Eq7z4FiM2aVwDZeqoEVsg-1; Wed, 26 May 2021 13:46:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3968E180FD62; Wed, 26 May 2021 17:46:06 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DF305D9C6; Wed, 26 May 2021 17:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051169; 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=txuh2On61R7/jFWdy+8AOQtaIWfHlKo8LJdr7swPFwI=; b=G6djVJTP6j+U7u+wGbnRIm3pkWABZCWN9gKqQ9jssEfG5rsza8env6SgQAmuKKr8i0+ehF E0iQjVVGBV+JkYWsxcfTiToS+K3dssRWQAG61Y5JnnGsUdPmII1XpRuNHnHX6+ggzwloJq oNPNi0fgy95sLorfu0erajzSJNnAwkk= X-MC-Unique: 9Eq7z4FiM2aVwDZeqoEVsg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 05/15] virtiofsd: get rid of in_sg_left variable Date: Wed, 26 May 2021 18:45:30 +0100 Message-Id: <20210526174540.290588-6-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal in_sg_left seems to be being used primarly for debugging purpose. It is keeping track of how many bytes are left in the scatter list we are reading into. We already have another variable "len" which keeps track how many bytes are left to be read. And in_sg_left is greater than or equal to len. We have already ensured that in the beginning of function. if (in_len < tosend_len) { fuse_log(FUSE_LOG_ERR, "%s: elem %d too small for data len %zd\n", __func__, elem->index, tosend_len); ret =3D E2BIG; goto err; } So in_sg_left seems like a redundant variable. It probably was useful for debugging when code was being developed. Get rid of it. It helps simplify this function. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-5-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 09674f2e90..ed5146d7a6 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -394,20 +394,16 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, /* skip over parts of in_sg that contained the header iov */ size_t skip_size =3D iov_len; =20 - size_t in_sg_left =3D 0; do { if (skip_size !=3D 0) { iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, skip_size); } =20 - int i; - for (i =3D 0, in_sg_left =3D 0; i < in_sg_cpy_count; i++) { - in_sg_left +=3D in_sg_ptr[i].iov_len; - } fuse_log(FUSE_LOG_DEBUG, "%s: after skip skip_size=3D%zd in_sg_cpy_count=3D%d " - "in_sg_left=3D%zd\n", - __func__, skip_size, in_sg_cpy_count, in_sg_left); + "len remaining=3D%zd\n", __func__, skip_size, in_sg_cpy_c= ount, + len); + ret =3D preadv(buf->buf[0].fd, in_sg_ptr, in_sg_cpy_count, buf->buf[0].pos); =20 @@ -434,13 +430,12 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, } if (!ret) { /* EOF case? */ - fuse_log(FUSE_LOG_DEBUG, "%s: !ret in_sg_left=3D%zd\n", __func= __, - in_sg_left); + fuse_log(FUSE_LOG_DEBUG, "%s: !ret len remaining=3D%zd\n", __f= unc__, + len); break; } - in_sg_left -=3D ret; len -=3D ret; - } while (in_sg_left); + } while (len); =20 /* Need to fix out->len on EOF */ if (len) { --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052817; cv=none; d=zohomail.com; s=zohoarc; b=XgQQNPzaPo0gE6u5xQzr7X9l8xrXwE4K8ADp4f1FCpMj2hU8Gt4T6kfM9J4KxF1dBbA+1e50Lr7mqqwlnxzwSLjvai72ayCo/OI5EERK15GNXKgrQSx9QIfVZVwIf8kHqVAV5UqqMtrtbj/rHfStnG2yxgDlcu++9J4c4xIJbKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052817; 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=8/ZCBza/TJxM/WPXTdZDWfK95h1Zn3I9JZbEie5sy1c=; b=GOKc4chQU3EPzV3PJ+XUPITh+R+CMfW96ErpQEZitpnUQnQiobnJKM5sEhP51rDcJnqq2ujhjmeiQrh3iXQlc3psUDxHfcVb+UnonR/JCzgP6pnqjGcaZS0YVrRFqO5dGMtw6fU8NSRON1QpBwBf97L62UuDuRwTHMMzjILQseo= 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+importer2=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 1622052817175147.1340593668216; Wed, 26 May 2021 11:13:37 -0700 (PDT) Received: from localhost ([::1]:52588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lly2B-0000iO-US for importer2@patchew.org; Wed, 26 May 2021 14:13:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbs-0003Zy-4B for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbm-0008Tu-93 for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:23 -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-10-HA2vlz3zMgOvMwnce_I1bw-1; Wed, 26 May 2021 13:46:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C80A1005D55; Wed, 26 May 2021 17:46:14 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 834885D9C6; Wed, 26 May 2021 17:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051177; 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=8/ZCBza/TJxM/WPXTdZDWfK95h1Zn3I9JZbEie5sy1c=; b=VT6pJVlGWwf+nx3ay9d5ZDdCuLGJ8cGZ2m9lE6KGSHcX2VMXkKA/oTOvhaFBt2nGCRF7+E hxmKA+iVmdN+YaCEIHQqH9BnfxHmrTyCvfsB226NcGrwSvGmfSzWIK9V7G+F5Q2eT6Jz52 GDn9/0/76b4wo9DfYlrEIIfeJIAsG9o= X-MC-Unique: HA2vlz3zMgOvMwnce_I1bw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 06/15] virtiofsd: Simplify skip byte logic Date: Wed, 26 May 2021 18:45:31 +0100 Message-Id: <20210526174540.290588-7-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal We need to skip bytes in two cases. a. Before we start reading into in_sg, we need to skip iov_len bytes in the beginning which typically will have fuse_out_header. b. If preadv() does a short read, then we need to retry preadv() with remainig bytes and skip the bytes preadv() read in short read. For case a, there is no reason that skipping logic be inside the while loop. Move it outside. And only retain logic "b" inside while loop. Also get rid of variable "skip_size". Looks like we can do without it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-6-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index ed5146d7a6..49c7dd788a 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -392,17 +392,11 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, unsigned int in_sg_cpy_count =3D in_num; =20 /* skip over parts of in_sg that contained the header iov */ - size_t skip_size =3D iov_len; + iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, iov_len); =20 do { - if (skip_size !=3D 0) { - iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, skip_size); - } - - fuse_log(FUSE_LOG_DEBUG, - "%s: after skip skip_size=3D%zd in_sg_cpy_count=3D%d " - "len remaining=3D%zd\n", __func__, skip_size, in_sg_cpy_c= ount, - len); + fuse_log(FUSE_LOG_DEBUG, "%s: in_sg_cpy_count=3D%d len remaining= =3D%zd\n", + __func__, in_sg_cpy_count, len); =20 ret =3D preadv(buf->buf[0].fd, in_sg_ptr, in_sg_cpy_count, buf->buf[0].pos); @@ -421,7 +415,7 @@ int virtio_send_data_iov(struct fuse_session *se, struc= t fuse_chan *ch, if (ret < len && ret) { fuse_log(FUSE_LOG_DEBUG, "%s: ret < len\n", __func__); /* Skip over this much next time around */ - skip_size =3D ret; + iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, ret); buf->buf[0].pos +=3D ret; len -=3D ret; =20 --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622051903; cv=none; d=zohomail.com; s=zohoarc; b=K91UcOVuEqOtVEtei0X/NX0sWM61oPtFVqNgH/fMk5p864ebQL6EYQbSYVU+Lz5/WXrW2nRHC/XGBaPugMlX3E2EUTl8sSe1hEwZrwH/d20VyS+Floh0dDd3HAo16sQx+WlwwOGn92mfyDoWv5+qVV48Zx6wgClPVU4hUxK58Pw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622051903; 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=qOocFvEvqJcdd0cWu32y0PajuPJNFF2c268KUXyAJG0=; b=FMHjo4aswc6N8PxeuKNLJsIdSN32uLSgrpor9Q4pHiuqWJLhcQsj4m4CjYapTc2qwaCVlpsHTIcviO71FbcpVejYooVeOHNDF3y/f8TWIJN4++isEglaUa1pipS10xp/VRwkpkX0KVjGLejBg5ouioZ29+g9zdo+mDPrY/QGZpg= 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+importer2=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 162205190301672.62900305111316; Wed, 26 May 2021 10:58:23 -0700 (PDT) Received: from localhost ([::1]:56620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxnQ-0000iH-KU for importer2@patchew.org; Wed, 26 May 2021 13:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbz-0003ch-6B for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbr-000056-7g for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:30 -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-336-2yZ_TlGuOi-ZAomEwDvvKw-1; Wed, 26 May 2021 13:46:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 368C0107ACCA; Wed, 26 May 2021 17:46:16 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id B60965D9C6; Wed, 26 May 2021 17:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051182; 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=qOocFvEvqJcdd0cWu32y0PajuPJNFF2c268KUXyAJG0=; b=DJ0tj1fXCCorDuh50FaA2zbqupmqn7oE8XQo5J0UFyUX37cCoyTIsqBW86nkSL/MGWAohg DUJ6L938APPqv1GF9NZi3HO2auEkOe8gjkHOUt+dHkPoco7UaCJNlb96CE+wa7jkrZUQ29 2odfxJ+51UrhRiX+uZMe8xEGxtdjvdQ= X-MC-Unique: 2yZ_TlGuOi-ZAomEwDvvKw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 07/15] virtiofsd: Check EOF before short read Date: Wed, 26 May 2021 18:45:32 +0100 Message-Id: <20210526174540.290588-8-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal In virtio_send_data_iov() we are checking first for short read and then EOF condition. Change the order. Basically check for error and EOF first and last remaining piece is short ready which will lead to retry automatically at the end of while loop. Just that it is little simpler to read to the code. There is no need to call "continue" and also one less call of "len-=3Dret". Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-7-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 49c7dd788a..99f91c9d87 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -410,25 +410,24 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, __func__, len); goto err; } - fuse_log(FUSE_LOG_DEBUG, "%s: preadv ret=3D%d len=3D%zd\n", __func= __, - ret, len); - if (ret < len && ret) { - fuse_log(FUSE_LOG_DEBUG, "%s: ret < len\n", __func__); - /* Skip over this much next time around */ - iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, ret); - buf->buf[0].pos +=3D ret; - len -=3D ret; =20 - /* Lets do another read */ - continue; - } if (!ret) { /* EOF case? */ fuse_log(FUSE_LOG_DEBUG, "%s: !ret len remaining=3D%zd\n", __f= unc__, len); break; } + fuse_log(FUSE_LOG_DEBUG, "%s: preadv ret=3D%d len=3D%zd\n", __func= __, + ret, len); + len -=3D ret; + /* Short read. Retry reading remaining bytes */ + if (len) { + fuse_log(FUSE_LOG_DEBUG, "%s: ret < len\n", __func__); + /* Skip over this much next time around */ + iov_discard_front(&in_sg_ptr, &in_sg_cpy_count, ret); + buf->buf[0].pos +=3D ret; + } } while (len); =20 /* Need to fix out->len on EOF */ --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622051691; cv=none; d=zohomail.com; s=zohoarc; b=E4db6ILcg6Y96WiyzlzmolIJSBwPo+IJDZvNyZaA15jgpR/0q8vrHA6wbQHlk1SvVZOlJqaxCxoJnBJjJf6ahLNriTBmTx5gouee/BJB5HIcfe/JhvTjLSyWn3Qe5ph4U2+8rkmpw3uwnTFQQTAqd/0mn3BhaSTaSjW5lz65XiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622051691; 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=i6rz5HBN2dmYr60coRtD/oGKZ6NDDOZNIlmm43gAxQo=; b=R9JTEbqlc5IghbCqWfz5V42wJq3hzk+R+RSbMU3Wke7kOWSQLumHyiGTLNb5LYyORDeP98HcfCrv+INObQ0aEpp8SN3lsYOCC8isos/KH9zSGSZKkcTcM8fbKCvvrsJIHNDvhFT5+lAzQmNGMMmf9qpErk+GdZQyhA2qYb81mLU= 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+importer2=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 1622051691309686.7860480942686; Wed, 26 May 2021 10:54:51 -0700 (PDT) Received: from localhost ([::1]:48702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxk1-0003dg-VJ for importer2@patchew.org; Wed, 26 May 2021 13:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbw-0003bZ-TD for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48645) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbp-0008VW-Os for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:25 -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-284-coXIk_KjPSWTL_VeONGqoQ-1; Wed, 26 May 2021 13:46:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3DE3501F0; Wed, 26 May 2021 17:46:17 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8289B5D9C6; Wed, 26 May 2021 17:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051181; 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=i6rz5HBN2dmYr60coRtD/oGKZ6NDDOZNIlmm43gAxQo=; b=FDC1TNK1Bg+E6aDwLuwLt+A0wRfDe7fpUjWgXkefkit3ne+FTgCdrR7id4KkG00vEZu7mx a2fv7D+ikbK2AEnajAwIhpPu9n0JshyzrAQM/00ZZiCHA83O1bXTTrN1OLFM7TwBo+GEe0 C4OsCmpliSrOxaQUzStsBEAAQeXuEZ4= X-MC-Unique: coXIk_KjPSWTL_VeONGqoQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 08/15] virtiofsd: Set req->reply_sent right after sending reply Date: Wed, 26 May 2021 18:45:33 +0100 Message-Id: <20210526174540.290588-9-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vivek Goyal There is no reason to set it in label "err". We should be able to set it right after sending reply. It is easier to read. Also got rid of label "err" because now only thing it was doing was return a code. We can return from the error location itself and no need to first jump to label "err". Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Vivek Goyal Message-Id: <20210518213538.693422-8-vgoyal@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 99f91c9d87..fa4aff9b0e 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -366,14 +366,12 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, if (in_len < sizeof(struct fuse_out_header)) { fuse_log(FUSE_LOG_ERR, "%s: elem %d too short for out_header\n", __func__, elem->index); - ret =3D E2BIG; - goto err; + return E2BIG; } if (in_len < tosend_len) { fuse_log(FUSE_LOG_ERR, "%s: elem %d too small for data len %zd\n", __func__, elem->index, tosend_len); - ret =3D E2BIG; - goto err; + return E2BIG; } =20 /* TODO: Limit to 'len' */ @@ -408,7 +406,7 @@ int virtio_send_data_iov(struct fuse_session *se, struc= t fuse_chan *ch, } fuse_log(FUSE_LOG_DEBUG, "%s: preadv failed (%m) len=3D%zd\n", __func__, len); - goto err; + return ret; } =20 if (!ret) { @@ -438,21 +436,14 @@ int virtio_send_data_iov(struct fuse_session *se, str= uct fuse_chan *ch, out_sg->len =3D tosend_len; } =20 - ret =3D 0; - vu_dispatch_rdlock(qi->virtio_dev); pthread_mutex_lock(&qi->vq_lock); vu_queue_push(dev, q, elem, tosend_len); vu_queue_notify(dev, q); pthread_mutex_unlock(&qi->vq_lock); vu_dispatch_unlock(qi->virtio_dev); - -err: - if (ret =3D=3D 0) { - req->reply_sent =3D true; - } - - return ret; + req->reply_sent =3D true; + return 0; } =20 static __thread bool clone_fs_called; --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052227; cv=none; d=zohomail.com; s=zohoarc; b=X/sW2V3N7Gglqr1ImFBohNXKI63e3w2wDWxWSNPvoH/JscGcrhXaSFKHYX0GeOdZnc7wCkrKJ8JtyceURLZWVZMuT/VURT4VVgZ3qVvQcxdJX/YMTWoLW6DTEfs5ZBgykdeO+qk9UTO6dLDsepsF/X9mAHQvbOdGLqpugC5sMag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052227; 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=6Vtz5chL+E7ckUbcEVpYpBr2oL2ibtejM6GZ7KzjLdM=; b=Rd6YbaNNSf46YWgYJdSNGat35Za6WeXe4YpU+XLj4j7C+j1a67jtvOxQ9q3pKxSiBfIBVSkLjG60XZW0kXuTAaDDzsI8IhMds0pajXKQMJ/YsPJoPDjcIuwE31zgd/PTsywbd6rqCsc7eFg+MGi+NWgmqm+8ABK+Od8mnEQzhRc= 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+importer2=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 1622052227784761.5568487657746; Wed, 26 May 2021 11:03:47 -0700 (PDT) Received: from localhost ([::1]:37114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxsg-0006rl-Fw for importer2@patchew.org; Wed, 26 May 2021 14:03:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxc2-0003e6-Pe for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbu-00006A-2a for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:34 -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-553-XcfNAjYMOu-_xpxRohB6xA-1; Wed, 26 May 2021 13:46:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 096D8180FD6A; Wed, 26 May 2021 17:46:22 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47CDE5D9C6; Wed, 26 May 2021 17:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051185; 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=6Vtz5chL+E7ckUbcEVpYpBr2oL2ibtejM6GZ7KzjLdM=; b=CDvZEmOO9oa9D9wiqBjOu4EzZiUtWzpfBh6D1shXdzGputuj4qXbqhAsfjfvlGV04a8tGF MaRv3gzz7StFdz0ZSGdNgNCT/Ylr4pG2pV5dCKUhg1q7PQYikFopWiXH1wXRHsrCQrjNoa tbtT5uKsYxCUXFDaztn8MCTamGAb6Fg= X-MC-Unique: XcfNAjYMOu-_xpxRohB6xA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 09/15] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0 Date: Wed, 26 May 2021 18:45:34 +0100 Message-Id: <20210526174540.290588-10-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mahmoud Mandour Replaced a call to calloc() and its respective free() call with GLib's g_try_new0() and g_free() calls. Signed-off-by: Mahmoud Mandour Message-Id: <20210314032324.45142-7-ma.mandourr@gmail.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c index 874f01c488..b5f04be356 100644 --- a/tools/virtiofsd/buffer.c +++ b/tools/virtiofsd/buffer.c @@ -37,7 +37,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf, struct iovec *iov; int fd =3D out_buf->fd; =20 - iov =3D calloc(iovcnt, sizeof(struct iovec)); + iov =3D g_try_new0(struct iovec, iovcnt); if (!iov) { return -ENOMEM; } @@ -61,7 +61,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf, res =3D -errno; } =20 - free(iov); + g_free(iov); return res; } =20 --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052743; cv=none; d=zohomail.com; s=zohoarc; b=AOT6xi+i7/dUAT5OWVZ5Y9v0bMe/bLALgUcBP+CgiUfftsJ29f6hRi0ZBsP3fWuh+9YIPlkQzK7JG3mSrMF/rDrmEBGIzKJXcb4DU2dOJMzCYvk58sUWU6ER60wZkHwuUqpE0XGqPGVHkClbjPzI0JRXB9PJ3ZYUmg0imc3Rg3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052743; 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=NcF5Mr1qAJ+6CbZ+RAFKhS1PkG6bIPtsRt+nuIksmuc=; b=TeiRYipnjPR/6o159fwoLrJQO4Qw4rMahgzXGboQ2potXvKBdkLqhlTQaRdutuZfoMzvBny21hrwL+vbOUnCo9D+5UStSqwFEWsxEvMSZv9PvTgz2zRU2OMj0Kg3FVYVoOFG4+CEmN+vFSQju08Idql3MKgmDVV3rxC1PkJ/R8w= 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+importer2=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 1622052743768461.36002921310126; Wed, 26 May 2021 11:12:23 -0700 (PDT) Received: from localhost ([::1]:50646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lly10-0007mR-9C for importer2@patchew.org; Wed, 26 May 2021 14:12:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxc4-0003fv-Ah for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxbx-000077-U3 for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:36 -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-594-F3QMMngcOjORGK4v_LMg2g-1; Wed, 26 May 2021 13:46:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4972501E0; Wed, 26 May 2021 17:46:23 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 528B15D9C6; Wed, 26 May 2021 17:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051188; 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=NcF5Mr1qAJ+6CbZ+RAFKhS1PkG6bIPtsRt+nuIksmuc=; b=Ij++fXwfGuUgbUjgGGLhMHhCKkW4k/Cvqv6uXWl5z6Is78yWhW595nJe+87DJiyD6miHC3 SHZaroA+TNIeZPQhL5AQ8fkhvOeiof4P4y11Ye/3GLSKaPyD9B9OWizdmUc5CnOu16PPqU iYEUclxPyvB1jIjk2vUuWmMPaDo56To= X-MC-Unique: F3QMMngcOjORGK4v_LMg2g-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 10/15] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc Date: Wed, 26 May 2021 18:45:35 +0100 Message-Id: <20210526174540.290588-11-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mahmoud Mandour Replaced a malloc() call and its respective free() with GLib's g_try_malloc() and g_free() calls. Signed-off-by: Mahmoud Mandour Message-Id: <20210314032324.45142-8-ma.mandourr@gmail.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c index f0ab8d22f4..9d371448e9 100644 --- a/tools/virtiofsd/fuse_opt.c +++ b/tools/virtiofsd/fuse_opt.c @@ -272,7 +272,7 @@ static int process_opt_sep_arg(struct fuse_opt_context = *ctx, } =20 param =3D ctx->argv[ctx->argctr]; - newarg =3D malloc(sep + strlen(param) + 1); + newarg =3D g_try_malloc(sep + strlen(param) + 1); if (!newarg) { return alloc_failed(); } @@ -280,7 +280,7 @@ static int process_opt_sep_arg(struct fuse_opt_context = *ctx, memcpy(newarg, arg, sep); strcpy(newarg + sep, param); res =3D process_opt(ctx, opt, sep, newarg, iso); - free(newarg); + g_free(newarg); =20 return res; } --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622053119; cv=none; d=zohomail.com; s=zohoarc; b=L55aGuVKIESxxeC047EoLzPjdWZ/lXYoe0EYevTSJr442wZBp3yHjU8//8dnLTGDxkJQneQ4ngpT8uNsTm713mUyZWhkrpo3wqnfmM5l5lARg/wPxehuxwL80Y7PtsEh19Kg0wVL9QmKdC8NO5Gogen7RD0cle4ecIhrK/Cud0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622053119; 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=1qJ/CtpSl5gQmrC5v2rLS/IFmn+Zp/TSfBCThKnb/wY=; b=L7xTVZ4GydHCx4LMlOIxKhMMY9Rbq5Oj0Z1TL8A6KjFaipCesbaKKy2i4ueGTcsqRSylN3fnnB3i5FgLdvq/wEyREUj492iCz0NfjzYn6DW45aXbMlGDUxwVGaX0cyOv1/80L/SzJtPKsTMPKrN667nL0LAJvhHEKvgurJUxmDo= 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+importer2=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 1622053119351307.2704278333522; Wed, 26 May 2021 11:18:39 -0700 (PDT) Received: from localhost ([::1]:59278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lly74-0005VZ-5m for importer2@patchew.org; Wed, 26 May 2021 14:18:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxc7-0003i5-4Y for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxc2-000094-Gj for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:38 -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-105-WAtY6SydNMCvyBN0TVTA0A-1; Wed, 26 May 2021 13:46:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C1138049C5; Wed, 26 May 2021 17:46:25 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A0135D9C6; Wed, 26 May 2021 17:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051192; 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=1qJ/CtpSl5gQmrC5v2rLS/IFmn+Zp/TSfBCThKnb/wY=; b=hesSczfwlUo3L9U11goU/9Y0YULKHmXgwkSVq7VwHeMbUnPyNT/JykQbGj9m6zUyu1pbJS NISpyZFj8vRarOncTV9bH7A6QKrZMVQpQvkwRFHb64KSTGX9uapfd+AMK67STMq8CtPTlj EFjGKqZTtO9n+3OYfQlbisS07q3O1rg= X-MC-Unique: WAtY6SydNMCvyBN0TVTA0A-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 11/15] migration/rdma: Fix cm_event used before being initialized Date: Wed, 26 May 2021 18:45:36 +0100 Message-Id: <20210526174540.290588-12-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Zhijian A segmentation fault was triggered when i try to abort a postcopy + rdma migration. since rdma_ack_cm_event releases a uninitialized cm_event in these case. like below: 2496 ret =3D rdma_get_cm_event(rdma->channel, &cm_event); 2497 if (ret) { 2498 perror("rdma_get_cm_event after rdma_connect"); 2499 ERROR(errp, "connecting to destination!"); 2500 rdma_ack_cm_event(cm_event); <<<< cause segmentation fault 2501 goto err_rdma_source_connect; 2502 } Refer to the rdma_get_cm_event() code, cm_event will be updated/changed only if rdma_get_cm_event() returns 0. So it's okey to remove the ack in error patch. Signed-off-by: Li Zhijian Message-Id: <20210519064740.10828-1-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 00eac34232..41726cc74a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2497,7 +2497,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error= **errp) if (ret) { perror("rdma_get_cm_event after rdma_connect"); ERROR(errp, "connecting to destination!"); - rdma_ack_cm_event(cm_event); goto err_rdma_source_connect; } =20 --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622053169; cv=none; d=zohomail.com; s=zohoarc; b=SW+A6+RfcXSDG24QjkhD319bifvVMpxP8KQXUAFAMShdXp9E+ufyQuTZnMC0OKH8UJ6cIp1TFK0E0JREAW61V0XrN6lFkMpJzWF+v42r00jOg4eBqAYmC3ALcB0La/3yF5V17Hj4Fvqb1eH2gbwlZ+MGkAWGfnzSoE84azL5ue0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622053169; 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=AfGFa5L8RLtyop7aM5DLc/+hT8H0rBjVbt1Qo9Sh4lo=; b=MqKkC4cU0a7Kp/cyWNJxCAMAmtj3K3vqVu2CcwuHO+mVhQqsIgY/yjgUPNMIJEC7kKvHjXx3h8ZglTFOzyj4NADCaQPD3vnX4zw1hr0HzQrtTQORqtWGy//p8IPc8sTzW63qeQ5nlG64XrUCyboqFtXvAZWcxNEgTn92aj2JqJ8= 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+importer2=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 1622053169271899.4938105101174; Wed, 26 May 2021 11:19:29 -0700 (PDT) Received: from localhost ([::1]:32934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lly7q-0006m9-Hy for importer2@patchew.org; Wed, 26 May 2021 14:19:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcF-0003kM-0P for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxc9-0000CI-1V for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:46 -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-150-PhuYblm1O4qH6R6YiXw0oA-1; Wed, 26 May 2021 13:46:34 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1F86180FD61; Wed, 26 May 2021 17:46:33 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5DAB5D9C6; Wed, 26 May 2021 17:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051199; 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=AfGFa5L8RLtyop7aM5DLc/+hT8H0rBjVbt1Qo9Sh4lo=; b=CHkV0kU1CCl8ZHmySI8xTYEFP80N1eCI5ebamlz24+BwJALr0L3aWwu7z9Pd4qbmVZIv9S ygYaaSTT4YcPwpwvFtHp2x3YMI6RX4X8Rv1+YM0355aqjWZ0LWeOvyU2BAOnx/ngqPcYJn yUsYaipdzx2EakyWtIDLveIrlpb4OsM= X-MC-Unique: PhuYblm1O4qH6R6YiXw0oA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 12/15] migration/rdma: cleanup rdma in rdma_start_incoming_migration error path Date: Wed, 26 May 2021 18:45:37 +0100 Message-Id: <20210526174540.290588-13-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Zhijian the error path after calling qemu_rdma_dest_init() should do rdma cleanup Signed-off-by: Li Zhijian Message-Id: <20210520081148.17001-1-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 41726cc74a..7e7595faab 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4040,7 +4040,7 @@ void rdma_start_incoming_migration(const char *host_p= ort, Error **errp) =20 if (ret) { ERROR(errp, "listening on socket!"); - goto err; + goto cleanup_rdma; } =20 trace_rdma_start_incoming_migration_after_rdma_listen(); @@ -4050,7 +4050,7 @@ void rdma_start_incoming_migration(const char *host_p= ort, Error **errp) rdma_return_path =3D qemu_rdma_data_init(host_port, &local_err); =20 if (rdma_return_path =3D=3D NULL) { - goto err; + goto cleanup_rdma; } =20 qemu_rdma_return_path_dest_init(rdma_return_path, rdma); @@ -4059,6 +4059,9 @@ void rdma_start_incoming_migration(const char *host_p= ort, Error **errp) qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); return; + +cleanup_rdma: + qemu_rdma_cleanup(rdma); err: error_propagate(errp, local_err); if (rdma) { --=20 2.31.1 From nobody Sat Apr 27 06:25:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622053630; cv=none; d=zohomail.com; s=zohoarc; b=Y8bvVski4Y7rsj7FFwxNti+Dk2wh/2FFmUAClGuWkSpFws9aSJkcxK7rNa68ZEHMWggIdYVQsLSvGXASzfYBq4tLrF8vGPkJ1gedVg7fZDL+KT1vnDYlzVjcZljate2U5d3p8SyMYLyOO6+AB1U7Bs9YMe7gIETNS+RM0vQ83r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622053630; 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=Y5vfmAXwybGpXlOmxwvd6J5iuIKoNVtGaIm2C8OgilA=; b=lVA2uExFuIcvIe6rgH/eyNNE9QQdPzZ62yVqoESaLZwZEJQTP8QT7hEz9ROK+isiT6u+Pb0eRra/UFhXetJmh3fnJuWrlAhAiNCvqFExHKtxRZbl8+V4vb7cQWqdojCml5uzv4PFFd2nAvYwmMyPbv7RtHmOaZK+kM6KPQUDFxU= 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+importer2=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 1622053629995513.7841320821362; Wed, 26 May 2021 11:27:09 -0700 (PDT) Received: from localhost ([::1]:48314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llyFI-0000gV-Bo for importer2@patchew.org; Wed, 26 May 2021 14:27:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcH-0003kZ-6l for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcA-0000Cd-Rg for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:47 -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-176-aX3A8xUTPUC10GY9hlF91w-1; Wed, 26 May 2021 13:46:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA6C3800D55; Wed, 26 May 2021 17:46:35 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 472CC5D9C6; Wed, 26 May 2021 17:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051199; 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=Y5vfmAXwybGpXlOmxwvd6J5iuIKoNVtGaIm2C8OgilA=; b=FO/a4gVPLZJsLITV54pjalhZD11553+QKm9xVIuQXPIvB6YRCt67y8exQaJG8TJBqq381a d9mk2TC6UWNxjVld2nQ6+4AhO1OkKYpiYFkA+mTwSKardY5WMbV9TUG7d1lbz6vEjnLkSu YIw0bD0zwC2i+R2qd9rOag5ML6iKCNU= X-MC-Unique: aX3A8xUTPUC10GY9hlF91w-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 13/15] migration/rdma: Fix rdma_addrinfo res leaks Date: Wed, 26 May 2021 18:45:38 +0100 Message-Id: <20210526174540.290588-14-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Zhijian rdma_freeaddrinfo() is the reverse operation of rdma_getaddrinfo() Signed-off-by: Li Zhijian Reviewed-by: Dr. David Alan Gilbert Message-Id: <20210525080552.28259-2-lizhijian@cn.fujitsu.com> Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index 7e7595faab..651534e825 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -987,10 +987,12 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, = Error **errp) } } =20 + rdma_freeaddrinfo(res); ERROR(errp, "could not resolve address %s", rdma->host); goto err_resolve_get_addr; =20 route: + rdma_freeaddrinfo(res); qemu_rdma_dump_gid("source_resolve_addr", rdma->cm_id); =20 ret =3D rdma_get_cm_event(rdma->channel, &cm_event); @@ -2593,6 +2595,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Err= or **errp) break; } =20 + rdma_freeaddrinfo(res); if (!e) { ERROR(errp, "Error: could not rdma_bind_addr!"); goto err_dest_init_bind_addr; --=20 2.31.1 From nobody Sat Apr 27 06:25:20 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622053412; cv=none; d=zohomail.com; s=zohoarc; b=mHIWFUkARSQja/fJbniNbKljo4aOHu2ND7UAQILIFxTXTLzgB95Ply7jrBB6AUdkyaCmO0VTX4XqMoMI4hb8llboXEPHN3RpxG2nr3LXihyOR6o//RNNp0tGuliaSJgU7RI0TFS6TFxq0YV/oqRBmrDA1Il60KESIKOvgKdss2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622053412; 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=Z6T4C5Mvf7vfy8lCrCGb1AmdQxQ9C5lpRtECCRFldYM=; b=h71+rFYSIDKUh38PDH+SGakTw/d8Ofyopk3e7GqkPsvCfNUdPb0dGvwrnvDrGY94orh57y7ESdN6YG9BxBMGNwx8uvhcjnqaAGtB7AXKOQydE9TtYDTxrs8+ykAA9R3bwxsgMshxU6+sRWY9ZREQUhfhvfIidR1iaGaSheT2QSw= 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+importer2=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 16220534124291009.7635289659611; Wed, 26 May 2021 11:23:32 -0700 (PDT) Received: from localhost ([::1]:39766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llyBn-00037w-9X for importer2@patchew.org; Wed, 26 May 2021 14:23:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcE-0003kL-Vu for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcA-0000Cz-Rp for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:46 -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-513-_RPIgxirP5agu_46T5mdXQ-1; Wed, 26 May 2021 13:46:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 804358049CB; Wed, 26 May 2021 17:46:37 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10E3F5D9C6; Wed, 26 May 2021 17:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051200; 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=Z6T4C5Mvf7vfy8lCrCGb1AmdQxQ9C5lpRtECCRFldYM=; b=Q+lsvEenRLyKpm9qWqMDgsmcUKVGJyfyJ5gHmaWzLI1H3dG8McwmaMW6cQgQtyWdSpvaEQ Smd5uRQzCqI1MAbWZ/EFQHX3sDpoSzb6qejdOBQgiFptfv4txjqZ94qyiaH5UzKMuvbJEP ynB+xje4OZATGlJr/0MVpCKkfvklnc0= X-MC-Unique: _RPIgxirP5agu_46T5mdXQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 14/15] migration/rdma: destination: create the return patch after the first accept Date: Wed, 26 May 2021 18:45:39 +0100 Message-Id: <20210526174540.290588-15-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Zhijian destination side: $ build/qemu-system-x86_64 -enable-kvm -netdev tap,id=3Dhn0,script=3D/etc/q= emu-ifup,downscript=3D/etc/qemu-ifdown -device e1000,netdev=3Dhn0,mac=3D50:= 52:54:00:11:22 -boot c -drive if=3Dnone,file=3D./Fedora-rdma-server-migrati= on.qcow2,id=3Ddrive-virtio-disk0 -device virtio-blk-pci,bus=3Dpci.0,addr=3D= 0x4,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0 -m 2048 -smp 2 -device pii= x3-usb-uhci -device usb-tablet -monitor stdio -vga qxl -spice streaming-vid= eo=3Dfilter,port=3D5902,disable-ticketing -incoming rdma:192.168.1.10:8888 (qemu) migrate_set_capability postcopy-ram on (qemu) dest_init RDMA Device opened: kernel name rocep1s0f0 uverbs device name uve= rbs0, infiniband_verbs class device path /sys/class/infiniband_verbs/uverbs= 0, infiniband class device path /sys/class/infiniband/rocep1s0f0, transport= : (2) Ethernet Segmentation fault (core dumped) (gdb) bt #0 qemu_rdma_accept (rdma=3D0x0) at ../migration/rdma.c:3272 #1 rdma_accept_incoming_migration (opaque=3D0x0) at ../migration/rdma= .c:3986 #2 0x0000563c9e51f02a in aio_dispatch_handler (ctx=3Dctx@entry=3D0x563ca0606010, node=3D0x563ca12b2150) at ../util/a= io-posix.c:329 #3 0x0000563c9e51f752 in aio_dispatch_handlers (ctx=3D0x563ca0606010) at = ../util/aio-posix.c:372 #4 aio_dispatch (ctx=3D0x563ca0606010) at ../util/aio-posix.c:382 #5 0x0000563c9e4f4d9e in aio_ctx_dispatch (source=3D, = callback=3D, user_data=3D) at ../util/asy= nc.c:306 #6 0x00007fe96ef3fa9f in g_main_context_dispatch () at /lib64/libgli= b-2.0.so.0 #7 0x0000563c9e4ffeb8 in glib_pollfds_poll () at ../util/main-loop.c:= 231 #8 os_host_main_loop_wait (timeout=3D12188789) at ../util/main-loop.c= :254 #9 main_loop_wait (nonblocking=3Dnonblocking@entry=3D0) at ../util/ma= in-loop.c:530 #10 0x0000563c9e3c7211 in qemu_main_loop () at ../softmmu/runstate.c:7= 25 #11 0x0000563c9dfd46fe in main (argc=3D, argv=3D, envp=3D) at ../softmmu/main.c:50 The rdma return path will not be created when qemu incoming is starting since migrate_copy() is false at that moment, then a NULL return path rdma was referenced if the user enabled postcopy later. Signed-off-by: Li Zhijian Message-Id: <20210525080552.28259-3-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 651534e825..d829d08d07 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -316,6 +316,7 @@ typedef struct RDMALocalBlocks { typedef struct RDMAContext { char *host; int port; + char *host_port; =20 RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; =20 @@ -2392,7 +2393,9 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->channel =3D NULL; } g_free(rdma->host); + g_free(rdma->host_port); rdma->host =3D NULL; + rdma->host_port =3D NULL; } =20 =20 @@ -2648,6 +2651,7 @@ static void *qemu_rdma_data_init(const char *host_por= t, Error **errp) if (!inet_parse(addr, host_port, NULL)) { rdma->port =3D atoi(addr->port); rdma->host =3D g_strdup(addr->host); + rdma->host_port =3D g_strdup(host_port); } else { ERROR(errp, "bad RDMA migration address '%s'", host_port); g_free(rdma); @@ -3276,6 +3280,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) .private_data =3D &cap, .private_data_len =3D sizeof(c= ap), }; + RDMAContext *rdma_return_path =3D NULL; struct rdma_cm_event *cm_event; struct ibv_context *verbs; int ret =3D -EINVAL; @@ -3291,6 +3296,20 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } =20 + /* + * initialize the RDMAContext for return path for postcopy after first + * connection request reached. + */ + if (migrate_postcopy() && !rdma->is_return_path) { + rdma_return_path =3D qemu_rdma_data_init(rdma->host_port, NULL); + if (rdma_return_path =3D=3D NULL) { + rdma_ack_cm_event(cm_event); + goto err_rdma_dest_wait; + } + + qemu_rdma_return_path_dest_init(rdma_return_path, rdma); + } + memcpy(&cap, cm_event->param.conn.private_data, sizeof(cap)); =20 network_to_caps(&cap); @@ -3406,6 +3425,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) err_rdma_dest_wait: rdma->error_state =3D ret; qemu_rdma_cleanup(rdma); + g_free(rdma_return_path); return ret; } =20 @@ -4048,17 +4068,6 @@ void rdma_start_incoming_migration(const char *host_= port, Error **errp) =20 trace_rdma_start_incoming_migration_after_rdma_listen(); =20 - /* initialize the RDMAContext for return path */ - if (migrate_postcopy()) { - rdma_return_path =3D qemu_rdma_data_init(host_port, &local_err); - - if (rdma_return_path =3D=3D NULL) { - goto cleanup_rdma; - } - - qemu_rdma_return_path_dest_init(rdma_return_path, rdma); - } - qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); return; @@ -4069,6 +4078,7 @@ err: error_propagate(errp, local_err); if (rdma) { g_free(rdma->host); + g_free(rdma->host_port); } g_free(rdma); g_free(rdma_return_path); --=20 2.31.1 From nobody Sat Apr 27 06:25:20 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622052520; cv=none; d=zohomail.com; s=zohoarc; b=UA/JARjzW7bhBEGh66lRXsVpShXVqW6KUj2MSePuVCFwmG1a4ewCmdZZqa4YCsTJsKwy4DXfCiXApGHyDFYy+0LL+3++mIfLrEUo9+ffPi9pQUQJ1Yhs2PwDnOTfCWQnY8nuDIQC85eeGPUbQKkHl5LxCREExOXIfnYoGAyejjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622052520; 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=qVac0FKrE3OkbbvHYBHdw4eP77+uD9G/xjx5BqxLvLo=; b=iMU6udA4DHspw2un5BPDbZHyMNUQMZxwKwDpmW0YoSWoeXacNNpvjz3bAzLBAXoAjH06dB/NsqULHUU9eBKRUrvhkYCJ+ZgPdmutGVtW66hEwNh/nXl8mXoAQ0UqYvmRwY5j+rc2DWqvfh+Uy33ZHbKPiBjfYdNNixGv/9b5L5I= 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+importer2=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 1622052520852790.7616021306252; Wed, 26 May 2021 11:08:40 -0700 (PDT) Received: from localhost ([::1]:45796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llxxP-0004T8-PS for importer2@patchew.org; Wed, 26 May 2021 14:08:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcN-0003m8-DQ for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llxcE-0000GG-6k for qemu-devel@nongnu.org; Wed, 26 May 2021 13:46:55 -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-603-PkUxwOQ-PVCWozQfO998Qg-1; Wed, 26 May 2021 13:46:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E52651005D55; Wed, 26 May 2021 17:46:41 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-247.ams2.redhat.com [10.36.114.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA3E05D9C6; Wed, 26 May 2021 17:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622051205; 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=qVac0FKrE3OkbbvHYBHdw4eP77+uD9G/xjx5BqxLvLo=; b=C5fvocvrAEbZJGhyLnbuYxY9Wb3HCv4j65IJ8WeBykDmf8NiJJuZm5MUllZ7LeNXAzLebm Y037jobg6hWfvJPzUxXukKG5BSh14JpGLfx/kcv7X1rdELeqLS+hDOsCZIkfuedFsk0EWl hM8M7S4QaOcNQJ5TCl1iAvsy6NuurnQ= X-MC-Unique: PkUxwOQ-PVCWozQfO998Qg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, kwolf@redhat.com, vgoyal@redhat.com, ma.mandourr@gmail.com, lizhijian@cn.fujitsu.com Subject: [PULL 15/15] migration/rdma: source: poll cm_event from return path Date: Wed, 26 May 2021 18:45:40 +0100 Message-Id: <20210526174540.290588-16-dgilbert@redhat.com> In-Reply-To: <20210526174540.290588-1-dgilbert@redhat.com> References: <20210526174540.290588-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, 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: peterx@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Zhijian source side always blocks if postcopy is only enabled at source side. users are not able to cancel this migration in this case. Let source side have chance to cancel this migration Signed-off-by: Li Zhijian Message-Id: <20210525080552.28259-4-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert Typo fix --- migration/rdma.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index d829d08d07..1cdb4561f3 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -36,6 +36,7 @@ #include #include "trace.h" #include "qom/object.h" +#include =20 /* * Print and error on both the Monitor and the Log file. @@ -2460,7 +2461,36 @@ err_rdma_source_init: return -1; } =20 -static int qemu_rdma_connect(RDMAContext *rdma, Error **errp) +static int qemu_get_cm_event_timeout(RDMAContext *rdma, + struct rdma_cm_event **cm_event, + long msec, Error **errp) +{ + int ret; + struct pollfd poll_fd =3D { + .fd =3D rdma->channel->fd, + .events =3D POLLIN, + .revents =3D 0 + }; + + do { + ret =3D poll(&poll_fd, 1, msec); + } while (ret < 0 && errno =3D=3D EINTR); + + if (ret =3D=3D 0) { + ERROR(errp, "poll cm event timeout"); + return -1; + } else if (ret < 0) { + ERROR(errp, "failed to poll cm event, errno=3D%i", errno); + return -1; + } else if (poll_fd.revents & POLLIN) { + return rdma_get_cm_event(rdma->channel, cm_event); + } else { + ERROR(errp, "no POLLIN event, revent=3D%x", poll_fd.revents); + return -1; + } +} + +static int qemu_rdma_connect(RDMAContext *rdma, Error **errp, bool return_= path) { RDMACapabilities cap =3D { .version =3D RDMA_CONTROL_VERSION_CURRENT, @@ -2498,7 +2528,11 @@ static int qemu_rdma_connect(RDMAContext *rdma, Erro= r **errp) goto err_rdma_source_connect; } =20 - ret =3D rdma_get_cm_event(rdma->channel, &cm_event); + if (return_path) { + ret =3D qemu_get_cm_event_timeout(rdma, &cm_event, 5000, errp); + } else { + ret =3D rdma_get_cm_event(rdma->channel, &cm_event); + } if (ret) { perror("rdma_get_cm_event after rdma_connect"); ERROR(errp, "connecting to destination!"); @@ -4111,7 +4145,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 trace_rdma_start_outgoing_migration_after_rdma_source_init(); - ret =3D qemu_rdma_connect(rdma, errp); + ret =3D qemu_rdma_connect(rdma, errp, false); =20 if (ret) { goto err; @@ -4132,7 +4166,7 @@ void rdma_start_outgoing_migration(void *opaque, goto return_path_err; } =20 - ret =3D qemu_rdma_connect(rdma_return_path, errp); + ret =3D qemu_rdma_connect(rdma_return_path, errp, true); =20 if (ret) { goto return_path_err; --=20 2.31.1