From b5555f77115bfba3630fefff2d4e68140b644171 Mon Sep 17 00:00:00 2001 From: Amit Gud Date: Thu, 2 Apr 2009 17:01:27 -0400 Subject: Btrfs: fix race in worker_loop Need to check kthread_should_stop after schedule_timeout() before calling schedule(). This causes threads to sleep with potentially no one to wake them up causing mount(2) to hang in btrfs_stop_workers waiting for threads to stop. Signed-off-by: Amit Gud Signed-off-by: Chris Mason --- fs/btrfs/async-thread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'fs/btrfs/async-thread.c') diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index c84ca1f5259..cba701dba35 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -195,6 +195,9 @@ again_locked: if (!list_empty(&worker->pending)) continue; + if (kthread_should_stop()) + break; + /* still no more work?, sleep for real */ spin_lock_irq(&worker->lock); set_current_state(TASK_INTERRUPTIBLE); @@ -208,7 +211,8 @@ again_locked: worker->working = 0; spin_unlock_irq(&worker->lock); - schedule(); + if (!kthread_should_stop()) + schedule(); } __set_current_state(TASK_RUNNING); } -- cgit v1.2.3-70-g09d2 From 2e966ed22c3c56227f8a7322d7b008945352e6ab Mon Sep 17 00:00:00 2001 From: Jim Owens Date: Thu, 2 Apr 2009 17:02:55 -0400 Subject: Btrfs: remove unused ftrace include Signed-off-by: jim owens Signed-off-by: Chris Mason --- fs/btrfs/async-thread.c | 1 - fs/btrfs/delayed-ref.c | 1 - 2 files changed, 2 deletions(-) (limited to 'fs/btrfs/async-thread.c') diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index cba701dba35..51bfdfc8fcd 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "async-thread.h" #define WORK_QUEUED_BIT 0 diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index cbf7dc8ae3e..d6c01c096a4 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -18,7 +18,6 @@ #include #include -#include #include "ctree.h" #include "delayed-ref.h" #include "transaction.h" -- cgit v1.2.3-70-g09d2