lkml.org 
[lkml]   [2015]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] staging/lustre: Only set INTERRUPTIBLE state before calling schedule
Date
From: Oleg Drokin <green@linuxhacker.ru>

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: Oleg Drokin <green@linuxhacker.ru>
---
drivers/staging/lustre/lustre/include/lustre_lib.h | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index bf13563..43ee9f0 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -549,19 +549,13 @@ do { \
__blocked = cfs_block_sigsinv(0); \
\
for (;;) { \
- unsigned __wstate; \
- \
- __wstate = info->lwi_on_signal != NULL && \
- (__timeout == 0 || __allow_intr) ? \
- TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE; \
- \
- set_current_state(TASK_INTERRUPTIBLE); \
- \
if (condition) \
break; \
\
+ set_current_state(TASK_INTERRUPTIBLE); \
+ \
if (__timeout == 0) { \
- schedule(); \
+ schedule(); \
} else { \
long interval = info->lwi_interval? \
min_t(long, \
@@ -582,6 +576,8 @@ do { \
} \
} \
\
+ set_current_state(TASK_RUNNING); \
+ \
if (condition) \
break; \
if (cfs_signal_pending()) { \
@@ -605,7 +601,6 @@ do { \
\
cfs_restore_sigs(__blocked); \
\
- set_current_state(TASK_RUNNING); \
remove_wait_queue(&wq, &__wait); \
} while (0)

--
2.1.0


\
 
 \ /
  Last update: 2015-05-16 10:21    [W:0.054 / U:2.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site