diff options
author | Paul Mackerras <paulus@samba.org> | 2007-02-06 22:05:13 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-02-06 22:05:13 -0500 |
commit | 8423200553113cc031caa9b147f6150a8e26545c (patch) | |
tree | 752c93a200c9ba056c7469c96f7e27d02c99291d /kernel/sys.c | |
parent | f03e64f2ca6ee3d0b7824536b1940497701fe766 (diff) | |
parent | 62d0cfcb27cf755cebdc93ca95dabc83608007cd (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index c7675c1bfdf2..6e2101dec0fc 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -323,11 +323,18 @@ EXPORT_SYMBOL_GPL(blocking_notifier_chain_unregister); | |||
323 | int blocking_notifier_call_chain(struct blocking_notifier_head *nh, | 323 | int blocking_notifier_call_chain(struct blocking_notifier_head *nh, |
324 | unsigned long val, void *v) | 324 | unsigned long val, void *v) |
325 | { | 325 | { |
326 | int ret; | 326 | int ret = NOTIFY_DONE; |
327 | 327 | ||
328 | down_read(&nh->rwsem); | 328 | /* |
329 | ret = notifier_call_chain(&nh->head, val, v); | 329 | * We check the head outside the lock, but if this access is |
330 | up_read(&nh->rwsem); | 330 | * racy then it does not matter what the result of the test |
331 | * is, we re-check the list after having taken the lock anyway: | ||
332 | */ | ||
333 | if (rcu_dereference(nh->head)) { | ||
334 | down_read(&nh->rwsem); | ||
335 | ret = notifier_call_chain(&nh->head, val, v); | ||
336 | up_read(&nh->rwsem); | ||
337 | } | ||
331 | return ret; | 338 | return ret; |
332 | } | 339 | } |
333 | 340 | ||