Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3106
b: refs/heads/master
c: d99a05a
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jun 24, 2005
1 parent 1a889f4 commit d3f6bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58da282b733cff4caef805c6555c7a3b90772946
refs/heads/master: d99a05adf8490cc171b7709554936b8f3ac9e362
63 changes: 12 additions & 51 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

/* Globals */
static time_t lease_time = 90; /* default lease time */
static time_t old_lease_time = 90; /* past incarnation lease time */
static time_t user_lease_time = 90;
static u32 nfs4_reclaim_init = 0;
time_t boot_time;
static time_t grace_end = 0;
Expand Down Expand Up @@ -3205,11 +3205,9 @@ __nfs4_state_init(void)
INIT_LIST_HEAD(&del_recall_lru);
spin_lock_init(&recall_lock);
boot_time = get_seconds();
grace_time = max(old_lease_time, lease_time);
if (reclaim_str_hashtbl_size == 0)
grace_time = 0;
if (grace_time)
printk("NFSD: starting %ld-second grace period\n", grace_time);
grace_time = max(user_lease_time, lease_time);
lease_time = user_lease_time;
printk("NFSD: starting %ld-second grace period\n", grace_time);
grace_end = boot_time + grace_time;
INIT_WORK(&laundromat_work,laundromat_main, NULL);
laundry_wq = create_singlethread_workqueue("nfsd4");
Expand Down Expand Up @@ -3307,53 +3305,16 @@ nfs4_state_shutdown(void)
/*
* Called when leasetime is changed.
*
* if nfsd is not started, simply set the global lease.
*
* if nfsd(s) are running, lease change requires nfsv4 state to be reset.
* e.g: boot_time is reset, existing nfs4_client structs are
* used to fill reclaim_str_hashtbl, then all state (except for the
* reclaim_str_hashtbl) is re-initialized.
*
* if the old lease time is greater than the new lease time, the grace
* period needs to be set to the old lease time to allow clients to reclaim
* their state. XXX - we may want to set the grace period == lease time
* after an initial grace period == old lease time
*
* if an error occurs in this process, the new lease is set, but the server
* will not honor OPEN or LOCK reclaims, and will return nfserr_no_grace
* which means OPEN/LOCK/READ/WRITE will fail during grace period.
*
* clients will attempt to reset all state with SETCLIENTID/CONFIRM, and
* OPEN and LOCK reclaims.
* The only way the protocol gives us to handle on-the-fly lease changes is to
* simulate a reboot. Instead of doing that, we just wait till the next time
* we start to register any changes in lease time. If the administrator
* really wants to change the lease time *now*, they can go ahead and bring
* nfsd down and then back up again after changing the lease time.
*/
void
nfs4_reset_lease(time_t leasetime)
{
struct nfs4_client *clp;
int i;

printk("NFSD: New leasetime %ld\n",leasetime);
if (!nfs4_init)
return;
nfs4_lock_state();
old_lease_time = lease_time;
lease_time = leasetime;

nfs4_release_reclaim();

/* populate reclaim_str_hashtbl with current confirmed nfs4_clientid */
for (i = 0; i < CLIENT_HASH_SIZE; i++) {
list_for_each_entry(clp, &conf_id_hashtbl[i], cl_idhash) {
if (!nfs4_client_to_reclaim(clp->cl_name.data,
clp->cl_name.len)) {
nfs4_release_reclaim();
goto init_state;
}
}
}
init_state:
__nfs4_state_shutdown();
__nfs4_state_init();
nfs4_unlock_state();
lock_kernel();
user_lease_time = leasetime;
unlock_kernel();
}

0 comments on commit d3f6bbf

Please sign in to comment.