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

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
...@@ -340,12 +340,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk, ...@@ -340,12 +340,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk,
{ {
struct vsock_sock *vsk = vsock_sk(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; *data_ready_now = true;
} else { } else {
/* We can't read right now because there is nothing in the /* We can't read right now because there is not enough data
* queue. Ask for notifications when there is something to * in the queue. Ask for notifications when there is something
* read. * to read.
*/ */
if (sk->sk_state == TCP_ESTABLISHED) { if (sk->sk_state == TCP_ESTABLISHED) {
if (!send_waiting_read(sk, 1)) if (!send_waiting_read(sk, 1))
......
...@@ -161,12 +161,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk, ...@@ -161,12 +161,12 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk,
{ {
struct vsock_sock *vsk = vsock_sk(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; *data_ready_now = true;
} else { } else {
/* We can't read right now because there is nothing in the /* We can't read right now because there is not enough data
* queue. Ask for notifications when there is something to * in the queue. Ask for notifications when there is something
* read. * to read.
*/ */
if (sk->sk_state == TCP_ESTABLISHED) if (sk->sk_state == TCP_ESTABLISHED)
vsock_block_update_write_window(sk); vsock_block_update_write_window(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment