From f2868d1edfd57f81211d411728d076a10c77bcdc Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Thu, 4 Apr 2024 11:14:10 +0300 Subject: [PATCH] LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier() synchronize_rcu() does not wait for in-flight rcu callback completion, thus kmem_cache_free() can still race with kmem_cache_destroy(). Fixes: a9411a9856a ("LU-17076 nrs: wait for RCU completion") Signed-off-by: Alex Zhuravlev Change-Id: I2da668c06b532a41c8ce2fe681ea17cf6f3013ef Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54669 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff Reviewed-by: Neil Brown Reviewed-by: James Simmons --- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/ptlrpc/nrs_orr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 3a89924..c4e553c 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -3578,7 +3578,7 @@ void ldlm_exit(void) { if (ldlm_refcount) CERROR("ldlm_refcount is %d in %s\n", ldlm_refcount, __func__); - synchronize_rcu(); + rcu_barrier(); kmem_cache_destroy(ldlm_resource_slab); /* * ldlm_lock_put() use RCU to call ldlm_lock_free, so need call diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c index 1aae791..6dd3213 100644 --- a/lustre/ptlrpc/nrs_orr.c +++ b/lustre/ptlrpc/nrs_orr.c @@ -623,7 +623,7 @@ static void nrs_orr_stop(struct ptlrpc_nrs_policy *policy) rhashtable_free_and_destroy(&orrd->od_obj_hash, nrs_orr_hash_exit, NULL); } - synchronize_rcu(); + rcu_barrier(); kmem_cache_destroy(orrd->od_cache); OBD_FREE_PTR(orrd); -- 1.8.3.1