diff options
-rw-r--r-- | fs/nfsd/nfs4state.c | 35 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 1 | ||||
-rw-r--r-- | include/linux/nfsd/nfsd.h | 2 |
3 files changed, 20 insertions, 18 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e00b3472851c..1f68ce36e724 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -117,7 +117,7 @@ static void release_stateid(struct nfs4_stateid *stp, int flags); | |||
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* recall_lock protects the del_recall_lru */ | 119 | /* recall_lock protects the del_recall_lru */ |
120 | spinlock_t recall_lock; | 120 | spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; |
121 | static struct list_head del_recall_lru; | 121 | static struct list_head del_recall_lru; |
122 | 122 | ||
123 | static void | 123 | static void |
@@ -3179,23 +3179,13 @@ nfs4_check_open_reclaim(clientid_t *clid) | |||
3179 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; | 3179 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; |
3180 | } | 3180 | } |
3181 | 3181 | ||
3182 | /* initialization to perform at module load time: */ | ||
3182 | 3183 | ||
3183 | /* | 3184 | void |
3184 | * Start and stop routines | 3185 | nfs4_state_init(void) |
3185 | */ | ||
3186 | |||
3187 | static void | ||
3188 | __nfs4_state_start(void) | ||
3189 | { | 3186 | { |
3190 | int i; | 3187 | int i; |
3191 | time_t grace_time; | ||
3192 | 3188 | ||
3193 | if (!nfs4_reclaim_init) { | ||
3194 | for (i = 0; i < CLIENT_HASH_SIZE; i++) | ||
3195 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); | ||
3196 | reclaim_str_hashtbl_size = 0; | ||
3197 | nfs4_reclaim_init = 1; | ||
3198 | } | ||
3199 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { | 3189 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { |
3200 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); | 3190 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); |
3201 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); | 3191 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); |
@@ -3217,19 +3207,28 @@ __nfs4_state_start(void) | |||
3217 | INIT_LIST_HEAD(&lock_ownerid_hashtbl[i]); | 3207 | INIT_LIST_HEAD(&lock_ownerid_hashtbl[i]); |
3218 | INIT_LIST_HEAD(&lock_ownerstr_hashtbl[i]); | 3208 | INIT_LIST_HEAD(&lock_ownerstr_hashtbl[i]); |
3219 | } | 3209 | } |
3220 | memset(&zerostateid, 0, sizeof(stateid_t)); | ||
3221 | memset(&onestateid, ~0, sizeof(stateid_t)); | 3210 | memset(&onestateid, ~0, sizeof(stateid_t)); |
3222 | |||
3223 | INIT_LIST_HEAD(&close_lru); | 3211 | INIT_LIST_HEAD(&close_lru); |
3224 | INIT_LIST_HEAD(&client_lru); | 3212 | INIT_LIST_HEAD(&client_lru); |
3225 | INIT_LIST_HEAD(&del_recall_lru); | 3213 | INIT_LIST_HEAD(&del_recall_lru); |
3226 | spin_lock_init(&recall_lock); | 3214 | for (i = 0; i < CLIENT_HASH_SIZE; i++) |
3215 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); | ||
3216 | reclaim_str_hashtbl_size = 0; | ||
3217 | nfs4_reclaim_init = 1; | ||
3218 | } | ||
3219 | |||
3220 | /* initialization to perform when the nfsd service is started: */ | ||
3221 | |||
3222 | static void | ||
3223 | __nfs4_state_start(void) | ||
3224 | { | ||
3225 | time_t grace_time; | ||
3226 | |||
3227 | boot_time = get_seconds(); | 3227 | boot_time = get_seconds(); |
3228 | grace_time = max(user_lease_time, lease_time); | 3228 | grace_time = max(user_lease_time, lease_time); |
3229 | lease_time = user_lease_time; | 3229 | lease_time = user_lease_time; |
3230 | printk("NFSD: starting %ld-second grace period\n", grace_time); | 3230 | printk("NFSD: starting %ld-second grace period\n", grace_time); |
3231 | grace_end = boot_time + grace_time; | 3231 | grace_end = boot_time + grace_time; |
3232 | INIT_WORK(&laundromat_work,laundromat_main, NULL); | ||
3233 | laundry_wq = create_singlethread_workqueue("nfsd4"); | 3232 | laundry_wq = create_singlethread_workqueue("nfsd4"); |
3234 | queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ); | 3233 | queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ); |
3235 | } | 3234 | } |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 161afdcb8f7d..3d56531a7a03 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -397,6 +397,7 @@ static int __init init_nfsd(void) | |||
397 | nfsd_cache_init(); /* RPC reply cache */ | 397 | nfsd_cache_init(); /* RPC reply cache */ |
398 | nfsd_export_init(); /* Exports table */ | 398 | nfsd_export_init(); /* Exports table */ |
399 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ | 399 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
400 | nfs4_state_init(); /* NFSv4 locking state */ | ||
400 | #ifdef CONFIG_NFSD_V4 | 401 | #ifdef CONFIG_NFSD_V4 |
401 | nfsd_idmap_init(); /* Name to ID mapping */ | 402 | nfsd_idmap_init(); /* Name to ID mapping */ |
402 | #endif /* CONFIG_NFSD_V4 */ | 403 | #endif /* CONFIG_NFSD_V4 */ |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 3855fdc5af77..21c6e9d86e4f 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -145,11 +145,13 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | |||
145 | * NFSv4 State | 145 | * NFSv4 State |
146 | */ | 146 | */ |
147 | #ifdef CONFIG_NFSD_V4 | 147 | #ifdef CONFIG_NFSD_V4 |
148 | void nfs4_state_init(void); | ||
148 | int nfs4_state_start(void); | 149 | int nfs4_state_start(void); |
149 | void nfs4_state_shutdown(void); | 150 | void nfs4_state_shutdown(void); |
150 | time_t nfs4_lease_time(void); | 151 | time_t nfs4_lease_time(void); |
151 | void nfs4_reset_lease(time_t leasetime); | 152 | void nfs4_reset_lease(time_t leasetime); |
152 | #else | 153 | #else |
154 | static inline void nfs4_state_init(void){}; | ||
153 | static inline int nfs4_state_start(void){return 0;} | 155 | static inline int nfs4_state_start(void){return 0;} |
154 | static inline void nfs4_state_shutdown(void){} | 156 | static inline void nfs4_state_shutdown(void){} |
155 | static inline time_t nfs4_lease_time(void){return 0;} | 157 | static inline time_t nfs4_lease_time(void){return 0;} |