diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-09-15 15:56:50 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-09-15 20:49:33 -0400 |
commit | 29ab23cc5d351658d01a4327d55e9106a73fd04f (patch) | |
tree | 8df00000a93e783f4bc152c20a437338a4f57fde | |
parent | 5d351754fcf58d1a604aa7cf95c2805e8a098ad9 (diff) |
nfsd4: allow nfs4 state startup to fail
The failure here is pretty unlikely, but we should handle it anyway.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r-- | fs/nfsd/nfs4state.c | 17 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 4 | ||||
-rw-r--r-- | include/linux/nfsd/nfsd.h | 4 |
3 files changed, 17 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 46e9ac526872..11db40cb2f2b 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -4004,7 +4004,7 @@ set_max_delegations(void) | |||
4004 | 4004 | ||
4005 | /* initialization to perform when the nfsd service is started: */ | 4005 | /* initialization to perform when the nfsd service is started: */ |
4006 | 4006 | ||
4007 | static void | 4007 | static int |
4008 | __nfs4_state_start(void) | 4008 | __nfs4_state_start(void) |
4009 | { | 4009 | { |
4010 | unsigned long grace_time; | 4010 | unsigned long grace_time; |
@@ -4016,19 +4016,26 @@ __nfs4_state_start(void) | |||
4016 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", | 4016 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
4017 | grace_time/HZ); | 4017 | grace_time/HZ); |
4018 | laundry_wq = create_singlethread_workqueue("nfsd4"); | 4018 | laundry_wq = create_singlethread_workqueue("nfsd4"); |
4019 | if (laundry_wq == NULL) | ||
4020 | return -ENOMEM; | ||
4019 | queue_delayed_work(laundry_wq, &laundromat_work, grace_time); | 4021 | queue_delayed_work(laundry_wq, &laundromat_work, grace_time); |
4020 | set_max_delegations(); | 4022 | set_max_delegations(); |
4023 | return 0; | ||
4021 | } | 4024 | } |
4022 | 4025 | ||
4023 | void | 4026 | int |
4024 | nfs4_state_start(void) | 4027 | nfs4_state_start(void) |
4025 | { | 4028 | { |
4029 | int ret; | ||
4030 | |||
4026 | if (nfs4_init) | 4031 | if (nfs4_init) |
4027 | return; | 4032 | return 0; |
4028 | nfsd4_load_reboot_recovery_data(); | 4033 | nfsd4_load_reboot_recovery_data(); |
4029 | __nfs4_state_start(); | 4034 | ret = __nfs4_state_start(); |
4035 | if (ret) | ||
4036 | return ret; | ||
4030 | nfs4_init = 1; | 4037 | nfs4_init = 1; |
4031 | return; | 4038 | return 0; |
4032 | } | 4039 | } |
4033 | 4040 | ||
4034 | time_t | 4041 | time_t |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 4472449c0937..fcc001088261 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -411,7 +411,9 @@ nfsd_svc(unsigned short port, int nrservs) | |||
411 | error = nfsd_racache_init(2*nrservs); | 411 | error = nfsd_racache_init(2*nrservs); |
412 | if (error<0) | 412 | if (error<0) |
413 | goto out; | 413 | goto out; |
414 | nfs4_state_start(); | 414 | error = nfs4_state_start(); |
415 | if (error) | ||
416 | goto out; | ||
415 | 417 | ||
416 | nfsd_reset_versions(); | 418 | nfsd_reset_versions(); |
417 | 419 | ||
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 2812ed52669d..24fdf89cea83 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -166,7 +166,7 @@ extern int nfsd_max_blksize; | |||
166 | extern unsigned int max_delegations; | 166 | extern unsigned int max_delegations; |
167 | int nfs4_state_init(void); | 167 | int nfs4_state_init(void); |
168 | void nfsd4_free_slabs(void); | 168 | void nfsd4_free_slabs(void); |
169 | void nfs4_state_start(void); | 169 | int nfs4_state_start(void); |
170 | void nfs4_state_shutdown(void); | 170 | void nfs4_state_shutdown(void); |
171 | time_t nfs4_lease_time(void); | 171 | time_t nfs4_lease_time(void); |
172 | void nfs4_reset_lease(time_t leasetime); | 172 | void nfs4_reset_lease(time_t leasetime); |
@@ -174,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir); | |||
174 | #else | 174 | #else |
175 | static inline int nfs4_state_init(void) { return 0; } | 175 | static inline int nfs4_state_init(void) { return 0; } |
176 | static inline void nfsd4_free_slabs(void) { } | 176 | static inline void nfsd4_free_slabs(void) { } |
177 | static inline void nfs4_state_start(void) { } | 177 | static inline int nfs4_state_start(void) { } |
178 | static inline void nfs4_state_shutdown(void) { } | 178 | static inline void nfs4_state_shutdown(void) { } |
179 | static inline time_t nfs4_lease_time(void) { return 0; } | 179 | static inline time_t nfs4_lease_time(void) { return 0; } |
180 | static inline void nfs4_reset_lease(time_t leasetime) { } | 180 | static inline void nfs4_reset_lease(time_t leasetime) { } |