summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2019-05-17 17:06:41 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-06 14:54:52 -0400
commit1a7441b282cef3bb94acaba9f474ebc6d22277ba (patch)
tree18c8fda4b6b73d30b31a3797e1a94a0315f03409
parent2b17d725f9be59a1bfa0583af690c463fca1f385 (diff)
NFSv4: Add lease_time and lease_expired to 'nfs4:' line of mountstats
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 <dwysocha@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r--fs/nfs/super.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index bd3ba1d323ea..d01def299d40 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -742,6 +742,16 @@ int nfs_show_options(struct seq_file *m, struct dentry *root)
742EXPORT_SYMBOL_GPL(nfs_show_options); 742EXPORT_SYMBOL_GPL(nfs_show_options);
743 743
744#if IS_ENABLED(CONFIG_NFS_V4) 744#if IS_ENABLED(CONFIG_NFS_V4)
745static void show_lease(struct seq_file *m, struct nfs_server *server)
746{
747 struct nfs_client *clp = server->nfs_client;
748 unsigned long expire;
749
750 seq_printf(m, ",lease_time=%ld", clp->cl_lease_time / HZ);
751 expire = clp->cl_last_renewal + clp->cl_lease_time;
752 seq_printf(m, ",lease_expired=%ld",
753 time_after(expire, jiffies) ? 0 : (jiffies - expire) / HZ);
754}
745#ifdef CONFIG_NFS_V4_1 755#ifdef CONFIG_NFS_V4_1
746static void show_sessions(struct seq_file *m, struct nfs_server *server) 756static void show_sessions(struct seq_file *m, struct nfs_server *server)
747{ 757{
@@ -850,6 +860,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root)
850 seq_printf(m, ",acl=0x%x", nfss->acl_bitmask); 860 seq_printf(m, ",acl=0x%x", nfss->acl_bitmask);
851 show_sessions(m, nfss); 861 show_sessions(m, nfss);
852 show_pnfs(m, nfss); 862 show_pnfs(m, nfss);
863 show_lease(m, nfss);
853 } 864 }
854#endif 865#endif
855 866