Skip to content

Commit

Permalink
mtd: blktrans: fix a race vs kthread_stop
Browse files Browse the repository at this point in the history
There is small race window that could make kthread_stop hang forever.
I found that while hacking the IR subsystem.

Signed-off-by: Maxim Levitsky <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
maximlevitsky authored and David Woodhouse committed Oct 25, 2010
1 parent 480792b commit 12aebf3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ static int mtd_blktrans_thread(void *arg)

if (!req && !(req = blk_fetch_request(rq))) {
set_current_state(TASK_INTERRUPTIBLE);

if (kthread_should_stop())
set_current_state(TASK_RUNNING);

spin_unlock_irq(rq->queue_lock);
schedule();
spin_lock_irq(rq->queue_lock);
Expand Down

0 comments on commit 12aebf3

Please sign in to comment.