Stopping a kthread in module exit(system hangs!) - linux

From: Ganesh Karuppur Rajagopalan
Date: Thu Jul 21 2011 - 17:14:37 EST

Hi all,

The kernel version we are using is . In our block device
driver module we create and run a kthread using "kthread_run" during
module_init.This kthread runs until we issue a "kthread_stop" from the
module_exit code.In the thread function we repeatedly check for
"kthread_should_stop" and when the condition is met (due to the
kthread_stop call) we "return 0;". Our thread function wouldn't return
in any other scenario.

Our problem right now is that when we do an "rmmod" the system just
hangs!.This we have identified is due to the kthread_stop. Can you
please give us some pointers/directions regarding the possible
underlying issue.Specifically is there a problem while calling
kthread_stop and waiting on the thread completion in the module exit

Thanks and Regards
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at