aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-07-25 08:56:43 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-07-27 16:48:44 -0400
commit66547b0251b0b62dcb637631f566410a0e1e47a8 (patch)
tree07d3ebc8a198e04323a9efbae95aa00e4869b4a5 /fs/lockd
parente2edaa98cb2527c0f1c2d825ddb45a8b2d026669 (diff)
LockD: manage grace period per network namespace
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/netns.h2
-rw-r--r--fs/lockd/svc.c17
2 files changed, 13 insertions, 6 deletions
diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h
index 44c8f0b9230a..94653aecfffb 100644
--- a/fs/lockd/netns.h
+++ b/fs/lockd/netns.h
@@ -7,6 +7,8 @@ struct lockd_net {
7 unsigned int nlmsvc_users; 7 unsigned int nlmsvc_users;
8 unsigned long next_gc; 8 unsigned long next_gc;
9 unsigned long nrhosts; 9 unsigned long nrhosts;
10
11 struct delayed_work grace_period_end;
10}; 12};
11 13
12extern int lockd_net_id; 14extern int lockd_net_id;
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 80938fda67e0..70c417758eb9 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -95,21 +95,22 @@ static void grace_ender(struct work_struct *not_used)
95 locks_end_grace(&lockd_manager); 95 locks_end_grace(&lockd_manager);
96} 96}
97 97
98static DECLARE_DELAYED_WORK(grace_period_end, grace_ender);
99
100static void set_grace_period(void) 98static void set_grace_period(void)
101{ 99{
102 unsigned long grace_period = get_lockd_grace_period(); 100 unsigned long grace_period = get_lockd_grace_period();
101 struct lockd_net *ln = net_generic(&init_net, lockd_net_id);
103 102
104 locks_start_grace(&lockd_manager); 103 locks_start_grace(&lockd_manager);
105 cancel_delayed_work_sync(&grace_period_end); 104 cancel_delayed_work_sync(&ln->grace_period_end);
106 schedule_delayed_work(&grace_period_end, grace_period); 105 schedule_delayed_work(&ln->grace_period_end, grace_period);
107} 106}
108 107
109static void restart_grace(void) 108static void restart_grace(void)
110{ 109{
111 if (nlmsvc_ops) { 110 if (nlmsvc_ops) {
112 cancel_delayed_work_sync(&grace_period_end); 111 struct lockd_net *ln = net_generic(&init_net, lockd_net_id);
112
113 cancel_delayed_work_sync(&ln->grace_period_end);
113 locks_end_grace(&lockd_manager); 114 locks_end_grace(&lockd_manager);
114 nlmsvc_invalidate_all(); 115 nlmsvc_invalidate_all();
115 set_grace_period(); 116 set_grace_period();
@@ -124,6 +125,7 @@ lockd(void *vrqstp)
124{ 125{
125 int err = 0, preverr = 0; 126 int err = 0, preverr = 0;
126 struct svc_rqst *rqstp = vrqstp; 127 struct svc_rqst *rqstp = vrqstp;
128 struct lockd_net *ln = net_generic(&init_net, lockd_net_id);
127 129
128 /* try_to_freeze() is called from svc_recv() */ 130 /* try_to_freeze() is called from svc_recv() */
129 set_freezable(); 131 set_freezable();
@@ -184,7 +186,7 @@ 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); 189 cancel_delayed_work_sync(&ln->grace_period_end);
188 locks_end_grace(&lockd_manager); 190 locks_end_grace(&lockd_manager);
189 if (nlmsvc_ops) 191 if (nlmsvc_ops)
190 nlmsvc_invalidate_all(); 192 nlmsvc_invalidate_all();
@@ -589,6 +591,9 @@ module_param(nlm_max_connections, uint, 0644);
589 591
590static int lockd_init_net(struct net *net) 592static int lockd_init_net(struct net *net)
591{ 593{
594 struct lockd_net *ln = net_generic(net, lockd_net_id);
595
596 INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender);
592 return 0; 597 return 0;
593} 598}
594 599