aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r--fs/lockd/svc.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 9fcdef50aad6..82e2192a0d5c 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -76,18 +76,31 @@ static const int nlm_port_min = 0, nlm_port_max = 65535;
76 76
77static struct ctl_table_header * nlm_sysctl_table; 77static struct ctl_table_header * nlm_sysctl_table;
78 78
79static unsigned long set_grace_period(void) 79static unsigned long get_lockd_grace_period(void)
80{ 80{
81 unsigned long grace_period;
82
83 /* Note: nlm_timeout should always be nonzero */ 81 /* Note: nlm_timeout should always be nonzero */
84 if (nlm_grace_period) 82 if (nlm_grace_period)
85 grace_period = ((nlm_grace_period + nlm_timeout - 1) 83 return roundup(nlm_grace_period, nlm_timeout) * HZ;
86 / nlm_timeout) * nlm_timeout * HZ;
87 else 84 else
88 grace_period = nlm_timeout * 5 * HZ; 85 return nlm_timeout * 5 * HZ;
86}
87
88unsigned long get_nfs_grace_period(void)
89{
90 unsigned long lockdgrace = get_lockd_grace_period();
91 unsigned long nfsdgrace = 0;
92
93 if (nlmsvc_ops)
94 nfsdgrace = nlmsvc_ops->get_grace_period();
95
96 return max(lockdgrace, nfsdgrace);
97}
98EXPORT_SYMBOL(get_nfs_grace_period);
99
100static unsigned long set_grace_period(void)
101{
89 nlmsvc_grace_period = 1; 102 nlmsvc_grace_period = 1;
90 return grace_period + jiffies; 103 return get_nfs_grace_period() + jiffies;
91} 104}
92 105
93static inline void clear_grace_period(void) 106static inline void clear_grace_period(void)