From: Alex Zhuravlev Date: Thu, 4 Apr 2024 08:14:10 +0000 (+0300) Subject: LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier() X-Git-Tag: 2.15.63~71 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F54669%2F5;p=fs%2Flustre-release.git 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 --- 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);