From eaee716b4d469a0bb3adf352f8462b0d2bcffa1f Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 17 Jun 2003 06:39:29 -0700 Subject: [PATCH] kNFSd: Do NFSv4 server state initialisation when nfsd starts instead of when module loaded. From: "William A.(Andy) Adamson" --- fs/nfsd/nfs4state.c | 5 +++++ fs/nfsd/nfsctl.c | 1 - fs/nfsd/nfssvc.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 7b4d3ba2c64c..8c24df4f5c9a 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -55,6 +55,7 @@ time_t boot_time; static u32 current_clientid = 1; static u32 current_ownerid = 0; static u32 current_fileid = 0; +static u32 nfs4_init = 0; /* debug counters */ u32 list_add_perfile = 0; @@ -1158,6 +1159,8 @@ nfs4_state_init(void) { int i; + if (nfs4_init) + return; for (i = 0; i < CLIENT_HASH_SIZE; i++) { INIT_LIST_HEAD(&conf_id_hashtbl[i]); INIT_LIST_HEAD(&conf_str_hashtbl[i]); @@ -1175,6 +1178,7 @@ nfs4_state_init(void) boot_time = get_seconds(); INIT_WORK(&laundromat_work,laundromat_main, NULL); schedule_delayed_work(&laundromat_work, NFSD_LEASE_TIME*HZ); + nfs4_init = 1; } @@ -1197,6 +1201,7 @@ __nfs4_state_shutdown(void) release_all_files(); cancel_delayed_work(&laundromat_work); flush_scheduled_work(); + nfs4_init = 0; dprintk("NFSD: list_add_perfile %d list_del_perfile %d\n", list_add_perfile, list_del_perfile); dprintk("NFSD: add_perclient %d del_perclient %d\n", diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 93dfe60fdb3f..73b90ab7f439 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -453,7 +453,6 @@ static int __init init_nfsd(void) nfsd_cache_init(); /* RPC reply cache */ nfsd_export_init(); /* Exports table */ nfsd_lockd_init(); /* lockd->nfsd callbacks */ - nfs4_state_init(); /* NFSv4 State */ if (proc_mkdir("fs/nfs", 0)) { struct proc_dir_entry *entry; entry = create_proc_entry("fs/nfs/exports", 0, NULL); diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index dd406043469a..d09dfaf29111 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -91,6 +91,7 @@ nfsd_svc(unsigned short port, int nrservs) /* Readahead param cache - will no-op if it already exists */ error = nfsd_racache_init(2*nrservs); + nfs4_state_init(); if (error<0) goto out; if (!nfsd_serv) { -- cgit v1.2.3