[PATCH] fault-inject: use correct check for interrupts

From: Dmitry Vyukov
Date: Tue Mar 21 2017 - 05:18:20 EST


in_interrupt() also returns true when bh is disabled in task context.
That's not what fail_task() wants to check.
Use the new in_task() predicate that does the right thing.

Signed-off-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
Cc: akinobu.mita@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx

---

Andrew, do you mind taking this to mm?
---
lib/fault-inject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 6a823a53e357..4ff157159a0d 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -56,7 +56,7 @@ static void fail_dump(struct fault_attr *attr)

static bool fail_task(struct fault_attr *attr, struct task_struct *task)
{
- return !in_interrupt() && task->make_it_fail;
+ return in_task() && task->make_it_fail;
}

#define MAX_STACK_TRACE_DEPTH 32
--
2.12.1.500.gab5fba24ee-goog