Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12aebf3e authored by Maxim Levitsky's avatar Maxim Levitsky Committed by David Woodhouse
Browse files

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: default avatarMaxim Levitsky <maximlevisky@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 480792b7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);