Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 6.5 compat: spl: properly unregister sysctl entries #15239

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

arighi
Copy link
Contributor

@arighi arighi commented Sep 6, 2023

Motivation and Context

spl fails to properly unload the registered sysctl entries when register_ssyctl_table() is not available in the kernel (>= 6.5).

Corresponding tracking bug in Ubuntu: https://bugs.launchpad.net/bugs/2034510

Description

When register_sysctl_table() is unavailable we fail to properly unregister sysctl entries under "kernel/spl".

This leads to errors like the following when spl is unloaded/reloaded, making impossible to properly reload the spl module:

[ 746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Fix by cleaning up all the sub-entries inside "kernel/spl" when the spl module is unloaded.

How Has This Been Tested?

modprobe -r zfs
modprobe -r spl
modprobe zfs

When the problem happens spl fails to load and we can see the following line in dmesg:

 [  746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Test has been reproduced in a local VM running the latest 6.5 upstream kernel.

Types of changes

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • [x ] My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly.
  • [ x] I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • [ x] All commit messages are properly formatted and contain Signed-off-by.

When register_sysctl_table() is unavailable we fail to properly
unregister sysctl entries under "kernel/spl".

This leads to errors like the following when spl is unloaded/reloaded,
making impossible to properly reload the spl module:

[  746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Fix by cleaning up all the sub-entries inside "kernel/spl" when the
spl module is unloaded.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Sep 7, 2023
@behlendorf behlendorf merged commit 3602775 into openzfs:master Sep 7, 2023
19 checks passed
behlendorf pushed a commit that referenced this pull request Sep 19, 2023
When register_sysctl_table() is unavailable we fail to properly
unregister sysctl entries under "kernel/spl".

This leads to errors like the following when spl is unloaded/reloaded,
making impossible to properly reload the spl module:

[  746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Fix by cleaning up all the sub-entries inside "kernel/spl" when the
spl module is unloaded.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Closes #15239
tonyhutter pushed a commit that referenced this pull request Sep 27, 2023
When register_sysctl_table() is unavailable we fail to properly
unregister sysctl entries under "kernel/spl".

This leads to errors like the following when spl is unloaded/reloaded,
making impossible to properly reload the spl module:

[  746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Fix by cleaning up all the sub-entries inside "kernel/spl" when the
spl module is unloaded.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Closes #15239
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Dec 12, 2023
When register_sysctl_table() is unavailable we fail to properly
unregister sysctl entries under "kernel/spl".

This leads to errors like the following when spl is unloaded/reloaded,
making impossible to properly reload the spl module:

[  746.995704] sysctl duplicate entry: /kernel/spl/kmem/slab_kvmem_total

Fix by cleaning up all the sub-entries inside "kernel/spl" when the
spl module is unloaded.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Closes openzfs#15239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants