[lkml]   [2021]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] virtio/vsock: fix the transport to work with VMADDR_CID_ANY
On Thu, Nov 25, 2021 at 09:27:40AM +0000, Wang, Wei W wrote:
>On Thursday, November 25, 2021 3:16 PM, Wang, Wei W wrote:
>> - /* Update CID in case it has changed after a transport reset event */
>> - vsk->local_addr.svm_cid = dst.svm_cid;
>> -
>> if (space_available)
>> sk->sk_write_space(sk);
>Not sure if anybody knows how this affects the transport reset.

I believe the primary use case is when a guest is migrated.

After the migration, the transport gets a reset event from the
hypervisor and all connected sockets are closed. The ones in listen
remain open though.

Also the guest's CID may have changed after migration. So if an
application has open listening sockets, bound to the old CID, this
should ensure that the socket continues to be usable.

The patch would then change this behavior.

So maybe to avoid problems, we could update the CID only if it is
different from VMADDR_CID_ANY:

if (vsk->local_addr.svm_cid != VMADDR_CID_ANY)
vsk->local_addr.svm_cid = dst.svm_cid;

When this code was written, a guest only supported a single transport,
so it could only have one CID assigned, so that wasn't a problem.
For that reason I'll add this Fixes tag:
Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")


 \ /
  Last update: 2021-11-25 11:43    [W:0.047 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site