linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Arseny Krasnov <arseny.krasnov@kaspersky.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Colin Ian King <colin.king@canonical.com>,
	Norbert Slusarek <nslusarek@gmx.net>,
	Andra Paraschiv <andraprs@amazon.com>, kvm <kvm@vger.kernel.org>,
	Linux Virtualization <virtualization@lists.linux-foundation.org>,
	netdev <netdev@vger.kernel.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Krasnov Arseniy <oxffffaa@gmail.com>
Subject: Re: [RFC PATCH v1 11/16] afvsock: add 'seqpacket_drop()'
Date: Wed, 30 Jun 2021 14:12:46 +0200	[thread overview]
Message-ID: <CAGxU2F4mX5khjA+a_LQEfZYg1rjEmccXce-ab0DVyEJEX-kYcw@mail.gmail.com> (raw)
In-Reply-To: <20210628100415.571391-1-arseny.krasnov@kaspersky.com>

On Mon, Jun 28, 2021 at 01:04:12PM +0300, Arseny Krasnov wrote:
>Add special callback for SEQPACKET socket which is called when
>we need to drop current in-progress record: part of record was
>copied successfully, reader wait rest of record, but signal
>interrupts it and reader leaves it's loop, leaving packets of
>current record still in queue. So to avoid copy of "orphaned"
>record, we tell transport to drop every packet until EOR will
>be found.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> include/net/af_vsock.h   | 1 +
> net/vmw_vsock/af_vsock.c | 1 +
> 2 files changed, 2 insertions(+)

And also for this change, I think you can merge with patches 12, 13, 14, 
15, otherwise if we bisect and we build at this patch, the 
seqpacket_drop pointer is not valid.

Thanks,
Stefano

>
>diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
>index 1747c0b564ef..356878aabbd4 100644
>--- a/include/net/af_vsock.h
>+++ b/include/net/af_vsock.h
>@@ -141,6 +141,7 @@ struct vsock_transport {
>       int (*seqpacket_enqueue)(struct vsock_sock *vsk, struct msghdr *msg,
>                                size_t len);
>       bool (*seqpacket_allow)(u32 remote_cid);
>+      void (*seqpacket_drop)(struct vsock_sock *vsk);
>
>       /* Notification. */
>       int (*notify_poll_in)(struct vsock_sock *, size_t, bool *);
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index ec54e4222cbf..27fa38090e13 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -2024,6 +2024,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
>               intr_err = vsock_connectible_wait_data(sk, &wait, timeout, NULL, 0);
>               if (intr_err <= 0) {
>                       err = intr_err;
>+                      transport->seqpacket_drop(vsk);
>                       break;
>               }
>
>--
>2.25.1
>


  reply	other threads:[~2021-06-30 12:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  9:59 [RFC PATCH v1 00/16] Improve SOCK_SEQPACKET receive logic Arseny Krasnov
2021-06-28 10:01 ` [RFC PATCH v1 01/16] vhost/vsock: don't set 'seqpacket_has_data()' callback Arseny Krasnov
2021-06-28 10:01 ` [RFC PATCH v1 02/16] vsock/loopback: " Arseny Krasnov
2021-06-28 10:02 ` [RFC PATCH v1 03/16] virtio/vsock: " Arseny Krasnov
2021-06-28 10:02 ` [RFC PATCH v1 04/16] virtio/vsock: remove 'virtio_transport_seqpacket_has_data' Arseny Krasnov
2021-06-28 10:02 ` [RFC PATCH v1 05/16] af_vsock: use SOCK_STREAM function to check data Arseny Krasnov
2021-06-30 12:10   ` Stefano Garzarella
2021-06-30 17:47     ` [MASSMAIL KLMS] " Arseny Krasnov
2021-06-28 10:03 ` [RFC PATCH v1 06/16] vsock/virtio: remove record size limit for SEQPACKET Arseny Krasnov
2021-06-28 10:03 ` [RFC PATCH v1 07/16] virtio/vsock: don't count EORs on receive Arseny Krasnov
2021-06-30 12:11   ` Stefano Garzarella
2021-06-30 17:47     ` Arseny Krasnov
2021-06-28 10:03 ` [RFC PATCH v1 08/16] af_vsock: change SEQPACKET receive loop Arseny Krasnov
2021-06-30 12:12   ` Stefano Garzarella
2021-06-30 17:47     ` Arseny Krasnov
2021-06-28 10:03 ` [RFC PATCH v1 09/16] af_vsock/virtio: update dequeue callback interface Arseny Krasnov
2021-06-28 10:03 ` [RFC PATCH v1 10/16] virtio/vsock: update SEQPACKET dequeue logic Arseny Krasnov
2021-06-28 10:04 ` [RFC PATCH v1 11/16] afvsock: add 'seqpacket_drop()' Arseny Krasnov
2021-06-30 12:12   ` Stefano Garzarella [this message]
2021-06-30 17:48     ` Arseny Krasnov
2021-06-28 10:04 ` [RFC PATCH v1 12/16] virtio/vsock: add 'drop until EOR' logic Arseny Krasnov
2021-06-28 10:04 ` [RFC PATCH v1 13/16] vhost/vsock: enable 'seqpacket_drop' callback in transport Arseny Krasnov
2021-06-28 10:05 ` [RFC PATCH v1 14/16] virtio/vsock: " Arseny Krasnov
2021-06-28 10:05 ` [RFC PATCH v1 15/16] vsock/loopback: " Arseny Krasnov
2021-06-28 10:05 ` [RFC PATCH v1 16/16] vsock_test: SEQPACKET read to broken buffer Arseny Krasnov
2021-06-30 12:17   ` Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGxU2F4mX5khjA+a_LQEfZYg1rjEmccXce-ab0DVyEJEX-kYcw@mail.gmail.com \
    --to=sgarzare@redhat.com \
    --cc=andraprs@amazon.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nslusarek@gmx.net \
    --cc=oxffffaa@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).