Skip to content

Commit 36f82c9

Browse files
committed
afs: Fix lost servers_outstanding count
The afs_fs_probe_dispatcher() work function is passed a count on net->servers_outstanding when it is scheduled (which may come via its timer). This is passed back to the work_item, passed to the timer or dropped at the end of the dispatcher function. But, at the top of the dispatcher function, there are two checks which skip the rest of the function: if the network namespace is being destroyed or if there are no fileservers to probe. These two return paths, however, do not drop the count passed to the dispatcher, and so, sometimes, the destruction of a network namespace, such as induced by rmmod of the kafs module, may get stuck in afs_purge_servers(), waiting for net->servers_outstanding to become zero. Fix this by adding the missing decrements in afs_fs_probe_dispatcher(). Fixes: f6cbb36 ("afs: Actively poll fileservers to maintain NAT or firewall openings") Reported-by: Marc Dionne <[email protected]> Signed-off-by: David Howells <[email protected]> Tested-by: Marc Dionne <[email protected]> cc: [email protected] Link: https://lore.kernel.org/r/167164544917.2072364.3759519569649459359.stgit@warthog.procyon.org.uk/
1 parent b6bb967 commit 36f82c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/afs/fs_probe.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,15 @@ void afs_fs_probe_dispatcher(struct work_struct *work)
366366
unsigned long nowj, timer_at, poll_at;
367367
bool first_pass = true, set_timer = false;
368368

369-
if (!net->live)
369+
if (!net->live) {
370+
afs_dec_servers_outstanding(net);
370371
return;
372+
}
371373

372374
_enter("");
373375

374376
if (list_empty(&net->fs_probe_fast) && list_empty(&net->fs_probe_slow)) {
377+
afs_dec_servers_outstanding(net);
375378
_leave(" [none]");
376379
return;
377380
}

0 commit comments

Comments
 (0)