aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index cc9164a34bec..eb8d124ec14d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -45,7 +45,7 @@
45 45
46/* Globals */ 46/* Globals */
47time_t nfsd4_lease = 90; /* default lease time */ 47time_t nfsd4_lease = 90; /* default lease time */
48static time_t user_lease_time = 90; 48static time_t nfsd4_grace = 90;
49static time_t boot_time; 49static time_t boot_time;
50static u32 current_ownerid = 1; 50static u32 current_ownerid = 1;
51static u32 current_fileid = 1; 51static u32 current_fileid = 1;
@@ -2551,6 +2551,12 @@ nfsd4_end_grace(void)
2551 dprintk("NFSD: end of grace period\n"); 2551 dprintk("NFSD: end of grace period\n");
2552 nfsd4_recdir_purge_old(); 2552 nfsd4_recdir_purge_old();
2553 locks_end_grace(&nfsd4_manager); 2553 locks_end_grace(&nfsd4_manager);
2554 /*
2555 * Now that every NFSv4 client has had the chance to recover and
2556 * to see the (possibly new, possibly shorter) lease time, we
2557 * can safely set the next grace time to the current lease time:
2558 */
2559 nfsd4_grace = nfsd4_lease;
2554} 2560}
2555 2561
2556static time_t 2562static time_t
@@ -3973,12 +3979,6 @@ nfsd4_load_reboot_recovery_data(void)
3973 printk("NFSD: Failure reading reboot recovery data\n"); 3979 printk("NFSD: Failure reading reboot recovery data\n");
3974} 3980}
3975 3981
3976unsigned long
3977get_nfs4_grace_period(void)
3978{
3979 return max(user_lease_time, nfsd4_lease) * HZ;
3980}
3981
3982/* 3982/*
3983 * Since the lifetime of a delegation isn't limited to that of an open, a 3983 * Since the lifetime of a delegation isn't limited to that of an open, a
3984 * client may quite reasonably hang on to a delegation as long as it has 3984 * client may quite reasonably hang on to a delegation as long as it has
@@ -4005,18 +4005,14 @@ set_max_delegations(void)
4005static int 4005static int
4006__nfs4_state_start(void) 4006__nfs4_state_start(void)
4007{ 4007{
4008 unsigned long grace_time;
4009
4010 boot_time = get_seconds(); 4008 boot_time = get_seconds();
4011 grace_time = get_nfs4_grace_period();
4012 nfsd4_lease = user_lease_time;
4013 locks_start_grace(&nfsd4_manager); 4009 locks_start_grace(&nfsd4_manager);
4014 printk(KERN_INFO "NFSD: starting %ld-second grace period\n", 4010 printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
4015 grace_time/HZ); 4011 nfsd4_grace);
4016 laundry_wq = create_singlethread_workqueue("nfsd4"); 4012 laundry_wq = create_singlethread_workqueue("nfsd4");
4017 if (laundry_wq == NULL) 4013 if (laundry_wq == NULL)
4018 return -ENOMEM; 4014 return -ENOMEM;
4019 queue_delayed_work(laundry_wq, &laundromat_work, grace_time); 4015 queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ);
4020 set_max_delegations(); 4016 set_max_delegations();
4021 return set_callback_cred(); 4017 return set_callback_cred();
4022} 4018}
@@ -4123,17 +4119,11 @@ nfs4_recoverydir(void)
4123/* 4119/*
4124 * Called when leasetime is changed. 4120 * Called when leasetime is changed.
4125 * 4121 *
4126 * The only way the protocol gives us to handle on-the-fly lease changes is to 4122 * nfsd4_lease is protected by nfsd_mutex since it's only really accessed
4127 * simulate a reboot. Instead of doing that, we just wait till the next time
4128 * we start to register any changes in lease time. If the administrator
4129 * really wants to change the lease time *now*, they can go ahead and bring
4130 * nfsd down and then back up again after changing the lease time.
4131 *
4132 * user_lease_time is protected by nfsd_mutex since it's only really accessed
4133 * when nfsd is starting 4123 * when nfsd is starting
4134 */ 4124 */
4135void 4125void
4136nfs4_reset_lease(time_t leasetime) 4126nfs4_reset_lease(time_t leasetime)
4137{ 4127{
4138 user_lease_time = leasetime; 4128 nfsd4_lease = leasetime;
4139} 4129}