aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 15:56:50 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 20:49:33 -0400
commit29ab23cc5d351658d01a4327d55e9106a73fd04f (patch)
tree8df00000a93e783f4bc152c20a437338a4f57fde
parent5d351754fcf58d1a604aa7cf95c2805e8a098ad9 (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.c17
-rw-r--r--fs/nfsd/nfssvc.c4
-rw-r--r--include/linux/nfsd/nfsd.h4
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
4007static void 4007static 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
4023void 4026int
4024nfs4_state_start(void) 4027nfs4_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
4034time_t 4041time_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;
166extern unsigned int max_delegations; 166extern unsigned int max_delegations;
167int nfs4_state_init(void); 167int nfs4_state_init(void);
168void nfsd4_free_slabs(void); 168void nfsd4_free_slabs(void);
169void nfs4_state_start(void); 169int nfs4_state_start(void);
170void nfs4_state_shutdown(void); 170void nfs4_state_shutdown(void);
171time_t nfs4_lease_time(void); 171time_t nfs4_lease_time(void);
172void nfs4_reset_lease(time_t leasetime); 172void nfs4_reset_lease(time_t leasetime);
@@ -174,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir);
174#else 174#else
175static inline int nfs4_state_init(void) { return 0; } 175static inline int nfs4_state_init(void) { return 0; }
176static inline void nfsd4_free_slabs(void) { } 176static inline void nfsd4_free_slabs(void) { }
177static inline void nfs4_state_start(void) { } 177static inline int nfs4_state_start(void) { }
178static inline void nfs4_state_shutdown(void) { } 178static inline void nfs4_state_shutdown(void) { }
179static inline time_t nfs4_lease_time(void) { return 0; } 179static inline time_t nfs4_lease_time(void) { return 0; }
180static inline void nfs4_reset_lease(time_t leasetime) { } 180static inline void nfs4_reset_lease(time_t leasetime) { }