Patchwork UBI: Don't exit from ubi_thread until kthread_should_stop() is true

login
register
mail settings
Submitter Vitaliy Gusev
Date Nov. 5, 2008, 3:27 p.m.
Message ID <200811051827.19164.vgusev@openvz.org>
Download mbox | patch
Permalink /patch/7352/
State Accepted
Commit 2ad49887150894b9ed6a87a76b409adceee6b074
Headers show

Comments

Vitaliy Gusev - Nov. 5, 2008, 3:27 p.m.
If ubi_thread() exits but kthread_should_stop() is not true
then kthread_stop() will never return and cleanup thread
will forever stay in "D" state.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

---
Artem Bityutskiy - Nov. 6, 2008, 7:22 a.m.
On Wed, 2008-11-05 at 18:27 +0300, Vitaliy Gusev wrote:
> If ubi_thread() exits but kthread_should_stop() is not true
> then kthread_stop() will never return and cleanup thread
> will forever stay in "D" state.
> 
> Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

Thanks, I'll push your patch.

Patch

diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 05d7093..dcb6dac 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1396,7 +1396,8 @@  int ubi_thread(void *u)
 				ubi_msg("%s: %d consecutive failures",
 					ubi->bgt_name, WL_MAX_FAILURES);
 				ubi_ro_mode(ubi);
-				break;
+				ubi->thread_enabled = 0;
+				continue;
 			}
 		} else
 			failures = 0;