Add bugfix patch for partial AF_VSOCK shutdown

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
Ian Campbell 2016-05-03 17:27:14 +01:00
parent d85112bce7
commit 7ae99c1b51
26 changed files with 91 additions and 25 deletions

View File

@ -1,7 +1,7 @@
From d8f7730e3211cdb16cd9d26143121aeb05f22509 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Thu, 17 Dec 2015 16:53:43 +0800
Subject: [PATCH 01/25] virtio: make find_vqs() checkpatch.pl-friendly
Subject: [PATCH 01/26] virtio: make find_vqs() checkpatch.pl-friendly
checkpatch.pl wants arrays of strings declared as follows:

View File

@ -1,7 +1,7 @@
From 0260029492a1503e871236767ed86e2fc3862cc2 Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia.lawall@lip6.fr>
Date: Sat, 21 Nov 2015 18:39:17 +0100
Subject: [PATCH 02/25] VSOCK: constify vmci_transport_notify_ops structures
Subject: [PATCH 02/26] VSOCK: constify vmci_transport_notify_ops structures
The vmci_transport_notify_ops structures are never modified, so declare
them as const.

View File

@ -1,7 +1,7 @@
From 6a585c01a353551a69af45bf31606f13115480d1 Mon Sep 17 00:00:00 2001
From: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Date: Tue, 22 Mar 2016 17:05:52 +0100
Subject: [PATCH 03/25] AF_VSOCK: Shrink the area influenced by prepare_to_wait
Subject: [PATCH 03/26] AF_VSOCK: Shrink the area influenced by prepare_to_wait
When a thread is prepared for waiting by calling prepare_to_wait, sleeping
is not allowed until either the wait has taken place or finish_wait has

View File

@ -1,7 +1,7 @@
From a3f136168f164f66de1de277a08b76f54b289d5a Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Thu, 17 Dec 2015 11:10:21 +0800
Subject: [PATCH 04/25] VSOCK: transport-specific vsock_transport functions
Subject: [PATCH 04/26] VSOCK: transport-specific vsock_transport functions
struct vsock_transport contains function pointers called by AF_VSOCK
core code. The transport may want its own transport-specific function

View File

@ -1,7 +1,7 @@
From 4018aa8a812fd6f1a64e3d227550bf5752127314 Mon Sep 17 00:00:00 2001
From: Asias He <asias@redhat.com>
Date: Thu, 13 Jun 2013 18:27:00 +0800
Subject: [PATCH 05/25] VSOCK: Introduce virtio_vsock_common.ko
Subject: [PATCH 05/26] VSOCK: Introduce virtio_vsock_common.ko
This module contains the common code and header files for the following
virtio_transporto and vhost_vsock kernel modules.

View File

@ -1,7 +1,7 @@
From ccaac837ceb4a9582bb57f71e0cac791f7336b19 Mon Sep 17 00:00:00 2001
From: Asias He <asias@redhat.com>
Date: Thu, 13 Jun 2013 18:28:48 +0800
Subject: [PATCH 06/25] VSOCK: Introduce virtio_transport.ko
Subject: [PATCH 06/26] VSOCK: Introduce virtio_transport.ko
VM sockets virtio transport implementation. This driver runs in the
guest.

View File

@ -1,7 +1,7 @@
From f52efbc874c742a671939ea6408c59545025007d Mon Sep 17 00:00:00 2001
From: Asias He <asias@redhat.com>
Date: Thu, 13 Jun 2013 18:29:21 +0800
Subject: [PATCH 07/25] VSOCK: Introduce vhost_vsock.ko
Subject: [PATCH 07/26] VSOCK: Introduce vhost_vsock.ko
VM sockets vhost transport implementation. This driver runs on the
host.

View File

@ -1,7 +1,7 @@
From e8c8f5299fd202db5d56a10f1dc0a4e464e9a211 Mon Sep 17 00:00:00 2001
From: Asias He <asias@redhat.com>
Date: Thu, 13 Jun 2013 18:30:19 +0800
Subject: [PATCH 08/25] VSOCK: Add Makefile and Kconfig
Subject: [PATCH 08/26] VSOCK: Add Makefile and Kconfig
Enable virtio-vsock and vhost-vsock.

View File

@ -1,7 +1,7 @@
From 550ec4c8f90f2bf99c1bcb13b2f8476780f42418 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@docker.com>
Date: Mon, 4 Apr 2016 14:50:10 +0100
Subject: [PATCH 09/25] VSOCK: Only allow host network namespace to use
Subject: [PATCH 09/26] VSOCK: Only allow host network namespace to use
AF_VSOCK.
The VSOCK addressing schema does not really lend itself to simply creating an

View File

@ -1,7 +1,7 @@
From 1f7906c43fe139e15c19f35a4493a7ca61a6463f Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:47 -0800
Subject: [PATCH 10/25] Drivers: hv: vmbus: serialize process_chn_event() and
Subject: [PATCH 10/26] Drivers: hv: vmbus: serialize process_chn_event() and
vmbus_close_internal()
process_chn_event(), running in the tasklet, can race with

View File

@ -1,7 +1,7 @@
From 00375a20748490730b2f004bfe44e83abecec5f1 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:48 -0800
Subject: [PATCH 11/25] Drivers: hv: vmbus: do sanity check of channel state in
Subject: [PATCH 11/26] Drivers: hv: vmbus: do sanity check of channel state in
vmbus_close_internal()
This fixes an incorrect assumption of channel state in the function.

View File

@ -1,7 +1,7 @@
From 53cd041cabf572ec98d5b911abfff1a3baf1ccaa Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:49 -0800
Subject: [PATCH 12/25] Drivers: hv: vmbus: fix rescind-offer handling for
Subject: [PATCH 12/26] Drivers: hv: vmbus: fix rescind-offer handling for
device without a driver
In the path vmbus_onoffer_rescind() -> vmbus_device_unregister() ->

View File

@ -1,7 +1,7 @@
From 613d19efd48c06602018c0e7c6b4bf8d191105cd Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:50 -0800
Subject: [PATCH 13/25] Drivers: hv: vmbus: release relid on error in
Subject: [PATCH 13/26] Drivers: hv: vmbus: release relid on error in
vmbus_process_offer()
We want to simplify vmbus_onoffer_rescind() by not invoking

View File

@ -1,7 +1,7 @@
From b9a136e91171bea99a140195ccb4bbea2a65551d Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:51 -0800
Subject: [PATCH 14/25] Drivers: hv: vmbus: channge
Subject: [PATCH 14/26] Drivers: hv: vmbus: channge
vmbus_connection.channel_lock to mutex
spinlock is unnecessary here.

View File

@ -1,7 +1,7 @@
From 37e0f1616a680b0b209c3555812c0691dacd74e0 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:37 -0800
Subject: [PATCH 15/25] Drivers: hv: vmbus: add a helper function to set a
Subject: [PATCH 15/26] Drivers: hv: vmbus: add a helper function to set a
channel's pending send size
This will be used by the coming net/hvsock driver.

View File

@ -1,7 +1,7 @@
From 7d695c9e75755b005a7f45f99dfd7d3bb641e3a8 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:38 -0800
Subject: [PATCH 16/25] Drivers: hv: vmbus: define the new offer type for
Subject: [PATCH 16/26] Drivers: hv: vmbus: define the new offer type for
Hyper-V socket (hvsock)
A helper function is also added.

View File

@ -1,7 +1,7 @@
From 8507cfd5b7af092d5cc5e99ff9852b3bc46c48c0 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:39 -0800
Subject: [PATCH 17/25] Drivers: hv: vmbus: vmbus_sendpacket_ctl: hvsock: avoid
Subject: [PATCH 17/26] Drivers: hv: vmbus: vmbus_sendpacket_ctl: hvsock: avoid
unnecessary signaling
When the hvsock channel's outbound ringbuffer is full (i.e.,

View File

@ -1,7 +1,7 @@
From 746cdb5f4c824ef3af9d12909818a077a0cf303c Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:40 -0800
Subject: [PATCH 18/25] Drivers: hv: vmbus: define a new VMBus message type for
Subject: [PATCH 18/26] Drivers: hv: vmbus: define a new VMBus message type for
hvsock
A function to send the type of message is also added.

View File

@ -1,7 +1,7 @@
From fb6b14a429dae008b7fee772a1e27cb09db459b7 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:41 -0800
Subject: [PATCH 19/25] Drivers: hv: vmbus: add a hvsock flag in struct
Subject: [PATCH 19/26] Drivers: hv: vmbus: add a hvsock flag in struct
hv_driver
Only the coming hv_sock driver has a "true" value for this flag.

View File

@ -1,7 +1,7 @@
From 4a2d55757c137c2e574500227cb2efe77a26ee3a Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:42 -0800
Subject: [PATCH 20/25] Drivers: hv: vmbus: add a per-channel rescind callback
Subject: [PATCH 20/26] Drivers: hv: vmbus: add a per-channel rescind callback
This will be used by the coming hv_sock driver.

