mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 21:45:45 +02:00
Revert "vsock: each transport cycles only on its own sockets"
This reverts commitd9fe590970which is commit8e6ed96376upstream. If this needs to come back into an Android kernel, it should be redone in an ABI-neutral way. Fixes:d9fe590970("vsock: each transport cycles only on its own sockets") Cc: Jiyong Park <jiyong@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: If67ee273bd40d160ed92f058a5e8c866126ea46a
This commit is contained in:
parent
644c989f41
commit
ab2d1d40a1
|
|
@ -697,8 +697,7 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file)
|
||||||
|
|
||||||
/* Iterating over all connections for all CIDs to find orphans is
|
/* Iterating over all connections for all CIDs to find orphans is
|
||||||
* inefficient. Room for improvement here. */
|
* inefficient. Room for improvement here. */
|
||||||
vsock_for_each_connected_socket(&vhost_transport.transport,
|
vsock_for_each_connected_socket(vhost_vsock_reset_orphans);
|
||||||
vhost_vsock_reset_orphans);
|
|
||||||
|
|
||||||
/* Don't check the owner, because we are in the release path, so we
|
/* Don't check the owner, because we are in the release path, so we
|
||||||
* need to stop the vsock device in any case.
|
* need to stop the vsock device in any case.
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,7 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr);
|
||||||
struct sock *vsock_find_connected_socket(struct sockaddr_vm *src,
|
struct sock *vsock_find_connected_socket(struct sockaddr_vm *src,
|
||||||
struct sockaddr_vm *dst);
|
struct sockaddr_vm *dst);
|
||||||
void vsock_remove_sock(struct vsock_sock *vsk);
|
void vsock_remove_sock(struct vsock_sock *vsk);
|
||||||
void vsock_for_each_connected_socket(struct vsock_transport *transport,
|
void vsock_for_each_connected_socket(void (*fn)(struct sock *sk));
|
||||||
void (*fn)(struct sock *sk));
|
|
||||||
int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk);
|
int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk);
|
||||||
bool vsock_find_cid(unsigned int cid);
|
bool vsock_find_cid(unsigned int cid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,8 +333,7 @@ void vsock_remove_sock(struct vsock_sock *vsk)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(vsock_remove_sock);
|
EXPORT_SYMBOL_GPL(vsock_remove_sock);
|
||||||
|
|
||||||
void vsock_for_each_connected_socket(struct vsock_transport *transport,
|
void vsock_for_each_connected_socket(void (*fn)(struct sock *sk))
|
||||||
void (*fn)(struct sock *sk))
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -343,12 +342,8 @@ void vsock_for_each_connected_socket(struct vsock_transport *transport,
|
||||||
for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) {
|
for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) {
|
||||||
struct vsock_sock *vsk;
|
struct vsock_sock *vsk;
|
||||||
list_for_each_entry(vsk, &vsock_connected_table[i],
|
list_for_each_entry(vsk, &vsock_connected_table[i],
|
||||||
connected_table) {
|
connected_table)
|
||||||
if (vsk->transport != transport)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fn(sk_vsock(vsk));
|
fn(sk_vsock(vsk));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_bh(&vsock_table_lock);
|
spin_unlock_bh(&vsock_table_lock);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
static struct workqueue_struct *virtio_vsock_workqueue;
|
static struct workqueue_struct *virtio_vsock_workqueue;
|
||||||
static struct virtio_vsock __rcu *the_virtio_vsock;
|
static struct virtio_vsock __rcu *the_virtio_vsock;
|
||||||
static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
|
static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
|
||||||
static struct virtio_transport virtio_transport; /* forward declaration */
|
|
||||||
|
|
||||||
struct virtio_vsock {
|
struct virtio_vsock {
|
||||||
struct virtio_device *vdev;
|
struct virtio_device *vdev;
|
||||||
|
|
@ -384,8 +383,7 @@ static void virtio_vsock_event_handle(struct virtio_vsock *vsock,
|
||||||
switch (le32_to_cpu(event->id)) {
|
switch (le32_to_cpu(event->id)) {
|
||||||
case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
|
case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
|
||||||
virtio_vsock_update_guest_cid(vsock);
|
virtio_vsock_update_guest_cid(vsock);
|
||||||
vsock_for_each_connected_socket(&virtio_transport.transport,
|
vsock_for_each_connected_socket(virtio_vsock_reset_sock);
|
||||||
virtio_vsock_reset_sock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,8 +635,7 @@ static void virtio_vsock_remove(struct virtio_device *vdev)
|
||||||
synchronize_rcu();
|
synchronize_rcu();
|
||||||
|
|
||||||
/* Reset all connected sockets when the device disappear */
|
/* Reset all connected sockets when the device disappear */
|
||||||
vsock_for_each_connected_socket(&virtio_transport.transport,
|
vsock_for_each_connected_socket(virtio_vsock_reset_sock);
|
||||||
virtio_vsock_reset_sock);
|
|
||||||
|
|
||||||
/* Stop all work handlers to make sure no one is accessing the device,
|
/* Stop all work handlers to make sure no one is accessing the device,
|
||||||
* so we can safely call vdev->config->reset().
|
* so we can safely call vdev->config->reset().
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,6 @@ static u32 vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID;
|
||||||
|
|
||||||
static int PROTOCOL_OVERRIDE = -1;
|
static int PROTOCOL_OVERRIDE = -1;
|
||||||
|
|
||||||
static struct vsock_transport vmci_transport; /* forward declaration */
|
|
||||||
|
|
||||||
/* Helper function to convert from a VMCI error code to a VSock error code. */
|
/* Helper function to convert from a VMCI error code to a VSock error code. */
|
||||||
|
|
||||||
static s32 vmci_transport_error_to_vsock_error(s32 vmci_error)
|
static s32 vmci_transport_error_to_vsock_error(s32 vmci_error)
|
||||||
|
|
@ -884,8 +882,7 @@ static void vmci_transport_qp_resumed_cb(u32 sub_id,
|
||||||
const struct vmci_event_data *e_data,
|
const struct vmci_event_data *e_data,
|
||||||
void *client_data)
|
void *client_data)
|
||||||
{
|
{
|
||||||
vsock_for_each_connected_socket(&vmci_transport,
|
vsock_for_each_connected_socket(vmci_transport_handle_detach);
|
||||||
vmci_transport_handle_detach);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vmci_transport_recv_pkt_work(struct work_struct *work)
|
static void vmci_transport_recv_pkt_work(struct work_struct *work)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user