From owner-svn-src-projects@freebsd.org Sat Jul 14 13:45:32 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 75952102B980 for ; Sat, 14 Jul 2018 13:45:32 +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 2730B7A5AF; Sat, 14 Jul 2018 13:45:32 +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 087061FC73; Sat, 14 Jul 2018 13:45:32 +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 w6EDjV6Q039647; Sat, 14 Jul 2018 13:45:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EDjVKq039646; Sat, 14 Jul 2018 13:45:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807141345.w6EDjVKq039646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 14 Jul 2018 13:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r336277 - projects/pnfs-planb-server/sys/fs/nfs X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfs X-SVN-Commit-Revision: 336277 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: Sat, 14 Jul 2018 13:45:32 -0000 Author: rmacklem Date: Sat Jul 14 13:45:31 2018 New Revision: 336277 URL: https://svnweb.freebsd.org/changeset/base/336277 Log: Set CLSET_TIMEOUT() on a TCP connection to a DS to lease_duration/4. Setting the value this way results in the DS being disabled after approximately the lease duration, due to retries within the krpc. At least this is what I am seeing during testing and making it a fraction of the lease duration seemed better than just picking an arbitrary timeout. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c Sat Jul 14 13:39:21 2018 (r336276) +++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c Sat Jul 14 13:45:31 2018 (r336277) @@ -98,6 +98,7 @@ extern int nfscl_ticks; extern void (*ncl_call_invalcaches)(struct vnode *); extern int nfs_numnfscbd; extern int nfscl_debuglevel; +extern int nfsrv_lease; SVCPOOL *nfscbd_pool; static int nfsrv_gsscallbackson = 0; @@ -195,8 +196,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq */ if (nrp->nr_cred != NULL) td->td_ucred = nrp->nr_cred; - else if (cred != NULL) + else { + KASSERT(cred != NULL, ("newnfs_request: null cred")); td->td_ucred = cred; + } saddr = nrp->nr_nam; if (saddr->sa_family == AF_INET) @@ -300,7 +303,9 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq if (cred != NULL) { if (NFSHASSOFT(nmp)) { /* This should be a DS mount. */ - timo.tv_sec = 15; + timo.tv_sec = nfsrv_lease / 4; + if (timo.tv_sec < 10) + timo.tv_sec = 10; timo.tv_usec = 0; CLNT_CONTROL(client, CLSET_TIMEOUT, &timo); @@ -333,7 +338,9 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq * only case where using a "soft" mount is * recommended for NFSv4. */ - timo.tv_sec = 15; + timo.tv_sec = nfsrv_lease / 4; + if (timo.tv_sec < 10) + timo.tv_sec = 10; timo.tv_usec = 0; CLNT_CONTROL(client, CLSET_TIMEOUT, &timo); retries = 2;