Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5786813ybi; Sun, 7 Jul 2019 12:38:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmw4QbBVyEUCbZt1bZFSDFnF3k5FqoXl0C/7Y0rQ86/6X2Aahi7kex0imcIXYFSowLwYHO X-Received: by 2002:a63:5920:: with SMTP id n32mr4678781pgb.352.1562528337542; Sun, 07 Jul 2019 12:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562528337; cv=none; d=google.com; s=arc-20160816; b=wR5cCTlbSBS2JuVAANux+tOJEkY9xX/HVNfEzA0S3PjTNK5IokQVhx6J+kqyd5QVpD QFchTgkvUrZ4UYjHdYeOiLN5hg+wuygi0G0gV7QZvGhPaqQf4mzYc8M3nykjNPePA5i3 OKlTSMzUy8K7Pnu9CS7dipcVHLz39s8lB3+vjFy1D6vnYUoejMMfqnSOp3bjE0GVO3e2 1DRU5crou9vQrINVDdI+w8ftus0vpkhb7AaifYqi2DOSTJpgddp+Se4vwWistyLhTXyM lCm2LffrKmiumgDQU3u16QlS83Oy++9U708yjs1uJhQy9TpzjZEjrIlKT2YiozC90e/Q z1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=219pnBdU977XvXyYuCbqmFjtBUfKB4tGfgNygjM40HE=; b=yDScZo4KqopOiDL16wIslKMuFtosTgqzLSTdIxS2aaOEdrLeEZGiVHJSNOuzJdVIXq pG3frqBDnHLBMuh/TsLVkm1Omh6gGlk2dcviApxR40EWXL5TZqFVTEOElBWJEENdxSlO MxJ/fuJU2Z97Qr1YOzQYYFHsurtRtGthmqQ29/ElrFiG/uSUibxL8tXNwr5Iw5nVHlmA phbCL4vZMU/bG+cneOUsDCDTDrmY975lBoa4gfRRwRPAnpHKSEZWiv1sMg5BjS9d4AG9 69bjkYNp6dRo3lpRvt/tujdW+bjCOwbzAwLJyjgJsFzot6z3Pw/oI0x4SEcwD8nE1+1v YK6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o39si16091658pje.28.2019.07.07.12.38.29; Sun, 07 Jul 2019 12:38:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbfGGT0b (ORCPT + 99 others); Sun, 7 Jul 2019 15:26:31 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:48403 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727321AbfGGT0a (ORCPT ); Sun, 7 Jul 2019 15:26:30 -0400 Received: from theinternet.molgen.mpg.de (theinternet.molgen.mpg.de [141.14.31.7]) by mx.molgen.mpg.de (Postfix) with ESMTP id 2362920669598; Sun, 7 Jul 2019 21:26:28 +0200 (CEST) From: Donald Buczek To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: Donald Buczek Subject: [PATCH V2 4/4] nfs4.0: Refetch lease_time after clientid update Date: Sun, 7 Jul 2019 21:26:10 +0200 Message-Id: <20190707192610.14335-5-buczek@molgen.mpg.de> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190707192610.14335-1-buczek@molgen.mpg.de> References: <20190707192610.14335-1-buczek@molgen.mpg.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org RFC 7530 requires us to refetch the lease time attribute once a new clientID is established. This is already implemented for the nfs4.1(+) clients by nfs41_init_clientid, which calls nfs41_finish_session_reset, which calls nfs4_setup_state_renewal. To make nfs4_setup_state_renewal available for nfs4.0, move it further to the top of the source file to include it regardles of CONFIG_NFS_V4_1 and to save a forward declaration. Call nfs4_setup_state_renewal from nfs4_init_clientid. Signed-off-by: Donald Buczek --- fs/nfs/nfs4state.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 778ebfb00d13..f32b02c2bc73 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -87,6 +87,27 @@ const nfs4_stateid current_stateid = { static DEFINE_MUTEX(nfs_clid_init_mutex); +static int nfs4_setup_state_renewal(struct nfs_client *clp) +{ + int status; + struct nfs_fsinfo fsinfo; + unsigned long now; + + if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { + nfs4_schedule_state_renewal(clp); + return 0; + } + + now = jiffies; + status = nfs4_proc_get_lease_time(clp, &fsinfo); + if (status == 0) { + nfs4_set_lease_period(clp, fsinfo.lease_time * HZ, now); + nfs4_schedule_state_renewal(clp); + } + + return status; +} + int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred) { struct nfs4_setclientid_res clid = { @@ -114,7 +135,7 @@ int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred) if (status != 0) goto out; clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); - nfs4_schedule_state_renewal(clp); + nfs4_setup_state_renewal(clp); out: return status; } @@ -286,27 +307,6 @@ static int nfs4_begin_drain_session(struct nfs_client *clp) #if defined(CONFIG_NFS_V4_1) -static int nfs4_setup_state_renewal(struct nfs_client *clp) -{ - int status; - struct nfs_fsinfo fsinfo; - unsigned long now; - - if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { - nfs4_schedule_state_renewal(clp); - return 0; - } - - now = jiffies; - status = nfs4_proc_get_lease_time(clp, &fsinfo); - if (status == 0) { - nfs4_set_lease_period(clp, fsinfo.lease_time * HZ, now); - nfs4_schedule_state_renewal(clp); - } - - return status; -} - static void nfs41_finish_session_reset(struct nfs_client *clp) { clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); -- 2.22.0