From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED6F9179A7; Wed, 16 Apr 2025 12:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744807030; cv=none; b=lLDHlpXZkaWhWLdgxARQ9GshFZgBktCvZ/cSLbfgL7+jqBhkA8fOK2R4FHuG5Cf9w4Xybk9Lk2jW3POP4ZXHELr/o6Z0oFYmbsXmTdeZoqmS/LnjcD+D6DvnFtOZUCxBi8cC4nCVW0jb+Gs+OhH5v9iPlroyvNRFwasn9zEizPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744807030; c=relaxed/simple; bh=nVrH3mtSZEP8fIRoFl5ZEEX1SX/ppwAenWERY9UyFlw=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=ZKVnamGS+TH/YbFBh5dMXYj0Ra5xpg67uKmyE2APDYcZ1LcDdAZNvFbGUMTZAu826bcg7ZPXuVgeYe4+1/2DjdT/NKvQdIvUeKggOkcRMBAJmRHCDZgSo2NDYYp4nuDJnifLI0KnQ4xvDnH81vKj/P2/s8HmBR8dzE60JShk52I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=kn46jmGc; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="kn46jmGc" Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1u520g-002nD1-U9; Wed, 16 Apr 2025 14:36:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector1; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Cc:To:Subject:From:MIME-Version:Date:Message-ID; bh=Cfur1eQywpvIitbgUboBvGAu60qJRizrYqb091rvp3w=; b=kn46jmGc0XyVG007rY/V3em+Mv mxOfwHGL4AgAjniU4bLR/KI264VE/uaVYrfN3bPDSs3MNUqiyLGCz20Aqb+G9VIa/C4roqdfIeaFa 3pxy0ZuyEtQ3Ar6vcPd1o4ROWiv0ucdMFsU4Gts4xl3sTF01MwZeKvLQ0ZA9VE4g6rACZlTGv4V/6 HoW/qR1veXcgyjcP1njnJ8mI71zRSLqIdsFdA8y+n45xYNh6vQPraKqJNQpFCuJ41KXNrvvY9wxn3 jdtVsGLm5KcY4p0yIgYgU1b4pyQoKBX5f8ZTW3UjCmZPfdiXVwfSCoqMpC972EEXUVzBL6E52sNvv H6scHFqw==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1u520f-0005UK-GS; Wed, 16 Apr 2025 14:36:57 +0200 Received: by submission01.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1u520b-008oyA-NX; Wed, 16 Apr 2025 14:36:53 +0200 Message-ID: Date: Wed, 16 Apr 2025 14:36:52 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Michal Luczaj Subject: Re: [PATCH net-next 1/2] vsock: Linger on unsent data To: Stefano Garzarella , Paolo Abeni Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Simon Horman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?Q?Eugenio_P=C3=A9rez?= , Stefan Hajnoczi , virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20250407-vsock-linger-v1-0-1458038e3492@rbox.co> <20250407-vsock-linger-v1-1-1458038e3492@rbox.co> <22ad09e7-f2b3-48c3-9a6b-8a7b9fd935fe@redhat.com> Content-Language: pl-PL, en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/11/25 12:32, Stefano Garzarella wrote: > On Thu, Apr 10, 2025 at 12:51:48PM +0200, Paolo Abeni wrote: >> On 4/7/25 8:41 PM, Michal Luczaj wrote: >>> Change the behaviour of a lingering close(): instead of waiting for all >>> data to be consumed, block until data is considered sent, i.e. until worker >>> picks the packets and decrements virtio_vsock_sock::bytes_unsent down to 0. >> >> I think it should be better to expand the commit message explaining the >> rationale. Sure, will do. >>> Do linger on shutdown() just as well. >> >> Why? Generally speaking shutdown() is not supposed to block. I think you >> should omit this part. > > I thought the same, but discussing with Michal we discovered this on > socket(7) man page: > > SO_LINGER > Sets or gets the SO_LINGER option. The argument is a > linger structure. > > struct linger { > int l_onoff; /* linger active */ > int l_linger; /* how many seconds to linger for */ > }; > > When enabled, a close(2) or shutdown(2) will not return > until all queued messages for the socket have been > successfully sent or the linger timeout has been reached. > Otherwise, the call returns immediately and the closing is > done in the background. When the socket is closed as part > of exit(2), it always lingers in the background. > > In AF_VSOCK we supported SO_LINGER only on close(), but it seems that > shutdown must also do it from the manpage. Even though shutdown() lingering isn't universally implemented :/ If I'm reading the code correctly, TCP lingers only on close(). So, following the man page on the one hand, mimicking TCP on the other?