X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fpercpu-refcount.c;h=9ac959ef4cae972374540f34895465507e656d7b;hb=10e15a639caac3be3c142f8837a17520da84db9f;hp=c69938e4b0d5c64ce17ff351076b3679787178f8;hpb=33e465ce7cb30b71c113a26f36d293b545a28e12;p=cascardo%2Flinux.git diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index c69938e4b0d5..9ac959ef4cae 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c @@ -83,6 +83,7 @@ int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release, atomic_long_set(&ref->count, start_count); ref->release = release; + ref->confirm_switch = NULL; return 0; } EXPORT_SYMBOL_GPL(percpu_ref_init); @@ -102,6 +103,8 @@ void percpu_ref_exit(struct percpu_ref *ref) unsigned long __percpu *percpu_count = percpu_count_ptr(ref); if (percpu_count) { + /* non-NULL confirm_switch indicates switching in progress */ + WARN_ON_ONCE(ref->confirm_switch); free_percpu(percpu_count); ref->percpu_count_ptr = __PERCPU_REF_ATOMIC_DEAD; }