Commit eaee716b authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Do NFSv4 server state initialisation when nfsd starts instead of when module loaded.

From: "William A.(Andy) Adamson" <andros@citi.umich.edu>
parent 1ac4906c
...@@ -55,6 +55,7 @@ time_t boot_time; ...@@ -55,6 +55,7 @@ time_t boot_time;
static u32 current_clientid = 1; static u32 current_clientid = 1;
static u32 current_ownerid = 0; static u32 current_ownerid = 0;
static u32 current_fileid = 0; static u32 current_fileid = 0;
static u32 nfs4_init = 0;
/* debug counters */ /* debug counters */
u32 list_add_perfile = 0; u32 list_add_perfile = 0;
...@@ -1158,6 +1159,8 @@ nfs4_state_init(void) ...@@ -1158,6 +1159,8 @@ nfs4_state_init(void)
{ {
int i; int i;
if (nfs4_init)
return;
for (i = 0; i < CLIENT_HASH_SIZE; i++) { for (i = 0; i < CLIENT_HASH_SIZE; i++) {
INIT_LIST_HEAD(&conf_id_hashtbl[i]); INIT_LIST_HEAD(&conf_id_hashtbl[i]);
INIT_LIST_HEAD(&conf_str_hashtbl[i]); INIT_LIST_HEAD(&conf_str_hashtbl[i]);
...@@ -1175,6 +1178,7 @@ nfs4_state_init(void) ...@@ -1175,6 +1178,7 @@ nfs4_state_init(void)
boot_time = get_seconds(); boot_time = get_seconds();
INIT_WORK(&laundromat_work,laundromat_main, NULL); INIT_WORK(&laundromat_work,laundromat_main, NULL);
schedule_delayed_work(&laundromat_work, NFSD_LEASE_TIME*HZ); schedule_delayed_work(&laundromat_work, NFSD_LEASE_TIME*HZ);
nfs4_init = 1;
} }
...@@ -1197,6 +1201,7 @@ __nfs4_state_shutdown(void) ...@@ -1197,6 +1201,7 @@ __nfs4_state_shutdown(void)
release_all_files(); release_all_files();
cancel_delayed_work(&laundromat_work); cancel_delayed_work(&laundromat_work);
flush_scheduled_work(); flush_scheduled_work();
nfs4_init = 0;
dprintk("NFSD: list_add_perfile %d list_del_perfile %d\n", dprintk("NFSD: list_add_perfile %d list_del_perfile %d\n",
list_add_perfile, list_del_perfile); list_add_perfile, list_del_perfile);
dprintk("NFSD: add_perclient %d del_perclient %d\n", dprintk("NFSD: add_perclient %d del_perclient %d\n",
......
...@@ -453,7 +453,6 @@ static int __init init_nfsd(void) ...@@ -453,7 +453,6 @@ static int __init init_nfsd(void)
nfsd_cache_init(); /* RPC reply cache */ nfsd_cache_init(); /* RPC reply cache */
nfsd_export_init(); /* Exports table */ nfsd_export_init(); /* Exports table */
nfsd_lockd_init(); /* lockd->nfsd callbacks */ nfsd_lockd_init(); /* lockd->nfsd callbacks */
nfs4_state_init(); /* NFSv4 State */
if (proc_mkdir("fs/nfs", 0)) { if (proc_mkdir("fs/nfs", 0)) {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
entry = create_proc_entry("fs/nfs/exports", 0, NULL); entry = create_proc_entry("fs/nfs/exports", 0, NULL);
......
...@@ -91,6 +91,7 @@ nfsd_svc(unsigned short port, int nrservs) ...@@ -91,6 +91,7 @@ nfsd_svc(unsigned short port, int nrservs)
/* Readahead param cache - will no-op if it already exists */ /* Readahead param cache - will no-op if it already exists */
error = nfsd_racache_init(2*nrservs); error = nfsd_racache_init(2*nrservs);
nfs4_state_init();
if (error<0) if (error<0)
goto out; goto out;
if (!nfsd_serv) { if (!nfsd_serv) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment