diff mbox series

[v2] docs/RCU: Add the missing rcu_read_unlock()

Message ID 20230613005701.8728-1-mmpgouride@gmail.com (mailing list archive)
State Accepted
Commit f2c596cf32087cd1e45a14fe79f801da8d1057fa
Headers show
Series [v2] docs/RCU: Add the missing rcu_read_unlock() | expand

Commit Message

Alan Huang June 13, 2023, 12:57 a.m. UTC
We should exit the RCU read-side critical section before re-entering.

Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
 Documentation/RCU/rculist_nulls.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul E. McKenney June 13, 2023, 3:16 a.m. UTC | #1
On Tue, Jun 13, 2023 at 12:57:01AM +0000, Alan Huang wrote:
> We should exit the RCU read-side critical section before re-entering.
> 
> Signed-off-by: Alan Huang <mmpgouride@gmail.com>

Queued and pushed, thank you!

							Thanx, Paul

> ---
>  Documentation/RCU/rculist_nulls.rst | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst
> index 9a734bf54..0612a6387 100644
> --- a/Documentation/RCU/rculist_nulls.rst
> +++ b/Documentation/RCU/rculist_nulls.rst
> @@ -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
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst
index 9a734bf54..0612a6387 100644
--- a/Documentation/RCU/rculist_nulls.rst
+++ b/Documentation/RCU/rculist_nulls.rst
@@ -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