Skip to contentSkip to conversation

docs/RCU: Add the missing rcu_read_unlock()

PATCH Applied Alan Huang 2 participants 2 messages Jun 13, 2023

Subsystems (2)
lore
Share & tools
lore

Alan Huang

author
#0 lore raw

PATCH v2 1/1 docs/RCU: Add the missing rcu_read_unlock()

We should exit the RCU read-side critical section before re-entering.

---
 Documentation/RCU/rculist_nulls.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/RCU/rculist_nulls.rst +3 -1
index 9a734bf54..0612a6387 100644
@@ -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
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Alan Huang

We should exit the RCU read-side critical section before re-entering.

Queued and pushed, thank you!

Thanx, Paul

Quoted 23 lines
---
 Documentation/RCU/rculist_nulls.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/RCU/rculist_nulls.rst +3 -1
index 9a734bf54..0612a6387 100644
@@ -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
Signature · 1 line
2.34.1