aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c22
-rw-r--r--fs/nfsd/nfsctl.c5
-rw-r--r--fs/nfsd/nfssvc.c4
-rw-r--r--include/linux/nfsd/nfsd.h18
4 files changed, 25 insertions, 24 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2b20eb8589a0..09573b9f76c7 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1021,7 +1021,7 @@ nfsd4_free_slab(struct kmem_cache **slab)
1021 *slab = NULL; 1021 *slab = NULL;
1022} 1022}
1023 1023
1024static void 1024void
1025nfsd4_free_slabs(void) 1025nfsd4_free_slabs(void)
1026{ 1026{
1027 nfsd4_free_slab(&stateowner_slab); 1027 nfsd4_free_slab(&stateowner_slab);
@@ -3152,11 +3152,14 @@ nfs4_check_open_reclaim(clientid_t *clid)
3152 3152
3153/* initialization to perform at module load time: */ 3153/* initialization to perform at module load time: */
3154 3154
3155void 3155int
3156nfs4_state_init(void) 3156nfs4_state_init(void)
3157{ 3157{
3158 int i; 3158 int i, status;
3159 3159
3160 status = nfsd4_init_slabs();
3161 if (status)
3162 return status;
3160 for (i = 0; i < CLIENT_HASH_SIZE; i++) { 3163 for (i = 0; i < CLIENT_HASH_SIZE; i++) {
3161 INIT_LIST_HEAD(&conf_id_hashtbl[i]); 3164 INIT_LIST_HEAD(&conf_id_hashtbl[i]);
3162 INIT_LIST_HEAD(&conf_str_hashtbl[i]); 3165 INIT_LIST_HEAD(&conf_str_hashtbl[i]);
@@ -3185,6 +3188,7 @@ nfs4_state_init(void)
3185 for (i = 0; i < CLIENT_HASH_SIZE; i++) 3188 for (i = 0; i < CLIENT_HASH_SIZE; i++)
3186 INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); 3189 INIT_LIST_HEAD(&reclaim_str_hashtbl[i]);
3187 reclaim_str_hashtbl_size = 0; 3190 reclaim_str_hashtbl_size = 0;
3191 return 0;
3188} 3192}
3189 3193
3190static void 3194static void
@@ -3245,20 +3249,15 @@ __nfs4_state_start(void)
3245 set_max_delegations(); 3249 set_max_delegations();
3246} 3250}
3247 3251
3248int 3252void
3249nfs4_state_start(void) 3253nfs4_state_start(void)
3250{ 3254{
3251 int status;
3252
3253 if (nfs4_init) 3255 if (nfs4_init)
3254 return 0; 3256 return;
3255 status = nfsd4_init_slabs();
3256 if (status)
3257 return status;
3258 nfsd4_load_reboot_recovery_data(); 3257 nfsd4_load_reboot_recovery_data();
3259 __nfs4_state_start(); 3258 __nfs4_state_start();
3260 nfs4_init = 1; 3259 nfs4_init = 1;
3261 return 0; 3260 return;
3262} 3261}
3263 3262
3264int 3263int
@@ -3316,7 +3315,6 @@ nfs4_state_shutdown(void)
3316 nfs4_lock_state(); 3315 nfs4_lock_state();
3317 nfs4_release_reclaim(); 3316 nfs4_release_reclaim();
3318 __nfs4_state_shutdown(); 3317 __nfs4_state_shutdown();
3319 nfsd4_free_slabs();
3320 nfs4_unlock_state(); 3318 nfs4_unlock_state();
3321} 3319}
3322 3320
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index baac89d917ca..d135f5f98519 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -679,11 +679,13 @@ static int __init init_nfsd(void)
679 int retval; 679 int retval;
680 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); 680 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
681 681
682 retval = nfs4_state_init(); /* nfs4 locking state */
683 if (retval)
684 return retval;
682 nfsd_stat_init(); /* Statistics */ 685 nfsd_stat_init(); /* Statistics */
683 nfsd_cache_init(); /* RPC reply cache */ 686 nfsd_cache_init(); /* RPC reply cache */
684 nfsd_export_init(); /* Exports table */ 687 nfsd_export_init(); /* Exports table */
685 nfsd_lockd_init(); /* lockd->nfsd callbacks */ 688 nfsd_lockd_init(); /* lockd->nfsd callbacks */
686 nfs4_state_init(); /* NFSv4 locking state */
687 nfsd_idmap_init(); /* Name to ID mapping */ 689 nfsd_idmap_init(); /* Name to ID mapping */
688 if (proc_mkdir("fs/nfs", NULL)) { 690 if (proc_mkdir("fs/nfs", NULL)) {
689 struct proc_dir_entry *entry; 691 struct proc_dir_entry *entry;
@@ -712,6 +714,7 @@ static void __exit exit_nfsd(void)
712 nfsd_stat_shutdown(); 714 nfsd_stat_shutdown();
713 nfsd_lockd_shutdown(); 715 nfsd_lockd_shutdown();
714 nfsd_idmap_shutdown(); 716 nfsd_idmap_shutdown();
717 nfsd4_free_slabs();
715 unregister_filesystem(&nfsd_fs_type); 718 unregister_filesystem(&nfsd_fs_type);
716} 719}
717 720
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index ef46f3228330..1190aeaa92be 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -349,9 +349,7 @@ nfsd_svc(unsigned short port, int nrservs)
349 error = nfsd_racache_init(2*nrservs); 349 error = nfsd_racache_init(2*nrservs);
350 if (error<0) 350 if (error<0)
351 goto out; 351 goto out;
352 error = nfs4_state_start(); 352 nfs4_state_start();
353 if (error<0)
354 goto out;
355 353
356 nfsd_reset_versions(); 354 nfsd_reset_versions();
357 355
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index e452256d3f72..604a0d786bc6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -153,19 +153,21 @@ extern int nfsd_max_blksize;
153 */ 153 */
154#ifdef CONFIG_NFSD_V4 154#ifdef CONFIG_NFSD_V4
155extern unsigned int max_delegations; 155extern unsigned int max_delegations;
156void nfs4_state_init(void); 156int nfs4_state_init(void);
157int nfs4_state_start(void); 157void nfsd4_free_slabs(void);
158void nfs4_state_start(void);
158void nfs4_state_shutdown(void); 159void nfs4_state_shutdown(void);
159time_t nfs4_lease_time(void); 160time_t nfs4_lease_time(void);
160void nfs4_reset_lease(time_t leasetime); 161void nfs4_reset_lease(time_t leasetime);
161int nfs4_reset_recoverydir(char *recdir); 162int nfs4_reset_recoverydir(char *recdir);
162#else 163#else
163static inline void nfs4_state_init(void){}; 164static inline int nfs4_state_init(void) { return 0; }
164static inline int nfs4_state_start(void){return 0;} 165static inline void nfsd4_free_slabs(void) { }
165static inline void nfs4_state_shutdown(void){} 166static inline void nfs4_state_start(void) { }
166static inline time_t nfs4_lease_time(void){return 0;} 167static inline void nfs4_state_shutdown(void) { }
167static inline void nfs4_reset_lease(time_t leasetime){} 168static inline time_t nfs4_lease_time(void) { return 0; }
168static inline int nfs4_reset_recoverydir(char *recdir) {return 0;} 169static inline void nfs4_reset_lease(time_t leasetime) { }
170static inline int nfs4_reset_recoverydir(char *recdir) { return 0; }
169#endif 171#endif
170 172
171/* 173/*