Return -EEXIST when the old cpu call_rcu_data has not been removed
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 15 Sep 2011 15:22:03 +0000 (11:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Sep 2011 15:22:03 +0000 (11:22 -0400)
To make it matches the comments.

It is the caller's responsibility to use
set_cpu_call_rcu_data(cpu, NULL) to remove the CPU's
call_rcu_data structure and dispose it.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-call-rcu-impl.h

index c822646e03834bbf26224feae2a71bcdfb5bf8e1..ae93468d8beb4e9fb9167a4dcc5b462892f3d9a2 100644 (file)
@@ -396,11 +396,19 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
                errno = EINVAL;
                return -EINVAL;
        }
+
        if (per_cpu_call_rcu_data == NULL) {
                call_rcu_unlock(&call_rcu_mutex);
                errno = ENOMEM;
                return -ENOMEM;
        }
+
+       if (per_cpu_call_rcu_data[cpu] != NULL && crdp != NULL) {
+               call_rcu_unlock(&call_rcu_mutex);
+               errno = EEXIST;
+               return -EEXIST;
+       }
+
        per_cpu_call_rcu_data[cpu] = crdp;
        call_rcu_unlock(&call_rcu_mutex);
        return 0;
This page took 0.025301 seconds and 4 git commands to generate.