Patch "vsock: use new wait API for vsock_stream_sendmsg()" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
vsock: use new wait API for vsock_stream_sendmsg()
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
vsock-use-new-wait-api-for-vsock_stream_sendmsg.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
499fde662f1957e3cb8d192a94a099ebe19c714bMon Sep 17 00:00:00 2001
From: WANG Cong <[email protected]>
Date: Fri, 19 May 2017 11:21:59 -0700
Subject: vsock: use new wait API for vsock_stream_sendmsg()
From: WANG Cong <[email protected]>
commit 499fde662f1957e3cb8d192a94a099ebe19c714b upstream.
As reported by Michal, vsock_stream_sendmsg() could still sleep at vsock_stream_has_space() after prepare_to_wait():
vsock_stream_has_space
vmci_transport_stream_has_space
vmci_qpair_produce_free_space
qp_lock
qp_acquire_queue_mutex
mutex_lock
Just switch to the new wait API like we did for commit d9dc8b0f8b4e ("net: fix sleeping for sk_wait_event()").
--- net/vmw_vsock/af_vsock.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
net/vmw_vsock/af_vsock.c +8 -13
@@ -1524,8 +1524,7 @@ static int vsock_stream_sendmsg(struct slong timeout;int err;struct vsock_transport_send_notify_data send_data; - -DEFINE_WAIT (wait); +DEFINE_WAIT_FUNC (wait, woken_wake_function); sk = sock->sk; vsk =vsock_sk (sk);
@@ -1568,11 +1567,10 @@ static int vsock_stream_sendmsg(struct sif (err <0 ) goto out; -while (total_written < len) {ssize_t written; -prepare_to_wait (sk_sleep (sk), &wait,TASK_INTERRUPTIBLE ); +add_wait_queue (sk_sleep (sk), &wait); while (vsock_stream_has_space(vsk) == 0 && sk->sk_err == 0 && !(sk->sk_shutdown & SEND_SHUTDOWN) &&
@@ -1581,33 +1579,30 @@ static int vsock_stream_sendmsg(struct s/* Don't wait for non-blocking sockets. */ if (timeout ==0 ) { err = -EAGAIN ; -finish_wait (sk_sleep (sk), &wait); +remove_wait_queue (sk_sleep (sk), &wait); goto out_err; } err = transport->notify_send_pre_block (vsk, &send_data);if (err <0 ) { -finish_wait (sk_sleep (sk), &wait); +remove_wait_queue (sk_sleep (sk), &wait); goto out_err; }release_sock (sk); - timeout =schedule_timeout (timeout); + timeout =wait_woken (&wait,TASK_INTERRUPTIBLE , timeout);lock_sock (sk);if (signal_pending (current)) { err =sock_intr_errno (timeout); -finish_wait (sk_sleep (sk), &wait); +remove_wait_queue (sk_sleep (sk), &wait); goto out_err; }else if (timeout ==0 ) { err = -EAGAIN ; -finish_wait (sk_sleep (sk), &wait); +remove_wait_queue (sk_sleep (sk), &wait); goto out_err; } - -prepare_to_wait (sk_sleep (sk), &wait, -TASK_INTERRUPTIBLE ); } -finish_wait (sk_sleep (sk), &wait); +remove_wait_queue (sk_sleep (sk), &wait);/* These checks occur both as part of and after the loop * conditional since we need to check before and after
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/vsock-use-new-wait-api-for-vsock_stream_sendmsg.patch queue-4.9/ipv6-only-call-ip6_route_dev_notify-once-for-netdev_unregister.patch