[LLC]: fix bug that prevented fcntl(O_NONBLOCK) from working with PF_LLC sockets

parent 5f3ea09e
...@@ -495,12 +495,6 @@ static int llc_ui_wait_for_disc(struct sock *sk, int timeout) ...@@ -495,12 +495,6 @@ static int llc_ui_wait_for_disc(struct sock *sk, int timeout)
add_wait_queue_exclusive(sk->sk_sleep, &wait); add_wait_queue_exclusive(sk->sk_sleep, &wait);
for (;;) { for (;;) {
__set_current_state(TASK_INTERRUPTIBLE); __set_current_state(TASK_INTERRUPTIBLE);
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
rc = 0; rc = 0;
if (sk->sk_state != TCP_CLOSE) { if (sk->sk_state != TCP_CLOSE) {
release_sock(sk); release_sock(sk);
...@@ -508,6 +502,12 @@ static int llc_ui_wait_for_disc(struct sock *sk, int timeout) ...@@ -508,6 +502,12 @@ static int llc_ui_wait_for_disc(struct sock *sk, int timeout)
lock_sock(sk); lock_sock(sk);
} else } else
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
remove_wait_queue(sk->sk_sleep, &wait); remove_wait_queue(sk->sk_sleep, &wait);
...@@ -525,12 +525,6 @@ static int llc_ui_wait_for_conn(struct sock *sk, int timeout) ...@@ -525,12 +525,6 @@ static int llc_ui_wait_for_conn(struct sock *sk, int timeout)
rc = -EAGAIN; rc = -EAGAIN;
if (sk->sk_state == TCP_CLOSE) if (sk->sk_state == TCP_CLOSE)
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
rc = 0; rc = 0;
if (sk->sk_state != TCP_ESTABLISHED) { if (sk->sk_state != TCP_ESTABLISHED) {
release_sock(sk); release_sock(sk);
...@@ -538,6 +532,12 @@ static int llc_ui_wait_for_conn(struct sock *sk, int timeout) ...@@ -538,6 +532,12 @@ static int llc_ui_wait_for_conn(struct sock *sk, int timeout)
lock_sock(sk); lock_sock(sk);
} else } else
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
remove_wait_queue(sk->sk_sleep, &wait); remove_wait_queue(sk->sk_sleep, &wait);
...@@ -554,12 +554,6 @@ static int llc_ui_wait_for_data(struct sock *sk, int timeout) ...@@ -554,12 +554,6 @@ static int llc_ui_wait_for_data(struct sock *sk, int timeout)
__set_current_state(TASK_INTERRUPTIBLE); __set_current_state(TASK_INTERRUPTIBLE);
if (sk->sk_shutdown & RCV_SHUTDOWN) if (sk->sk_shutdown & RCV_SHUTDOWN)
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
/* /*
* Well, if we have backlog, try to process it now. * Well, if we have backlog, try to process it now.
*/ */
...@@ -574,6 +568,12 @@ static int llc_ui_wait_for_data(struct sock *sk, int timeout) ...@@ -574,6 +568,12 @@ static int llc_ui_wait_for_data(struct sock *sk, int timeout)
lock_sock(sk); lock_sock(sk);
} else } else
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
remove_wait_queue(sk->sk_sleep, &wait); remove_wait_queue(sk->sk_sleep, &wait);
...@@ -593,12 +593,6 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout) ...@@ -593,12 +593,6 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout)
rc = -ENOTCONN; rc = -ENOTCONN;
if (sk->sk_shutdown & RCV_SHUTDOWN) if (sk->sk_shutdown & RCV_SHUTDOWN)
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
rc = 0; rc = 0;
if (llc_data_accept_state(llc->state) || llc->p_flag) { if (llc_data_accept_state(llc->state) || llc->p_flag) {
release_sock(sk); release_sock(sk);
...@@ -606,6 +600,12 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout) ...@@ -606,6 +600,12 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout)
lock_sock(sk); lock_sock(sk);
} else } else
break; break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
remove_wait_queue(sk->sk_sleep, &wait); remove_wait_queue(sk->sk_sleep, &wait);
......
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