linux/fs/dlm
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: 01fdeca1cc ("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>
2024-06-13 12:48:46 -05:00
..
ast.c dlm: implement LSFL_SOFTIRQ_SAFE 2024-06-11 13:13:00 -05:00
ast.h dlm: implement LSFL_SOFTIRQ_SAFE 2024-06-11 13:13:00 -05:00
config.c dlm: remove unused parameter in dlm_midcomms_addr 2024-05-31 11:04:54 -05:00
config.h dlm: switch to use rhashtable for rsbs 2024-04-16 14:34:39 -05:00
debug_fs.c dlm: change list and timer names 2024-06-10 15:11:46 -05:00
dir.c dlm: use rwlock for rsb hash table 2024-04-16 14:45:31 -05:00
dir.h dlm: move rsb root_list to ls_recover() stack 2024-04-09 11:44:49 -05:00
dlm_internal.h dlm: implement LSFL_SOFTIRQ_SAFE 2024-06-11 13:13:00 -05:00
Kconfig fs: dlm: remove deprecated code parts 2023-03-06 15:49:07 -06:00
lock.c dlm: use rcu to avoid an extra rsb struct lookup 2024-06-10 15:26:03 -05:00
lock.h dlm: change list and timer names 2024-06-10 15:11:46 -05:00
lockspace.c dlm: remove DLM_LSFL_SOFTIRQ from exflags 2024-06-12 16:20:51 -05:00
lockspace.h fs: dlm: revert check required context while close 2023-06-14 10:17:33 -05:00
lowcomms.c fs: dlm: remove unused struct 'dlm_processed_nodes' 2024-06-12 15:50:29 -05:00
lowcomms.h dlm: remove unused parameter in dlm_midcomms_addr 2024-05-31 11:04:54 -05:00
lvb_table.h
main.c fs: dlm: unregister memory at the very last 2023-06-14 10:17:33 -05:00
Makefile fs: dlm: remove deprecated code parts 2023-03-06 15:49:07 -06:00
member.c dlm: change list and timer names 2024-06-10 15:11:46 -05:00
member.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
memory.c dlm: add rcu_barrier before destroy kmem cache 2024-06-13 12:48:46 -05:00
memory.h dlm: remove allocation parameter in msg allocation 2024-04-09 09:58:14 -05:00
midcomms.c dlm: remove unused parameter in dlm_midcomms_addr 2024-05-31 11:04:54 -05:00
midcomms.h dlm: remove unused parameter in dlm_midcomms_addr 2024-05-31 11:04:54 -05:00
plock.c dlm: adapt to breakup of struct file_lock 2024-02-05 13:11:42 +01:00
rcom.c dlm: use spin_lock_bh for message processing 2024-04-09 11:45:23 -05:00
rcom.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
recover.c dlm: change list and timer names 2024-06-10 15:11:46 -05:00
recover.h dlm: change list and timer names 2024-06-10 15:11:46 -05:00
recoverd.c dlm: change list and timer names 2024-06-10 15:11:46 -05:00
recoverd.h
requestqueue.c dlm: use spin_lock_bh for message processing 2024-04-09 11:45:23 -05:00
requestqueue.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
user.c dlm: implement LSFL_SOFTIRQ_SAFE 2024-06-11 13:13:00 -05:00
user.h fs: dlm: move dlm_purge_lkb_callbacks to user module 2023-06-14 10:17:33 -05:00
util.c dlm: use __le types for dlm messages 2022-04-06 14:02:37 -05:00
util.h dlm: use __le types for dlm messages 2022-04-06 14:02:37 -05:00