diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-07-25 08:57:13 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-07-27 16:49:22 -0400 |
commit | db9c4553412d72c6a05e0168d1d487f66e0660b3 (patch) | |
tree | e6510453641076d46fb1453867f9532205ba302d /fs/lockd | |
parent | 9695c7057f4887ed54dc1e6c2ef22f72a2be1175 (diff) |
LockD: manage grace list 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/grace.c | 14 | ||||
-rw-r--r-- | fs/lockd/netns.h | 1 | ||||
-rw-r--r-- | fs/lockd/svc.c | 1 |
3 files changed, 13 insertions, 3 deletions
diff --git a/fs/lockd/grace.c b/fs/lockd/grace.c index 183cc1f0af1c..8dbaff782098 100644 --- a/fs/lockd/grace.c +++ b/fs/lockd/grace.c | |||
@@ -4,8 +4,10 @@ | |||
4 | 4 | ||
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/lockd/bind.h> | 6 | #include <linux/lockd/bind.h> |
7 | #include <net/net_namespace.h> | ||
8 | |||
9 | #include "netns.h" | ||
7 | 10 | ||
8 | static LIST_HEAD(grace_list); | ||
9 | static DEFINE_SPINLOCK(grace_lock); | 11 | static DEFINE_SPINLOCK(grace_lock); |
10 | 12 | ||
11 | /** | 13 | /** |
@@ -21,8 +23,11 @@ static DEFINE_SPINLOCK(grace_lock); | |||
21 | */ | 23 | */ |
22 | void locks_start_grace(struct lock_manager *lm) | 24 | void locks_start_grace(struct lock_manager *lm) |
23 | { | 25 | { |
26 | struct net *net = &init_net; | ||
27 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
28 | |||
24 | spin_lock(&grace_lock); | 29 | spin_lock(&grace_lock); |
25 | list_add(&lm->list, &grace_list); | 30 | list_add(&lm->list, &ln->grace_list); |
26 | spin_unlock(&grace_lock); | 31 | spin_unlock(&grace_lock); |
27 | } | 32 | } |
28 | EXPORT_SYMBOL_GPL(locks_start_grace); | 33 | EXPORT_SYMBOL_GPL(locks_start_grace); |
@@ -54,6 +59,9 @@ EXPORT_SYMBOL_GPL(locks_end_grace); | |||
54 | */ | 59 | */ |
55 | int locks_in_grace(void) | 60 | int locks_in_grace(void) |
56 | { | 61 | { |
57 | return !list_empty(&grace_list); | 62 | struct net *net = &init_net; |
63 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
64 | |||
65 | return !list_empty(&ln->grace_list); | ||
58 | } | 66 | } |
59 | EXPORT_SYMBOL_GPL(locks_in_grace); | 67 | EXPORT_SYMBOL_GPL(locks_in_grace); |
diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h index e78650cb937c..4eee248ba96e 100644 --- a/fs/lockd/netns.h +++ b/fs/lockd/netns.h | |||
@@ -11,6 +11,7 @@ struct lockd_net { | |||
11 | 11 | ||
12 | struct delayed_work grace_period_end; | 12 | struct delayed_work grace_period_end; |
13 | struct lock_manager lockd_manager; | 13 | struct lock_manager lockd_manager; |
14 | struct list_head grace_list; | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | extern int lockd_net_id; | 17 | extern int lockd_net_id; |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index a9c436bc450c..834dfe2ed2e9 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -596,6 +596,7 @@ static int lockd_init_net(struct net *net) | |||
596 | struct lockd_net *ln = net_generic(net, lockd_net_id); | 596 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
597 | 597 | ||
598 | INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender); | 598 | INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender); |
599 | INIT_LIST_HEAD(&ln->grace_list); | ||
599 | return 0; | 600 | return 0; |
600 | } | 601 | } |
601 | 602 | ||