提交 1dd761e9 编写于 作者: T Trond Myklebust

NFSv4: Ensure the callback daemon flushes signals

If the callback daemon is signalled, but is unable to exit because it still
has users, then we need to flush signals. If not, then svc_recv() can
never sleep, and so we hang.
If we flush signals, then we also have to be prepared to resend them when
we want the thread to exit.
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 54281548
...@@ -55,7 +55,12 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) ...@@ -55,7 +55,12 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
complete(&nfs_callback_info.started); complete(&nfs_callback_info.started);
while (nfs_callback_info.users != 0 || !signalled()) { for(;;) {
if (signalled()) {
if (nfs_callback_info.users == 0)
break;
flush_signals(current);
}
/* /*
* Listen for a request on the socket * Listen for a request on the socket
*/ */
...@@ -135,11 +140,13 @@ int nfs_callback_down(void) ...@@ -135,11 +140,13 @@ int nfs_callback_down(void)
lock_kernel(); lock_kernel();
down(&nfs_callback_sema); down(&nfs_callback_sema);
if (--nfs_callback_info.users || nfs_callback_info.pid == 0) nfs_callback_info.users--;
goto out; do {
kill_proc(nfs_callback_info.pid, SIGKILL, 1); if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0)
wait_for_completion(&nfs_callback_info.stopped); break;
out: if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0)
break;
} while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0);
up(&nfs_callback_sema); up(&nfs_callback_sema);
unlock_kernel(); unlock_kernel();
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册