mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
SUNRPC: Fix a server shutdown leak
[ Upstream commit9ca6705d9d] Fix a race where kthread_stop() may prevent the threadfn from ever getting called. If that happens the svc_rqst will not be cleaned up. Fixes:ed6473ddc7("NFSv4: Fix callback server shutdown") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e1b8342a85
commit
ce7dd61e00
@@ -800,6 +800,7 @@ EXPORT_SYMBOL_GPL(svc_set_num_threads);
|
|||||||
static int
|
static int
|
||||||
svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
|
svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
|
||||||
{
|
{
|
||||||
|
struct svc_rqst *rqstp;
|
||||||
struct task_struct *task;
|
struct task_struct *task;
|
||||||
unsigned int state = serv->sv_nrthreads-1;
|
unsigned int state = serv->sv_nrthreads-1;
|
||||||
|
|
||||||
@@ -808,7 +809,10 @@ svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
|
|||||||
task = choose_victim(serv, pool, &state);
|
task = choose_victim(serv, pool, &state);
|
||||||
if (task == NULL)
|
if (task == NULL)
|
||||||
break;
|
break;
|
||||||
kthread_stop(task);
|
rqstp = kthread_data(task);
|
||||||
|
/* Did we lose a race to svo_function threadfn? */
|
||||||
|
if (kthread_stop(task) == -EINTR)
|
||||||
|
svc_exit_thread(rqstp);
|
||||||
nrservs++;
|
nrservs++;
|
||||||
} while (nrservs < 0);
|
} while (nrservs < 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user