Commit 65609bd6 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre: Only set INTERRUPTIBLE state before calling schedule

In __l_wait_event the condition could be a complicated function that does
allocations and other potentialy blocking activities, so it sohuld
not be called in a task state other than RUNNABLE
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e630eb48
...@@ -549,19 +549,13 @@ do { \ ...@@ -549,19 +549,13 @@ do { \
__blocked = cfs_block_sigsinv(0); \ __blocked = cfs_block_sigsinv(0); \
\ \
for (;;) { \ for (;;) { \
unsigned __wstate; \
\
__wstate = info->lwi_on_signal != NULL && \
(__timeout == 0 || __allow_intr) ? \
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE; \
\
set_current_state(TASK_INTERRUPTIBLE); \
\
if (condition) \ if (condition) \
break; \ break; \
\ \
set_current_state(TASK_INTERRUPTIBLE); \
\
if (__timeout == 0) { \ if (__timeout == 0) { \
schedule(); \ schedule(); \
} else { \ } else { \
long interval = info->lwi_interval? \ long interval = info->lwi_interval? \
min_t(long, \ min_t(long, \
...@@ -582,6 +576,8 @@ do { \ ...@@ -582,6 +576,8 @@ do { \
} \ } \
} \ } \
\ \
set_current_state(TASK_RUNNING); \
\
if (condition) \ if (condition) \
break; \ break; \
if (cfs_signal_pending()) { \ if (cfs_signal_pending()) { \
...@@ -605,7 +601,6 @@ do { \ ...@@ -605,7 +601,6 @@ do { \
\ \
cfs_restore_sigs(__blocked); \ cfs_restore_sigs(__blocked); \
\ \
set_current_state(TASK_RUNNING); \
remove_wait_queue(&wq, &__wait); \ remove_wait_queue(&wq, &__wait); \
} while (0) } while (0)
......
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