Skip to content

Commit 08d44a3

Browse files
Stanislav KinsburskyJ. Bruce Fields
authored andcommitted
LockD: make lockd manager allocated per network namespace
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 66547b0 commit 08d44a3

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎fs/lockd/netns.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __LOCKD_NETNS_H__
22
#define __LOCKD_NETNS_H__
33

4+
#include <linux/fs.h>
45
#include <net/netns/generic.h>
56

67
struct lockd_net {
@@ -9,6 +10,7 @@ struct lockd_net {
910
unsigned long nrhosts;
1011

1112
struct delayed_work grace_period_end;
13+
struct lock_manager lockd_manager;
1214
};
1315

1416
extern int lockd_net_id;

‎fs/lockd/svc.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,22 @@ static unsigned long get_lockd_grace_period(void)
8787
return nlm_timeout * 5 * HZ;
8888
}
8989

90-
static struct lock_manager lockd_manager = {
91-
};
92-
93-
static void grace_ender(struct work_struct *not_used)
90+
static void grace_ender(struct work_struct *grace)
9491
{
95-
locks_end_grace(&lockd_manager);
92+
struct delayed_work *dwork = container_of(grace, struct delayed_work,
93+
work);
94+
struct lockd_net *ln = container_of(dwork, struct lockd_net,
95+
grace_period_end);
96+
97+
locks_end_grace(&ln->lockd_manager);
9698
}
9799

98100
static void set_grace_period(void)
99101
{
100102
unsigned long grace_period = get_lockd_grace_period();
101103
struct lockd_net *ln = net_generic(&init_net, lockd_net_id);
102104

103-
locks_start_grace(&lockd_manager);
105+
locks_start_grace(&ln->lockd_manager);
104106
cancel_delayed_work_sync(&ln->grace_period_end);
105107
schedule_delayed_work(&ln->grace_period_end, grace_period);
106108
}
@@ -111,7 +113,7 @@ static void restart_grace(void)
111113
struct lockd_net *ln = net_generic(&init_net, lockd_net_id);
112114

113115
cancel_delayed_work_sync(&ln->grace_period_end);
114-
locks_end_grace(&lockd_manager);
116+
locks_end_grace(&ln->lockd_manager);
115117
nlmsvc_invalidate_all();
116118
set_grace_period();
117119
}
@@ -187,7 +189,7 @@ lockd(void *vrqstp)
187189
}
188190
flush_signals(current);
189191
cancel_delayed_work_sync(&ln->grace_period_end);
190-
locks_end_grace(&lockd_manager);
192+
locks_end_grace(&ln->lockd_manager);
191193
if (nlmsvc_ops)
192194
nlmsvc_invalidate_all();
193195
nlm_shutdown_hosts();

0 commit comments

Comments
 (0)