Linux 6.5 compat: safe cleanup in spl_proc_fini()
commitc7ee59a160f74049de1e459b3c3c63671784703f
authorAndrea Righi <andrea.righi@canonical.com>
Sat, 2 Sep 2023 00:21:40 +0000 (2 02:21 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 19 Sep 2023 15:50:01 +0000 (19 08:50 -0700)
tree354fe2388a22c7de75e26d75508d23f52ffb37fb
parent58a707375fef23697cb029fbad0e7e92bc78025b
Linux 6.5 compat: safe cleanup in spl_proc_fini()

If we fail to create a proc entry in spl_proc_init() we may end up
calling unregister_sysctl_table() twice: one in the failure path of
spl_proc_init() and another time during spl_proc_fini().

Avoid the double call to unregister_sysctl_table() and while at it
refactor the code a bit to reduce code duplication.

This was accidentally introduced when the spl code was
updated for Linux 6.5 compatibility.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Closes #15234
Closes #15235
module/os/linux/spl/spl-proc.c