From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Yc69P1Kv; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 1AA435A0269 for ; Sat, 25 Apr 2026 09:42:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777102937; 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=yPlwt7ZHrtvZ1Eqkh2xxWhrpIrRg8T+8zTonfiO7lvc=; b=Yc69P1KvXnzm2E1khoLi6J/gL/EDvoZm/YLJf3sjblw2MzdD4PR8QJbWJZdU6IhyPmLOwE zFvKBIXJZOjxLQ8Szh4lqHZXQ+GD6KVEll5Lc/h1zzdB0MUCjwE5U8v7yV4Uon+Mes8rjz fa9WjIySJOz0ASHU86t23Ohqtw4t//Q= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-22-wyTCj3RDPUOpohGfIwBKnw-1; Sat, 25 Apr 2026 03:42:15 -0400 X-MC-Unique: wyTCj3RDPUOpohGfIwBKnw-1 X-Mimecast-MFC-AGG-ID: wyTCj3RDPUOpohGfIwBKnw_1777102934 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-488c768a9a9so57422185e9.1 for ; Sat, 25 Apr 2026 00:42:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777102934; x=1777707734; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yPlwt7ZHrtvZ1Eqkh2xxWhrpIrRg8T+8zTonfiO7lvc=; b=mKSD7aijrjRpWQcafD2RSGnQPEb6opSxdh8Ls08Lw4traEP9XUNtqVHmw38rtoZ8rG EfDkaCde1P8wsXLKhfEPZAxde23KgKQiOKOVQ/VdR3T1PDbL//AimMiE2Rmelu/rODWK 7HBJBw1wC9M49HoGCZlwE5DfUbYHsAZXCpUhf9RcgVla/IsznR/ikgZ0mqo33fuoTztQ gC8UQz+6seTOm3LUJdu4wxIwZ9Cbh1nODJYWh5qPYCAFm/x9m/D/78OvAYBKFxacXezL 39cHZr4haJjHadG7SOMpDlbCmoPbnIbQwCk3a2WsEsaAbjCj4LIvK1Yi0Dpo9F0v80If XHbA== X-Gm-Message-State: AOJu0YySFLuKA2WSTSt2UosR8cZYwDYer5JWxVoyDrrAB+6CFiZrKShc g7RM6g1thRdEYM9g8tO9XqqO/MC4YULuO41q3/wXVKDIywRi6xHPJhCD6Z7IYjaTeX0bxIntueX tYh9gvD6FTBorfgN0aAwuemrONfmf6zelALYexU4NGwgCRvEJpfMZCg== X-Gm-Gg: AeBDievKJJq9D37OFy9EFnog0K6IcfwX7D8TybPu5L8lYSxKHVp9rcWoiSr7GI91KV1 eSbcMLifY2wWrTDDSYYPSAy406ylWix3y+eDAH5zFa/CIPa/emrpfcMp3zbNguGSQ1LmYRJ42Wt LXl3IErQU46a2FrebkkVyT5dqD2rh7NGETHILGLLipVGV9tCUdqFB1hlIWGDoX6JoBB2WG9mpx2 K03t1ksQpyx9c0F7nHiiuove/mJ7PiWb9p+SGVONwyXaMsAl0UJtuqHiO8gdqiMF/hXd6y0qI/g czyc0gD9qxB+wHfREBW0MAZ7CrnxoHKVsQaO8iU6EaX6nMEuhMLm8xVECFL/OkJwshNPUgLlM4U BXTFMYSERG8760+VElrBQwjez1wxUjxQjq4dxkHgUiNE= X-Received: by 2002:a05:600c:8207:b0:485:3193:6ddb with SMTP id 5b1f17b1804b1-488fb73cf74mr551737165e9.3.1777102934266; Sat, 25 Apr 2026 00:42:14 -0700 (PDT) X-Received: by 2002:a05:600c:8207:b0:485:3193:6ddb with SMTP id 5b1f17b1804b1-488fb73cf74mr551736705e9.3.1777102933772; Sat, 25 Apr 2026 00:42:13 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a55dc9f58sm667429745e9.6.2026.04.25.00.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2026 00:42:12 -0700 (PDT) From: Stefano Brivio To: Anshu Kumari Subject: Re: [PATCH v2] tcp: Handle errors from tcp_send_flag() Message-ID: <20260425094211.0bdead04@elisabeth> In-Reply-To: <20260423062314.905614-1-anskuma@redhat.com> References: <20260423062314.905614-1-anskuma@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Sat, 25 Apr 2026 09:42:12 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0PsHkTnFdKb30FaX7lDq-wAVcPeb3su35PJ7_k8yOig_1777102934 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: LA4J626EGNKAYTOZXOVS4DFP3KE7H4AT X-Message-ID-Hash: LA4J626EGNKAYTOZXOVS4DFP3KE7H4AT X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, david@gibson.dropbear.id.au, lvivier@redhat.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 23 Apr 2026 11:53:14 +0530 Anshu Kumari wrote: > tcp_send_flag() can fail in two different ways: > - tcp_prepare_flags() returns -ECONNRESET when getsockopt(TCP_INFO) > fails: the socket is broken and the connection must be reset. > - tcp_vu_send_flag() returns -EAGAIN when vu_collect() finds no > available vhost-user buffers: this is a transient condition > equivalent to a dropped packet on the wire. > > Have tcp_vu_send_flag() return -EAGAIN instead of a bare -1 for the > buffer-unavailable case. Absorb -EAGAIN in the tcp_send_flag() > dispatcher so that callers only see fatal errors. > > Check the return value at each call site and handle fatal errors: > - in tcp_data_from_tap(), return -1 so the caller resets > - in tcp_tap_handler(), goto reset > - in tcp_timer_handler()/tcp_sock_handler()/tcp_conn_from_sock_finish(), > call tcp_rst() and return > - in tcp_tap_conn_from_sock(), set CLOSING flag, call > FLOW_ACTIVATE() to avoid leaving the flow in TYPED state, and > return > - in tcp_connect_finish(), call tcp_rst() and return > - in tcp_keepalive(), call tcp_rst() and continue the loop > - in tcp_flow_migrate_target_ext(), goto fail > > The call in tcp_rst_do() is left unchecked: we are already > resetting, and tcp_sock_rst() still needs to run regardless. > > Link: https://bugs.passt.top/show_bug.cgi?id=194 > Signed-off-by: Anshu Kumari > --- > v2: > - updated commit message. > - update tcp_vu_send_flag() to return -EAGAIN instead of -1 for > buffer-unavailable case. > - in tcp_tap_conn_from_sock(), added FLOW_ACTIVATE call. > - inside tcp_send_flag(), updated the return statement. function will > return 0 incase of -EAGAIN error. Applied, thanks for the detailed change log! Just one detail: this had two trivial conflicts with commit 831857e9b547 ("tcp: Replace send buffer boost with EPOLLOUT monitoring") which I merged earlier this week (my Monday): $ git show -s --format=%cd 831857e9b547 Mon Apr 20 23:20:41 2026 +0200 I solved those on merge, and I usually do that if the resolution is obvious, but in general you should 'git pull --rebase' or similar (depending on how / whether you use branches) just before submitting patches, so that conflicts are less likely to happen. They might still happen if there are other pending patches that are then merged at the same time but that's unavoidable (and in general I'll just solve conflicts in that case because that's usually my fault for reviewing or merging things too late / slowly). -- Stefano