Skip to content
Commit e691b9d1 authored by Steve French's avatar Steve French
Browse files

[CIFS] don't allow demultiplex thread to exit until kthread_stop is called



cifs_demultiplex_thread can exit under several conditions:

1) if it's signaled
2) if there's a problem with session setup
3) if kthread_stop is called on it

The first two are problems. If kthread_stop is called on the thread,
there is no guarantee that it will still be up. We need to have the
thread stay up until kthread_stop is called on it.

One option would be to not even try to tear things down until after
kthread_stop is called. However, in the case where there is a problem
setting up the session, there's no real reason to try continuing the
loop.

This patch allows the thread to clean up and prepare for exit under all
three conditions, but it has the thread go to sleep until kthread_stop
is called. This allows us to simplify the shutdown code somewhat since
we can be reasonably sure that the thread won't exit after being
signaled but before kthread_stop is called.

It also removes the places where the thread itself set the tsk variable
since it appeared that it could have a potential race where the thread
might never be shut down.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 67750fb9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment