Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2300126yba; Fri, 17 May 2019 14:25:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwbapP/lXMlCwJmNp1VBvZ1pkQ9C9RbZou4BTUtTkkYgMtlvcZbxooQ9Mqe4ogBXWXnmf5 X-Received: by 2002:a17:902:a60e:: with SMTP id u14mr55104970plq.94.1558128357904; Fri, 17 May 2019 14:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558128357; cv=none; d=google.com; s=arc-20160816; b=uKR9Fo2InB9TFuKLAO+YsnfmQiY58PiVtN1sDNqZlpzjEz4KN2YhPhDhHo8js3WJNE f9s+UBJ7mFJCzmODuFfpvTLVJXhucrwdeYhAskKtgV3bawFKlqDkYKPWfLgS34PIR0hG hb0rYZqPwFrv+lREpOqEUs5XIv18QJam5dnClMi34yx7/nCj7WAv4eqR1fES+A8bx48q BqZDWZif1j/a11TpkZaTU5AEezPk1St5VgFjFFuQDhyycBnqQ9jtyGJKu4rhXHvyjo9P h4cs7GhYXPUE31k0QHhqgfwAQF3RGoYWng6HA7/xIHO0HdDZRfKgeNChfDEoo2A4XT5R PY9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=+fMN6d3MGWdlW1WizQSNw8U6WCNygxN3Vk+E0fQgAJU=; b=LBitxLWMBTHxm1o+w/Hy5pgFkr5f86o3gw0QCFaIY14ziKEStETMAOEAaYVADjw8HN hIdDN14NuetE2h32CXUZB2IqEIR0Bi9Q9WiYHL/bQdebFen4ii+YTvpSitrGx1fGBaxg Gm9+3BEqd6+xftS+hyyDAXCUfsvQT/w6lnwCS+jwUSJ3Bq8cq7MoOL2NNj62pai/OKgo sqbt8WkPJe8iDHKq3VHTcuMBtHupWZ1uZS03/ePjnNJWN2eSVnftv5K90jzOP1T/3bws NeWFSBiJ2/jGEn5KPXrJv4ziiM85wohBVxp2OmUUFnLp/JYNIaW43R5DrTtY7jgVUIyk 7V7Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si7917047pld.268.2019.05.17.14.25.42; Fri, 17 May 2019 14:25: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729137AbfEQVGn (ORCPT + 99 others); Fri, 17 May 2019 17:06:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57850 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729101AbfEQVGm (ORCPT ); Fri, 17 May 2019 17:06:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E3E42C05FF80 for ; Fri, 17 May 2019 21:06:42 +0000 (UTC) Received: from dwysocha.rdu.csb (dhcp-12-212-173.gsslab.rdu.redhat.com [10.12.212.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF41459D0A for ; Fri, 17 May 2019 21:06:42 +0000 (UTC) From: Dave Wysochanski To: linux-nfs@vger.kernel.org Subject: [PATCH] NFSv4: Add lease_time and lease_expired to 'nfs4:' line of mountstats Date: Fri, 17 May 2019 17:06:41 -0400 Message-Id: <1558127201-7481-1-git-send-email-dwysocha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 May 2019 21:06:42 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On the NFS client there is no low-impact way to determine the nfs4 lease time or whether the lease is expired, so add these to mountstats with times displayed in seconds. If the lease is not expired, display lease_expired=0. Otherwise, display lease_expired=seconds_since_expired, similar to 'age:' line in mountstats. Signed-off-by: Dave Wysochanski --- fs/nfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index c27ac96..6e52f0c 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -730,6 +730,16 @@ int nfs_show_options(struct seq_file *m, struct dentry *root) EXPORT_SYMBOL_GPL(nfs_show_options); #if IS_ENABLED(CONFIG_NFS_V4) +static void show_lease(struct seq_file *m, struct nfs_server *server) +{ + struct nfs_client *clp = server->nfs_client; + unsigned long expire; + + seq_printf(m, ",lease_time=%ld", clp->cl_lease_time / HZ); + expire = clp->cl_last_renewal + clp->cl_lease_time; + seq_printf(m, ",lease_expired=%ld", + time_after(expire, jiffies) ? 0 : (jiffies - expire) / HZ); +} #ifdef CONFIG_NFS_V4_1 static void show_sessions(struct seq_file *m, struct nfs_server *server) { @@ -838,6 +848,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root) seq_printf(m, ",acl=0x%x", nfss->acl_bitmask); show_sessions(m, nfss); show_pnfs(m, nfss); + show_lease(m, nfss); } #endif -- 1.8.3.1