View File

@ -1,7 +1,7 @@
From b6c9f23164d3e7460d8983d27f2df194ab5e9a0b Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 27 Jan 2016 22:29:43 -0800
Subject: [PATCH 21/25] Drivers: hv: vmbus: add an API
Subject: [PATCH 21/26] Drivers: hv: vmbus: add an API
vmbus_hvsock_device_unregister()
The hvsock driver needs this API to release all the resources related

View File

@ -1,7 +1,7 @@
From f483aa8ef1890f82d6a362d296c21786c5ee9f30 Mon Sep 17 00:00:00 2001
From: Tom Herbert <tom@herbertland.com>
Date: Mon, 7 Mar 2016 14:11:06 -0800
Subject: [PATCH 22/25] kcm: Kernel Connection Multiplexor module
Subject: [PATCH 22/26] kcm: Kernel Connection Multiplexor module
This module implements the Kernel Connection Multiplexor.

View File

@ -1,7 +1,7 @@
From 4e7679280dd0ad8e28f9ebeea70127ed4385222a Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 21 Mar 2016 02:51:09 -0700
Subject: [PATCH 23/25] net: add the AF_KCM entries to family name tables
Subject: [PATCH 23/26] net: add the AF_KCM entries to family name tables
This is for the recent kcm driver, which introduces AF_KCM(41) in
b7ac4eb(kcm: Kernel Connection Multiplexor module).

View File

@ -1,7 +1,7 @@
From 65ca3b4d64bbe02b726a91e837605c6d082fb9b9 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 21 Mar 2016 02:52:49 -0700
Subject: [PATCH 24/25] hv_sock: introduce Hyper-V Sockets
Subject: [PATCH 24/26] hv_sock: introduce Hyper-V Sockets
Hyper-V Sockets (hv_sock) supplies a byte-stream based communication
mechanism between the host and the guest. It's somewhat like TCP over

View File

@ -1,7 +1,7 @@
From 0198717a05de80bc7769ed1d2c3a0cdf3c40fd7c Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 21 Mar 2016 02:53:08 -0700
Subject: [PATCH 25/25] net: add the AF_HYPERV entries to family name tables
Subject: [PATCH 25/26] net: add the AF_HYPERV entries to family name tables
This is for the hv_sock driver, which introduces AF_HYPERV(42).

View File

@ -0,0 +1,66 @@
From 40d8c4e56035f5c46d888b7f73cd3c99a6750c17 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@docker.com>
Date: Tue, 3 May 2016 16:11:03 +0100
Subject: [PATCH 26/26] VSOCK: do not disconnect socket when peer has shutdown
SEND only
The peer may be expecting a reply having sent a request and then done a
shutdown(SHUT_WR), so tearing down the whole socket at this point seems wrong
and breaks for me with a client which does a SHUT_WR.
Looking at other socket family's stream_recvmsg callbacks doing a shutdown here
does not seem to be the norm and removing it does not seem to have had any
adverse effects that I can see.
I'm using Stefan's RFC virtio transport patches, I'm unsure of the impact on
the vmci transport.
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Cc: Andy King <acking@vmware.com>
Cc: Dmitry Torokhov <dtor@vmware.com>
Cc: Jorgen Hansen <jhansen@vmware.com>
Cc: Adit Ranadive <aditr@vmware.com>
Cc: netdev@vger.kernel.org
---
net/vmw_vsock/af_vsock.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index ead5127..8373709 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1808,27 +1808,8 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
else if (sk->sk_shutdown & RCV_SHUTDOWN)
err = 0;
- if (copied > 0) {
- /* We only do these additional bookkeeping/notification steps
- * if we actually copied something out of the queue pair
- * instead of just peeking ahead.
- */
-
- if (!(flags & MSG_PEEK)) {
- /* If the other side has shutdown for sending and there
- * is nothing more to read, then modify the socket
- * state.
- */
- if (vsk->peer_shutdown & SEND_SHUTDOWN) {
- if (vsock_stream_has_data(vsk) <= 0) {
- sk->sk_state = SS_UNCONNECTED;
- sock_set_flag(sk, SOCK_DONE);
- sk->sk_state_change(sk);
- }
- }
- }
+ if (copied > 0)
err = copied;
- }
out:
release_sock(sk);
--
2.8.0.rc3