docs/RCU: Add the missing rcu_read_unlock()
authorAlan Huang <mmpgouride@gmail.com>
Tue, 13 Jun 2023 00:57:01 +0000 (00:57 +0000)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 14 Jul 2023 21:55:56 +0000 (14:55 -0700)
We should exit the RCU read-side critical section before re-entering.

Signed-off-by: Alan Huang <mmpgouride@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Documentation/RCU/rculist_nulls.rst

index 9a734bf..0612a63 100644 (file)
@@ -29,8 +29,10 @@ algorithms:
   rcu_read_lock()
   obj = lockless_lookup(key);
   if (obj) {
-    if (!try_get_ref(obj)) // might fail for free objects
+    if (!try_get_ref(obj)) { // might fail for free objects
+      rcu_read_unlock();
       goto begin;
+    }
     /*
     * Because a writer could delete object, and a writer could
     * reuse these object before the RCU grace period, we