staging/lustre: Don't call blocking funcitons when !RUNNABLE

Move setting of TASK_INTERRUPTIBLE just around schedule call in
libcfs_sock_accept.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Oleg Drokin 2015-03-07 19:24:29 -05:00 коммит произвёл Greg Kroah-Hartman
Родитель aac2e54f9e
Коммит 834fe2e183
1 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -543,19 +543,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
newsock->ops = sock->ops;
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(sk_sleep(sock->sk), &wait);
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
if (rc == -EAGAIN) {
/* Nothing ready, so wait for activity */
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(sk_sleep(sock->sk), &wait);
schedule();
remove_wait_queue(sk_sleep(sock->sk), &wait);
set_current_state(TASK_RUNNING);
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
}
remove_wait_queue(sk_sleep(sock->sk), &wait);
set_current_state(TASK_RUNNING);
if (rc != 0)
goto failed;