Commit a274f6ff authored by Arseniy Krasnov's avatar Arseniy Krasnov Committed by Paolo Abeni
Browse files

vmci/vsock: use 'target' in notify_poll_in callback



This callback controls setting of POLLIN, POLLRDNORM output bits of poll()
syscall, but in some cases, it is incorrectly to set it, when socket has
at least 1 bytes of available data. Use 'target' which is already exists.

Signed-off-by: default avatarArseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Reviewed-by: default avatarVishnu Dasa <vdasa@vmware.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent e7a3266c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -340,12 +340,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk,
{
	struct vsock_sock *vsk = vsock_sk(sk);

	if (vsock_stream_has_data(vsk)) {
	if (vsock_stream_has_data(vsk) >= target) {
		*data_ready_now = true;
	} else {
		/* We can't read right now because there is nothing in the
		 * queue. Ask for notifications when there is something to
		 * read.
		/* We can't read right now because there is not enough data
		 * in the queue. Ask for notifications when there is something
		 * to read.
		 */
		if (sk->sk_state == TCP_ESTABLISHED) {
			if (!send_waiting_read(sk, 1))
+4 −4
Original line number Diff line number Diff line
@@ -161,12 +161,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk,
{
	struct vsock_sock *vsk = vsock_sk(sk);

	if (vsock_stream_has_data(vsk)) {
	if (vsock_stream_has_data(vsk) >= target) {
		*data_ready_now = true;
	} else {
		/* We can't read right now because there is nothing in the
		 * queue. Ask for notifications when there is something to
		 * read.
		/* We can't read right now because there is not enough data
		 * in the queue. Ask for notifications when there is something
		 * to read.
		 */
		if (sk->sk_state == TCP_ESTABLISHED)
			vsock_block_update_write_window(sk);