diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-07-25 08:56:58 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-07-27 16:49:21 -0400 |
commit | 5e1533c7880bb0df98f71fa683979ec296aa947d (patch) | |
tree | 9d67e9c0c7187f957126043a6860f37c9bdb5273 /fs/nfsd/nfs4state.c | |
parent | 08d44a35a9e71a132c8e8abb0451b7b5e5b3dfee (diff) |
NFSd: make nfsd4_manager allocated per network namespace context.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index fddb18b2e877..4a44b50c2f58 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #include "current_stateid.h" | 46 | #include "current_stateid.h" |
47 | #include "fault_inject.h" | 47 | #include "fault_inject.h" |
48 | 48 | ||
49 | #include "netns.h" | ||
50 | |||
49 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 51 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
50 | 52 | ||
51 | /* Globals */ | 53 | /* Globals */ |
@@ -3116,22 +3118,21 @@ out: | |||
3116 | return status; | 3118 | return status; |
3117 | } | 3119 | } |
3118 | 3120 | ||
3119 | static struct lock_manager nfsd4_manager = { | ||
3120 | }; | ||
3121 | |||
3122 | static bool grace_ended; | 3121 | static bool grace_ended; |
3123 | 3122 | ||
3124 | static void | 3123 | static void |
3125 | nfsd4_end_grace(void) | 3124 | nfsd4_end_grace(struct net *net) |
3126 | { | 3125 | { |
3126 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
3127 | |||
3127 | /* do nothing if grace period already ended */ | 3128 | /* do nothing if grace period already ended */ |
3128 | if (grace_ended) | 3129 | if (grace_ended) |
3129 | return; | 3130 | return; |
3130 | 3131 | ||
3131 | dprintk("NFSD: end of grace period\n"); | 3132 | dprintk("NFSD: end of grace period\n"); |
3132 | grace_ended = true; | 3133 | grace_ended = true; |
3133 | nfsd4_record_grace_done(&init_net, boot_time); | 3134 | nfsd4_record_grace_done(net, boot_time); |
3134 | locks_end_grace(&nfsd4_manager); | 3135 | locks_end_grace(&nn->nfsd4_manager); |
3135 | /* | 3136 | /* |
3136 | * Now that every NFSv4 client has had the chance to recover and | 3137 | * Now that every NFSv4 client has had the chance to recover and |
3137 | * to see the (possibly new, possibly shorter) lease time, we | 3138 | * to see the (possibly new, possibly shorter) lease time, we |
@@ -3154,7 +3155,7 @@ nfs4_laundromat(void) | |||
3154 | nfs4_lock_state(); | 3155 | nfs4_lock_state(); |
3155 | 3156 | ||
3156 | dprintk("NFSD: laundromat service - starting\n"); | 3157 | dprintk("NFSD: laundromat service - starting\n"); |
3157 | nfsd4_end_grace(); | 3158 | nfsd4_end_grace(&init_net); |
3158 | INIT_LIST_HEAD(&reaplist); | 3159 | INIT_LIST_HEAD(&reaplist); |
3159 | spin_lock(&client_lock); | 3160 | spin_lock(&client_lock); |
3160 | list_for_each_safe(pos, next, &client_lru) { | 3161 | list_for_each_safe(pos, next, &client_lru) { |
@@ -4688,6 +4689,8 @@ set_max_delegations(void) | |||
4688 | int | 4689 | int |
4689 | nfs4_state_start(void) | 4690 | nfs4_state_start(void) |
4690 | { | 4691 | { |
4692 | struct net *net = &init_net; | ||
4693 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
4691 | int ret; | 4694 | int ret; |
4692 | 4695 | ||
4693 | /* | 4696 | /* |
@@ -4697,10 +4700,10 @@ nfs4_state_start(void) | |||
4697 | * to that instead and then do most of the rest of this on a per-net | 4700 | * to that instead and then do most of the rest of this on a per-net |
4698 | * basis. | 4701 | * basis. |
4699 | */ | 4702 | */ |
4700 | get_net(&init_net); | 4703 | get_net(net); |
4701 | nfsd4_client_tracking_init(&init_net); | 4704 | nfsd4_client_tracking_init(net); |
4702 | boot_time = get_seconds(); | 4705 | boot_time = get_seconds(); |
4703 | locks_start_grace(&nfsd4_manager); | 4706 | locks_start_grace(&nn->nfsd4_manager); |
4704 | grace_ended = false; | 4707 | grace_ended = false; |
4705 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", | 4708 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
4706 | nfsd4_grace); | 4709 | nfsd4_grace); |
@@ -4723,8 +4726,8 @@ nfs4_state_start(void) | |||
4723 | out_free_laundry: | 4726 | out_free_laundry: |
4724 | destroy_workqueue(laundry_wq); | 4727 | destroy_workqueue(laundry_wq); |
4725 | out_recovery: | 4728 | out_recovery: |
4726 | nfsd4_client_tracking_exit(&init_net); | 4729 | nfsd4_client_tracking_exit(net); |
4727 | put_net(&init_net); | 4730 | put_net(net); |
4728 | return ret; | 4731 | return ret; |
4729 | } | 4732 | } |
4730 | 4733 | ||
@@ -4765,9 +4768,12 @@ __nfs4_state_shutdown(void) | |||
4765 | void | 4768 | void |
4766 | nfs4_state_shutdown(void) | 4769 | nfs4_state_shutdown(void) |
4767 | { | 4770 | { |
4771 | struct net *net = &init_net; | ||
4772 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
4773 | |||
4768 | cancel_delayed_work_sync(&laundromat_work); | 4774 | cancel_delayed_work_sync(&laundromat_work); |
4769 | destroy_workqueue(laundry_wq); | 4775 | destroy_workqueue(laundry_wq); |
4770 | locks_end_grace(&nfsd4_manager); | 4776 | locks_end_grace(&nn->nfsd4_manager); |
4771 | nfs4_lock_state(); | 4777 | nfs4_lock_state(); |
4772 | __nfs4_state_shutdown(); | 4778 | __nfs4_state_shutdown(); |
4773 | nfs4_unlock_state(); | 4779 | nfs4_unlock_state(); |