diff options
author | Marc Eshel <eshel@almaden.ibm.com> | 2007-07-17 07:04:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:07 -0400 |
commit | 9a8db97e7756119689c93c431e8b8324080f5625 (patch) | |
tree | 2e0ac28664b02c7e1c7a111c6e60ac059fd92ad8 /fs/nfsd/nfs4state.c | |
parent | 12127498c8f5e479df15ee374a0932f5659df49e (diff) |
knfsd: lockd: nfsd4: use same grace period for lockd and nfsd4
Both lockd and (in the nfsv4 case) nfsd enforce a "grace period" after reboot,
during which clients may reclaim locks from the previous server instance, but
may not acquire new locks.
Currently the lockd and nfsd enforce grace periods of different lengths. This
may cause problems when we reboot a server with both v2/v3 and v4 clients.
For example, if the lockd grace period is shorter (as is likely the case),
then a v3 client might acquire a new lock that conflicts with a lock already
held (but not yet reclaimed) by a v4 client.
This patch calculates a lease time that lockd and nfsd can both use.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 8c52913d7cb6..9cc31eaf3857 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/namei.h> | 51 | #include <linux/namei.h> |
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | #include <linux/lockd/bind.h> | 53 | #include <linux/lockd/bind.h> |
54 | #include <linux/module.h> | ||
54 | 55 | ||
55 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 56 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
56 | 57 | ||
@@ -3190,20 +3191,27 @@ nfsd4_load_reboot_recovery_data(void) | |||
3190 | printk("NFSD: Failure reading reboot recovery data\n"); | 3191 | printk("NFSD: Failure reading reboot recovery data\n"); |
3191 | } | 3192 | } |
3192 | 3193 | ||
3194 | unsigned long | ||
3195 | get_nfs4_grace_period(void) | ||
3196 | { | ||
3197 | return max(user_lease_time, lease_time) * HZ; | ||
3198 | } | ||
3199 | |||
3193 | /* initialization to perform when the nfsd service is started: */ | 3200 | /* initialization to perform when the nfsd service is started: */ |
3194 | 3201 | ||
3195 | static void | 3202 | static void |
3196 | __nfs4_state_start(void) | 3203 | __nfs4_state_start(void) |
3197 | { | 3204 | { |
3198 | time_t grace_time; | 3205 | unsigned long grace_time; |
3199 | 3206 | ||
3200 | boot_time = get_seconds(); | 3207 | boot_time = get_seconds(); |
3201 | grace_time = max(user_lease_time, lease_time); | 3208 | grace_time = get_nfs_grace_period(); |
3202 | lease_time = user_lease_time; | 3209 | lease_time = user_lease_time; |
3203 | in_grace = 1; | 3210 | in_grace = 1; |
3204 | printk("NFSD: starting %ld-second grace period\n", grace_time); | 3211 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
3212 | grace_time/HZ); | ||
3205 | laundry_wq = create_singlethread_workqueue("nfsd4"); | 3213 | laundry_wq = create_singlethread_workqueue("nfsd4"); |
3206 | queue_delayed_work(laundry_wq, &laundromat_work, grace_time*HZ); | 3214 | queue_delayed_work(laundry_wq, &laundromat_work, grace_time); |
3207 | } | 3215 | } |
3208 | 3216 | ||
3209 | int | 3217 | int |