afs: Fix lost servers_outstanding count
authorDavid Howells <dhowells@redhat.com>
Wed, 21 Dec 2022 14:30:48 +0000 (14:30 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 22 Dec 2022 11:40:35 +0000 (11:40 +0000)
commit36f82c93ee0bd88f1c95a52537906b8178b537f1
tree3f850ecbc3441fc253c3306195aa4ed368d1357d
parentb6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
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: f6cbb368bcb0 ("afs: Actively poll fileservers to maintain NAT or firewall openings")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/167164544917.2072364.3759519569649459359.stgit@warthog.procyon.org.uk/
fs/afs/fs_probe.c