aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2015-03-07 19:24:29 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 10:35:44 +0100
commit834fe2e18349f024c0e565a0cdbf6bb1e0ed0ce5 (patch)
tree4eb58a462610ad94958fe5728923e5fe0722ac4d
parentstaging/lustre/llite: avoid nonatomic memory alloc under spinlock (diff)
downloadlinux-dev-834fe2e18349f024c0e565a0cdbf6bb1e0ed0ce5.tar.xz
linux-dev-834fe2e18349f024c0e565a0cdbf6bb1e0ed0ce5.zip
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>
-rw-r--r--drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
index cd2fc01dea4c..f2462e7f04bc 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
@@ -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;