From nobody Mon Apr 29 08:27:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152019150629673.25145360945965; Sun, 4 Mar 2018 11:25:06 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 8ED617FDE9; Sun, 4 Mar 2018 19:25:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FF455D9CD; Sun, 4 Mar 2018 19:25:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BD6524A46D; Sun, 4 Mar 2018 19:24:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w24JOvAl000621 for ; Sun, 4 Mar 2018 14:24:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F5A160C7B; Sun, 4 Mar 2018 19:24:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6772C60C80 for ; Sun, 4 Mar 2018 19:24:54 +0000 (UTC) Received: from mail-vk0-f68.google.com (mail-vk0-f68.google.com [209.85.213.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C222DC049D43 for ; Sun, 4 Mar 2018 19:24:53 +0000 (UTC) Received: by mail-vk0-f68.google.com with SMTP id l123so3455787vke.8 for ; Sun, 04 Mar 2018 11:24:53 -0800 (PST) Received: from localhost.localdomain ([187.104.183.168]) by smtp.gmail.com with ESMTPSA id s73sm3421600vkh.52.2018.03.04.11.24.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Mar 2018 11:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=HYmCx6B+Av4tIfbtXKyQATi936CNz64Ta3DnUucc2SE=; b=XBA+28IjbovDHL5bFyeV3oE7gfNZrJSuFUAdiV+prIzpiUuFb3wouMpI9PHBdS/N8X 0LCjrySGuPtExtdXplaFIOuzeIfZyGobQ6RfESOIMTAKw945QDba2UQkA96qlaIc8cfQ hzKef7ING0y23eDzSXMY2NhT7pDxSsT9jHiTlukl8rdiWAMQNXa/G449WAwX3sLY6QKB wBIyI6io/NJRqcAXzKhh72tn7q94IPs97EbEN5GRzV/vnKpbwOGlDiP0GaAvF1FjoIDX 5vUJpfoLMTpsdkP1qYfMNoOCi7oo3NhgRDWpP6tE5JY+HiKSkaLGelP8hu0o6RtT+Qzn EDYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=HYmCx6B+Av4tIfbtXKyQATi936CNz64Ta3DnUucc2SE=; b=uct38f3NJysd7LWWyyNmxmMnaz5Rnpny/LfezG3DRIzZCcB5dxveFqeOlDgy6wvSay +fY528MmRCRR34cuBVjiUuWnHBkEUyQOH9Z0swvNnG4SsjpgJOljdMqae12BDsNbT+yi SQRUkpAe43rpp8MK6GrP5WDtUUseOo86sVgGJTZ8ec81paq8dQ7bXup/rpOskKzlw40n CHJgHTgvtwFHiAJXoGx7/cYcpcNBG+K54ZqvQvLbmiRNd7WXFQIclD1LZSS5TONWdx0T FRMpP6dbpcHrir5r+1DWMItCbuLfHL2zkAHSsV6YCh/0qYui6n07IlJ6b+q+vdJJJMQL s03g== X-Gm-Message-State: AElRT7HyHh39yASFYb9U4sdAZX3F4ovezy0UbTz47uAwoT0do5sUmpdh 2/acZJjUHB/QVIQBBQ2gOwgoeQ== X-Google-Smtp-Source: AG47ELt0OusHOyeGBkzbrsMqD770KOhrIfkbXGsYLszo1VDcaHTLSa+3f1IOMCmHc0shFZ0Z4sUWSA== X-Received: by 10.31.212.68 with SMTP id l65mr7053284vkg.107.1520191492370; Sun, 04 Mar 2018 11:24:52 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Sun, 4 Mar 2018 16:24:21 -0300 Message-Id: <20180304192421.21893-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 04 Mar 2018 19:24:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 04 Mar 2018 19:24:53 +0000 (UTC) for IP:'209.85.213.68' DOMAIN:'mail-vk0-f68.google.com' HELO:'mail-vk0-f68.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.213.68 mail-vk0-f68.google.com 209.85.213.68 mail-vk0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] util, remote: Fixing the sending of stream when length is defined. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 04 Mar 2018 19:25:04 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When a length of a file is defined, the responsible thread to send stream is finishing inappropriately. It is happening because there is wrong conditional which compares an offset with the length and because of that the code throws ENOSPC error. To test it: virsh# vol-upload ... --length N Signed-off-by: Julio Faracco --- src/remote/remote_daemon_stream.c | 24 ++++++++++++------------ src/util/virfdstream.c | 5 +---- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_s= tream.c index 4dd3af9e0..998e82a83 100644 --- a/src/remote/remote_daemon_stream.c +++ b/src/remote/remote_daemon_stream.c @@ -549,21 +549,21 @@ daemonStreamHandleWriteData(virNetServerClientPtr cli= ent, } else if (ret =3D=3D -2) { /* Blocking, so indicate we have more todo later */ return 1; - } else { - virNetMessageError rerr; + } else if (ret) { + virNetMessageError rerr; =20 - memset(&rerr, 0, sizeof(rerr)); + memset(&rerr, 0, sizeof(rerr)); =20 - VIR_INFO("Stream send failed"); - stream->closed =3D true; - virStreamEventRemoveCallback(stream->st); - virStreamAbort(stream->st); + VIR_INFO("Stream send failed"); + stream->closed =3D true; + virStreamEventRemoveCallback(stream->st); + virStreamAbort(stream->st); =20 - return virNetServerProgramSendReplyError(stream->prog, - client, - msg, - &rerr, - &msg->header); + return virNetServerProgramSendReplyError(stream->prog, + client, + msg, + &rerr, + &msg->header); } =20 return 0; diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index be40379a9..c3198c768 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -627,9 +627,6 @@ virFDStreamThread(void *opaque) if (got < 0) goto error; =20 - if (got =3D=3D 0) - break; - total +=3D got; } =20 @@ -783,7 +780,7 @@ static int virFDStreamWrite(virStreamPtr st, const char= *bytes, size_t nbytes) virObjectLock(fdst); =20 if (fdst->length) { - if (fdst->length =3D=3D fdst->offset) { + if (fdst->offset > fdst->length) { virReportSystemError(ENOSPC, "%s", _("cannot write to stream")); virObjectUnlock(fdst); --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list