mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
Alexander Aring
89b01913dc
dlm: add rcu_barrier before destroy kmem cache
In the case we trigger dlm_free_rsb() that does a call_rcu() and the responding kfree() of res_lvbptr and a kmem_cache_free() of the rsb pointer we need to wait until this pending operation is done before calling kmem_cache_destroy(). We doing that by using rcu_barrier() that waits until all pending call_rcu() are done. This avoids that kmem_cache_destroy() complains about active objects around that are not being freed yet by call_rcu(). There is currently more discussions about to make this behaviour better, see: https://lore.kernel.org/netdev/20240609082726.32742-1-Julia.Lawall@inria.fr/ However this is only for call_rcu() if the callback calls kmem_cache_destroy() only to replace it by kfree_rcu() call which has currently some issue. This isn't our case because we also free the res_lvbptr if being set. For our case, to avoid the above race rcu_barrier() should be used before calling kmem_cache_destroy() to be sure that there are no active objects around. This is exactly what net/batman-adv is also doing before calling their kmem_cache_destroy() in module unloading. Fixes: 01fdeca1cc2d ("dlm: use rcu to avoid an extra rsb struct lookup") Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
Linux kernel ============ There are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. Please read Documentation/admin-guide/README.rst first. In order to build the documentation, use ``make htmldocs`` or ``make pdfdocs``. The formatted documentation can also be read online at: https://www.kernel.org/doc/html/latest/ There are various text files in the Documentation/ subdirectory, several of them using the reStructuredText markup notation. Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.
Description
Languages
C
97.5%
Assembly
1%
Shell
0.6%
Python
0.3%
Makefile
0.3%