aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-10-15 11:20:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 20:28:52 -0400
commit12aebf3e1ad7dc8b076dd9674ca98f1aa6859fcd (patch)
tree545b9655e797629fa3baff874aebb866cd1c67ec /drivers/mtd/mtd_blkdevs.c
parent480792b7bf188c29b8d4b10fee65c3a06ec5dbf7 (diff)
mtd: blktrans: fix a race vs kthread_stop
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 <maximlevisky@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 040c2d923807..a919587ed481 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -133,6 +133,10 @@ static int mtd_blktrans_thread(void *arg)
133 133
134 if (!req && !(req = blk_fetch_request(rq))) { 134 if (!req && !(req = blk_fetch_request(rq))) {
135 set_current_state(TASK_INTERRUPTIBLE); 135 set_current_state(TASK_INTERRUPTIBLE);
136
137 if (kthread_should_stop())
138 set_current_state(TASK_RUNNING);
139
136 spin_unlock_irq(rq->queue_lock); 140 spin_unlock_irq(rq->queue_lock);
137 schedule(); 141 schedule();
138 spin_lock_irq(rq->queue_lock); 142 spin_lock_irq(rq->queue_lock);