From nobody Sun Feb 8 16:30:44 2026 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562793021; cv=none; d=zoho.com; s=zohoarc; b=YHZ0kmnBk+39Sammro+8Zc1EgHH1jBfk9AL+i7BELsR/QpjIyNLpKnwUvNQZd3eQDBxvmoyM9brJZc3buhs6MUrzuic5KSLDVVDTvLQ06AOu7WlZ81kFJ2SnxwCk+CosCADtwCHGJeZ2rMxvHNMejM58H76T3fYfUcjCY9JmGwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562793021; 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:ARC-Authentication-Results; bh=/BWrdOSQKanyD1HJDnVAmEEOxiqiqDj0XBIeltiGP7U=; b=JbIlytn+6MuTzPrww0u9qgXUNk5lndXlHsK90ezcTFFhqoPxh+xDruFMjsYr8stgI8x0QlNB0vYCcgZJwPdo4J4d3X7L8PRMEvhmIkcnnDU/rkxb0wubTKktfnnGl3nbVVFfOstMjmkcv0pKpaIrF4dGRifaXaC9T/w0n5IBmJU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562793021887244.00995723344465; Wed, 10 Jul 2019 14:10:21 -0700 (PDT) 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 07B3430ADC8A; Wed, 10 Jul 2019 21:10:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4D8F17D40; Wed, 10 Jul 2019 21:10:19 +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 6C04F18355E2; Wed, 10 Jul 2019 21:10:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6AL9BO9010706 for ; Wed, 10 Jul 2019 17:09:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 643935C25A; Wed, 10 Jul 2019 21:09:11 +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 5D4714B7 for ; Wed, 10 Jul 2019 21:09:09 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3EC79C04AC70 for ; Wed, 10 Jul 2019 21:09:09 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6AL78bN117685 for ; Wed, 10 Jul 2019 17:09:08 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tnpc7jw03-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Jul 2019 17:09:08 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Jul 2019 22:09:08 +0100 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 10 Jul 2019 22:09:04 +0100 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6AL93JR38470038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jul 2019 21:09:03 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E321AE071; Wed, 10 Jul 2019 21:09:03 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86D30AE064; Wed, 10 Jul 2019 21:09:03 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 10 Jul 2019 21:09:03 +0000 (GMT) From: Stefan Berger To: libvir-list@redhat.com Date: Wed, 10 Jul 2019 17:08:53 -0400 In-Reply-To: <20190710210859.1713840-1-stefanb@linux.vnet.ibm.com> References: <20190710210859.1713840-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19071021-2213-0000-0000-000003AC2813 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011405; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01230322; UDB=6.00648024; IPR=6.01011592; MB=3.00027670; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-10 21:09:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071021-2214-0000-0000-00005F2E3495 Message-Id: <20190710210859.1713840-16-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-10_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907100243 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 10 Jul 2019 21:09:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 10 Jul 2019 21:09:09 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'stefanb@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.698 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: marcandre.lureau@redhat.com, Stefan Berger Subject: [libvirt] [PATCH v3 15/21] utils: Write a maximum of MAX_PIPE_FEED_BYTES into a pipe 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: , 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.47]); Wed, 10 Jul 2019 21:10:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" To avoid blocking on a write on a pipe that the receiving process does not read from, write only MAX_PIPE_FEED_BYTES into the pipe so that we can serve other pipes as well. Signed-off-by: Stefan Berger --- src/util/vircommand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 898ee0df45..0e367eeeab 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -86,6 +86,8 @@ struct _virCommandSendBuffer { size_t buflen; off_t offset; }; +/* max. number of bytes we write to pipe to avoid blocking on it */ +#define MAX_PIPE_FEED_BYTES 1024 =20 struct _virCommand { int has_error; /* ENOMEM on allocation failure, -1 for anything else. = */ @@ -2237,7 +2239,7 @@ virCommandProcessIO(virCommandPtr cmd) int done; =20 done =3D write(cmd->inpipe, cmd->inbuf + inoff, - inlen - inoff); + MIN(inlen - inoff, MAX_PIPE_FEED_BYTES)); if (done < 0) { if (errno =3D=3D EPIPE) { VIR_DEBUG("child closed stdin early, ignoring EPIP= E " --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list