diff options
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r-- | fs/lockd/svc.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 80938fda67e0..31a63f87b806 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -87,32 +87,36 @@ static unsigned long get_lockd_grace_period(void) | |||
87 | return nlm_timeout * 5 * HZ; | 87 | return nlm_timeout * 5 * HZ; |
88 | } | 88 | } |
89 | 89 | ||
90 | static struct lock_manager lockd_manager = { | 90 | static void grace_ender(struct work_struct *grace) |
91 | }; | ||
92 | |||
93 | static void grace_ender(struct work_struct *not_used) | ||
94 | { | 91 | { |
95 | locks_end_grace(&lockd_manager); | 92 | struct delayed_work *dwork = container_of(grace, struct delayed_work, |
96 | } | 93 | work); |
94 | struct lockd_net *ln = container_of(dwork, struct lockd_net, | ||
95 | grace_period_end); | ||
97 | 96 | ||
98 | static DECLARE_DELAYED_WORK(grace_period_end, grace_ender); | 97 | locks_end_grace(&ln->lockd_manager); |
98 | } | ||
99 | 99 | ||
100 | static void set_grace_period(void) | 100 | static void set_grace_period(struct net *net) |
101 | { | 101 | { |
102 | unsigned long grace_period = get_lockd_grace_period(); | 102 | unsigned long grace_period = get_lockd_grace_period(); |
103 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
103 | 104 | ||
104 | locks_start_grace(&lockd_manager); | 105 | locks_start_grace(net, &ln->lockd_manager); |
105 | cancel_delayed_work_sync(&grace_period_end); | 106 | cancel_delayed_work_sync(&ln->grace_period_end); |
106 | schedule_delayed_work(&grace_period_end, grace_period); | 107 | schedule_delayed_work(&ln->grace_period_end, grace_period); |
107 | } | 108 | } |
108 | 109 | ||
109 | static void restart_grace(void) | 110 | static void restart_grace(void) |
110 | { | 111 | { |
111 | if (nlmsvc_ops) { | 112 | if (nlmsvc_ops) { |
112 | cancel_delayed_work_sync(&grace_period_end); | 113 | struct net *net = &init_net; |
113 | locks_end_grace(&lockd_manager); | 114 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
115 | |||
116 | cancel_delayed_work_sync(&ln->grace_period_end); | ||
117 | locks_end_grace(&ln->lockd_manager); | ||
114 | nlmsvc_invalidate_all(); | 118 | nlmsvc_invalidate_all(); |
115 | set_grace_period(); | 119 | set_grace_period(net); |
116 | } | 120 | } |
117 | } | 121 | } |
118 | 122 | ||
@@ -137,8 +141,6 @@ lockd(void *vrqstp) | |||
137 | nlm_timeout = LOCKD_DFLT_TIMEO; | 141 | nlm_timeout = LOCKD_DFLT_TIMEO; |
138 | nlmsvc_timeout = nlm_timeout * HZ; | 142 | nlmsvc_timeout = nlm_timeout * HZ; |
139 | 143 | ||
140 | set_grace_period(); | ||
141 | |||
142 | /* | 144 | /* |
143 | * The main request loop. We don't terminate until the last | 145 | * The main request loop. We don't terminate until the last |
144 | * NFS mount or NFS daemon has gone away. | 146 | * NFS mount or NFS daemon has gone away. |
@@ -184,8 +186,6 @@ lockd(void *vrqstp) | |||
184 | svc_process(rqstp); | 186 | svc_process(rqstp); |
185 | } | 187 | } |
186 | flush_signals(current); | 188 | flush_signals(current); |
187 | cancel_delayed_work_sync(&grace_period_end); | ||
188 | locks_end_grace(&lockd_manager); | ||
189 | if (nlmsvc_ops) | 189 | if (nlmsvc_ops) |
190 | nlmsvc_invalidate_all(); | 190 | nlmsvc_invalidate_all(); |
191 | nlm_shutdown_hosts(); | 191 | nlm_shutdown_hosts(); |
@@ -266,6 +266,7 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net) | |||
266 | error = make_socks(serv, net); | 266 | error = make_socks(serv, net); |
267 | if (error < 0) | 267 | if (error < 0) |
268 | goto err_socks; | 268 | goto err_socks; |
269 | set_grace_period(net); | ||
269 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); | 270 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); |
270 | return 0; | 271 | return 0; |
271 | 272 | ||
@@ -283,6 +284,8 @@ static void lockd_down_net(struct svc_serv *serv, struct net *net) | |||
283 | if (ln->nlmsvc_users) { | 284 | if (ln->nlmsvc_users) { |
284 | if (--ln->nlmsvc_users == 0) { | 285 | if (--ln->nlmsvc_users == 0) { |
285 | nlm_shutdown_hosts_net(net); | 286 | nlm_shutdown_hosts_net(net); |
287 | cancel_delayed_work_sync(&ln->grace_period_end); | ||
288 | locks_end_grace(&ln->lockd_manager); | ||
286 | svc_shutdown_net(serv, net); | 289 | svc_shutdown_net(serv, net); |
287 | dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net); | 290 | dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net); |
288 | } | 291 | } |
@@ -589,6 +592,10 @@ module_param(nlm_max_connections, uint, 0644); | |||
589 | 592 | ||
590 | static int lockd_init_net(struct net *net) | 593 | static int lockd_init_net(struct net *net) |
591 | { | 594 | { |
595 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
596 | |||
597 | INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender); | ||
598 | INIT_LIST_HEAD(&ln->grace_list); | ||
592 | return 0; | 599 | return 0; |
593 | } | 600 | } |
594 | 601 | ||