From owner-svn-src-projects@freebsd.org Mon Jul 2 17:54:34 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BF73103258D for ; Mon, 2 Jul 2018 17:54:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D59D97324B; Mon, 2 Jul 2018 17:54:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6D4610CE2; Mon, 2 Jul 2018 17:54:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w62HsX3B062415; Mon, 2 Jul 2018 17:54:33 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w62HsXo6062414; Mon, 2 Jul 2018 17:54:33 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807021754.w62HsXo6062414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 2 Jul 2018 17:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r335867 - projects/pnfs-planb-server/sys/rpc X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/rpc X-SVN-Commit-Revision: 335867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 17:54:34 -0000 Author: rmacklem Date: Mon Jul 2 17:54:33 2018 New Revision: 335867 URL: https://svnweb.freebsd.org/changeset/base/335867 Log: Fix the server side krpc so that the kernel nfsd threads terminate. Occationally the kernel nfsd threads would not terminate when a SIGKILL was posted for the kernel process (called nfsd (slave)). When this occurred, the thread associated with the process (called "ismaster") had returned from svc_run_internal() and was sleeping waiting for the other threads to terminate. The other threads (created by kthread_start()) were still in svc_run_internal() handling NFS RPCs. The only way this could occur is for the "ismaster" thread to return from svc_run_internal() without having called svc_exit(). There was only one place in the code where this could happen and this patch stops that from happening. Since the problem is intermittent, I cannot be sure if this has fixed the problem, but I have not seen an occurrence of the problem with this patch applied. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D16087 Modified: projects/pnfs-planb-server/sys/rpc/svc.c Modified: projects/pnfs-planb-server/sys/rpc/svc.c ============================================================================== --- projects/pnfs-planb-server/sys/rpc/svc.c Mon Jul 2 17:50:46 2018 (r335866) +++ projects/pnfs-planb-server/sys/rpc/svc.c Mon Jul 2 17:54:33 2018 (r335867) @@ -1185,7 +1185,8 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) /* * Enforce maxthreads count. */ - if (grp->sg_threadcount > grp->sg_maxthreads) + if (!ismaster && grp->sg_threadcount > + grp->sg_maxthreads) break; /*