git: 4a4a174959ce - stable/13 - NFSv4 server: Re-establish the delegation recall timeout

Rick Macklem rmacklem at FreeBSD.org
Mon May 31 03:37:17 UTC 2021


The branch stable/13 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=4a4a174959ce4ab35ecdf282b84f608fbf6d609e

commit 4a4a174959ce4ab35ecdf282b84f608fbf6d609e
Author:     Rick Macklem <rmacklem at FreeBSD.org>
AuthorDate: 2021-05-16 23:40:01 +0000
Commit:     Rick Macklem <rmacklem at FreeBSD.org>
CommitDate: 2021-05-31 03:34:03 +0000

    NFSv4 server: Re-establish the delegation recall timeout
    
    Commit 7a606f280a3e allowed the server to do retries of CB_RECALL
    callbacks every couple of seconds.  This was needed to allow the
    Linux client to re-establish the back channel.
    However this patch broke the delegation timeout check, such that
    it would just keep retrying CB_RECALLS.
    If the client has crashed or been network patitioned from the
    server, this continues until the client TCP reconnects to
    the server and re-establishes the back channel.
    
    This patch modifies the code such that it still times out the
    delegation recall after some minutes, so that the server will
    allow the conflicting client request once the delegation times out.
    
    This patch only affects the NFSv4 server when delegations are
    enabled and a NFSv4 client that holds a delegation has crashed
    or been network partitioned from the server for at least several
    minutes when a delegation needs to be recalled.
    
    (cherry picked from commit 46269d66ed02598c86756d81a7d7b27ec0f0c5cd)
---
 sys/fs/nfsserver/nfs_nfsdstate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index 3aebddad0962..c16d5b8afdc8 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -5292,8 +5292,9 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
 	 * - check to see if the delegation has expired
 	 *   - if so, get the v4root lock and then expire it
 	 */
-	if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || stp->ls_lastrecall <
-	    time_uptime) {
+	if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || (stp->ls_lastrecall <
+	    NFSD_MONOSEC && clp->lc_expiry >= NFSD_MONOSEC &&
+	    stp->ls_delegtime >= NFSD_MONOSEC)) {
 		/*
 		 * - do a recall callback, since not yet done
 		 * For now, never allow truncate to be set. To use


More information about the dev-commits-src-all mailing list