alistair23-linux/fs/afs
David Howells 5481fc6eb8 afs: Fix hang on rmmod due to outstanding timer
The fileserver probe timer, net->fs_probe_timer, isn't cancelled when
the kafs module is being removed and so the count it holds on
net->servers_outstanding doesn't get dropped..

This causes rmmod to wait forever.  The hung process shows a stack like:

	afs_purge_servers+0x1b5/0x23c [kafs]
	afs_net_exit+0x44/0x6e [kafs]
	ops_exit_list+0x72/0x93
	unregister_pernet_operations+0x14c/0x1ba
	unregister_pernet_subsys+0x1d/0x2a
	afs_exit+0x29/0x6f [kafs]
	__do_sys_delete_module.isra.0+0x1a2/0x24b
	do_syscall_64+0x51/0x95
	entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fix this by:

 (1) Attempting to cancel the probe timer and, if successful, drop the
     count that the timer was holding.

 (2) Make the timer function just drop the count and not schedule the
     prober if the afs portion of net namespace is being destroyed.

Also, whilst we're at it, make the following changes:

 (3) Initialise net->servers_outstanding to 1 and decrement it before
     waiting on it so that it doesn't generate wake up events by being
     decremented to 0 until we're cleaning up.

 (4) Switch the atomic_dec() on ->servers_outstanding for ->fs_timer in
     afs_purge_servers() to use the helper function for that.

Fixes: f6cbb368bc ("afs: Actively poll fileservers to maintain NAT or firewall openings")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-20 12:01:58 -07:00
..
addr_list.c afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t 2020-03-13 10:47:33 -07:00
afs.h afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
afs_cm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
afs_fs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
afs_vl.h afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
cache.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
callback.c afs: Fix the by-UUID server tree to allow servers with the same UUID 2020-06-04 15:37:57 +01:00
cell.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
cmservice.c afs: Fix handling of CB.ProbeUuid cache manager op 2020-06-04 15:37:57 +01:00
dir.c afs: Fix afs_do_lookup() to call correct fetch-status op variant 2020-06-20 12:01:58 -07:00
dir_edit.c afs: Remove set but not used variables 'before', 'after' 2019-11-21 20:36:00 +00:00
dir_silly.c afs: Fix silly rename 2020-06-16 22:00:28 +01:00
dynroot.c afs: Build an abstraction around an "operation" concept 2020-06-04 15:37:17 +01:00
file.c afs: Fix use of afs_check_for_remote_deletion() 2020-06-16 16:26:57 +01:00
flock.c afs: Fix use of afs_check_for_remote_deletion() 2020-06-16 16:26:57 +01:00
fs_operation.c afs: Fix use of afs_check_for_remote_deletion() 2020-06-16 16:26:57 +01:00
fs_probe.c afs: Fix hang on rmmod due to outstanding timer 2020-06-20 12:01:58 -07:00
fsclient.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
inode.c afs: Fix silly rename 2020-06-16 22:00:28 +01:00
internal.h afs: Fix hang on rmmod due to outstanding timer 2020-06-20 12:01:58 -07:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
main.c afs: Fix hang on rmmod due to outstanding timer 2020-06-20 12:01:58 -07:00
Makefile afs: Detect cell aliases 1 - Cells with root volumes 2020-06-04 15:37:57 +01:00
misc.c afs: Fix the mapping of the UAEOVERFLOW abort code 2020-06-15 15:41:03 +01:00
mntpt.c afs: Fix mountpoint parsing 2019-12-11 16:56:54 +00:00
proc.c afs: Fix memory leak in afs_put_sysnames() 2020-06-09 15:22:06 +01:00
protocol_uae.h afs: Add support for the UAE error table 2019-06-28 18:37:53 +01:00
protocol_yfs.h afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
rotate.c afs: Adjust the fileserver rotation algorithm to reprobe/retry more quickly 2020-06-04 15:37:58 +01:00
rxrpc.c AFS Changes 2020-06-05 16:26:36 -07:00
security.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
server.c afs: Fix hang on rmmod due to outstanding timer 2020-06-20 12:01:58 -07:00
server_list.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
super.c afs: Fix afs_statfs() to not let the values go below zero 2020-06-04 15:37:58 +01:00
vl_alias.c afs: Fix debugging statements with %px to be %p 2020-06-09 18:17:14 +01:00
vl_list.c fs/afs: Replace rcu_swap_protected() with rcu_replace_pointer() 2019-10-30 08:44:27 -07:00
vl_probe.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
vl_rotate.c afs: Detect cell aliases 3 - YFS Cells with a canonical cell name op 2020-06-04 15:37:57 +01:00
vlclient.c afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
volume.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
write.c afs: Fix truncation issues and mmap writeback size 2020-06-15 15:41:02 +01:00
xattr.c afs: Build an abstraction around an "operation" concept 2020-06-04 15:37:17 +01:00
xdr_fs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
yfsclient.c afs: Fix yfs_fs_fetch_status() to honour vnode selector 2020-06-16 16:26:57 +01:00