diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 24 |
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 @@ | |||
55 | static time_t lease_time = 90; /* default lease time */ | 55 | static time_t lease_time = 90; /* default lease time */ |
56 | static time_t user_lease_time = 90; | 56 | static time_t user_lease_time = 90; |
57 | time_t boot_time; | 57 | time_t boot_time; |
58 | static time_t grace_end = 0; | 58 | static int in_grace = 1; |
59 | static u32 current_clientid = 1; | 59 | static u32 current_clientid = 1; |
60 | static u32 current_ownerid = 1; | 60 | static u32 current_ownerid = 1; |
61 | static u32 current_fileid = 1; | 61 | static u32 current_fileid = 1; |
@@ -1908,6 +1908,13 @@ out: | |||
1908 | return status; | 1908 | return status; |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | static void | ||
1912 | end_grace(void) | ||
1913 | { | ||
1914 | dprintk("NFSD: end of grace period\n"); | ||
1915 | in_grace = 0; | ||
1916 | } | ||
1917 | |||
1911 | time_t | 1918 | time_t |
1912 | nfs4_laundromat(void) | 1919 | nfs4_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 | ||
3232 | int | 3241 | int |
@@ -3247,14 +3256,7 @@ nfs4_state_start(void) | |||
3247 | int | 3256 | int |
3248 | nfs4_in_grace(void) | 3257 | nfs4_in_grace(void) |
3249 | { | 3258 | { |
3250 | return get_seconds() < grace_end; | 3259 | return in_grace; |
3251 | } | ||
3252 | |||
3253 | void | ||
3254 | set_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 | ||
3260 | time_t | 3262 | time_t |