aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-24 01:04:01 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:06:33 -0400
commita76b4319ca85b5e3a8098470c623a272d40271cd (patch)
treec9e862136b066c0bccf6a1a0d977a71b58542d87 /fs/nfsd
parent28ce6054f1de89834e5e9522f9e451cd88a35f85 (diff)
[PATCH] knfsd: nfsd4: grace period end
For the purposes of reboot recovery, we want to do some work during the transition period at the end of the grace period. Some of that work must be guaranteed to have a certain relationship with the end of the grace period, so we want to control the transition there. Our approach is to modify the in_grace() checks to consult a global variable instead of checking the time directly, to schedule the first run of the laundromat thread at the end of the grace period, and to set the global end-of-grace-period there. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 72f2b6fdae66..1b2f67f5eef6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -55,7 +55,7 @@
55static time_t lease_time = 90; /* default lease time */ 55static time_t lease_time = 90; /* default lease time */
56static time_t user_lease_time = 90; 56static time_t user_lease_time = 90;
57time_t boot_time; 57time_t boot_time;
58static time_t grace_end = 0; 58static int in_grace = 1;
59static u32 current_clientid = 1; 59static u32 current_clientid = 1;
60static u32 current_ownerid = 1; 60static u32 current_ownerid = 1;
61static u32 current_fileid = 1; 61static u32 current_fileid = 1;
@@ -1908,6 +1908,13 @@ out:
1908 return status; 1908 return status;
1909} 1909}
1910 1910
1911static void
1912end_grace(void)
1913{
1914 dprintk("NFSD: end of grace period\n");
1915 in_grace = 0;
1916}
1917
1911time_t 1918time_t
1912nfs4_laundromat(void) 1919nfs4_laundromat(void)
1913{ 1920{
@@ -1922,6 +1929,8 @@ nfs4_laundromat(void)
1922 nfs4_lock_state(); 1929 nfs4_lock_state();
1923 1930
1924 dprintk("NFSD: laundromat service - starting\n"); 1931 dprintk("NFSD: laundromat service - starting\n");
1932 if (in_grace)
1933 end_grace();
1925 list_for_each_safe(pos, next, &client_lru) { 1934 list_for_each_safe(pos, next, &client_lru) {
1926 clp = list_entry(pos, struct nfs4_client, cl_lru); 1935 clp = list_entry(pos, struct nfs4_client, cl_lru);
1927 if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { 1936 if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) {
@@ -3223,10 +3232,10 @@ __nfs4_state_start(void)
3223 boot_time = get_seconds(); 3232 boot_time = get_seconds();
3224 grace_time = max(user_lease_time, lease_time); 3233 grace_time = max(user_lease_time, lease_time);
3225 lease_time = user_lease_time; 3234 lease_time = user_lease_time;
3235 in_grace = 1;
3226 printk("NFSD: starting %ld-second grace period\n", grace_time); 3236 printk("NFSD: starting %ld-second grace period\n", grace_time);
3227 grace_end = boot_time + grace_time;
3228 laundry_wq = create_singlethread_workqueue("nfsd4"); 3237 laundry_wq = create_singlethread_workqueue("nfsd4");
3229 queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ); 3238 queue_delayed_work(laundry_wq, &laundromat_work, grace_time*HZ);
3230} 3239}
3231 3240
3232int 3241int
@@ -3247,14 +3256,7 @@ nfs4_state_start(void)
3247int 3256int
3248nfs4_in_grace(void) 3257nfs4_in_grace(void)
3249{ 3258{
3250 return get_seconds() < grace_end; 3259 return in_grace;
3251}
3252
3253void
3254set_no_grace(void)
3255{
3256 printk("NFSD: ERROR in reboot recovery. State reclaims will fail.\n");
3257 grace_end = get_seconds();
3258} 3260}
3259 3261
3260time_t 3262time_t