Skip to contentSkip to conversation

lockd: added cleanup checks in exit_net hook

PATCH Superseded Vasily Averin 1 participant 1 message Nov 3, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lockd: added cleanup checks in exit_net hook

Patch generates warnings if exit_net hook detects that structures initialized in init_net hook are still in use.

[ 2355.129218] per-netns lockd_manager.list is not empty
[ 2355.130483] WARNING: CPU: 7 PID: 97 at fs/lockd/svc.c:682 lockd_exit_net+0x52/0x80 [lockd]
...
[ 2355.148073] per-netns grace_period_end dealyed work was not cancelled
[ 2355.149205] WARNING: CPU: 7 PID: 97 at fs/lockd/svc.c:686 lockd_exit_net+0x78/0x80 [lockd]
---
 fs/lockd/svc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
fs/lockd/svc.c +8 -0
index 809cbcc..119af0a 100644
@@ -690,6 +690,14 @@ static int lockd_init_net(struct net *net)
 
 static void lockd_exit_net(struct net *net)
 {
+	struct lockd_net *ln = net_generic(net, lockd_net_id);
+
+	WARN(!list_empty(&ln->lockd_manager.list),
+		"per-netns lockd_manager.list is not empty\n");
+	WARN(!list_empty(&ln->nsm_handles),
+		"per-netns nsm_handles list is not empty\n");
+	WARN(delayed_work_pending(&ln->grace_period_end),
+		"per-netns grace_period_end dealyed work was not cancelled\n");
 }
 
 static struct pernet_operations lockd_net_ops = {
Signature · 1 line
2.7.4