Whamcloud - gitweb
LU-17887 obd: do not update obd_memory from RCU 63/55263/2
authorBruno Faccini <bfaccini@nvidia.com>
Thu, 30 May 2024 16:39:37 +0000 (18:39 +0200)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Jun 2024 14:21:58 +0000 (14:21 +0000)
OBD_FREE_PRE() should not be run from an RCU
callback as the obdclass module may have been
unloaded during the RCU grace period.

Signed-off-by: Bruno Faccini <bfaccini@nvidia.com>
Change-Id: I6f663b2aed2e60c15f2a1b9755b2c4050bd91ce2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55263
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/lu_object.c

index cd98acb..9f96896 100644 (file)
@@ -1956,14 +1956,6 @@ int lu_env_add(struct lu_env *env)
 }
 EXPORT_SYMBOL(lu_env_add);
 
-static void lu_env_item_free(struct rcu_head *head)
-{
-       struct lu_env_item *lei;
-
-       lei = container_of(head, struct lu_env_item, lei_rcu_head);
-       OBD_FREE_PTR(lei);
-}
-
 void lu_env_remove(struct lu_env *env)
 {
        struct lu_env_item *lei;
@@ -1986,8 +1978,10 @@ void lu_env_remove(struct lu_env *env)
        lei = rhashtable_lookup_fast(&lu_env_rhash, &task,
                                     lu_env_rhash_params);
        if (lei && rhashtable_remove_fast(&lu_env_rhash, &lei->lei_linkage,
-                                         lu_env_rhash_params) == 0)
-               call_rcu(&lei->lei_rcu_head, lu_env_item_free);
+                                         lu_env_rhash_params) == 0) {
+               OBD_FREE_PRE(lei, sizeof(*lei), "kfreed");
+               kfree_rcu(lei, lei_rcu_head);
+       }
 }
 EXPORT_SYMBOL(lu_env_remove);