Skip to content
Commit a67823c1 authored by Roman Pen's avatar Roman Pen Committed by Tejun Heo
Browse files

percpu-refcount: init ->confirm_switch member properly



This patch targets two things which are related to ->confirm_switch:

 1. Init ->confirm_switch pointer with NULL on percpu_ref_init() or
    kernel frightfully complains with WARN_ON_ONCE(ref->confirm_switch)
    at __percpu_ref_switch_to_atomic if memory chunk was not properly
    zeroed.

 2. Warn if RCU callback is still in progress on percpu_ref_exit().
    The race still exists, because percpu_ref_call_confirm_rcu()
    drops ->confirm_switch to NULL early, but that is only a warning
    and still the caller is responsible that ref is no longer in
    active use.  Hopefully that can help to catch incorrect usage
    of percpu-refcount.

Signed-off-by: default avatarRoman Pen <roman.penyaev@profitbricks.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 33e465ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment