aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-29 21:29:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-29 21:29:23 -0400
commit88502b9c0a5dcc884c0dbfb6ddf964ff5da5d8d3 (patch)
treef79f728c308100bc3e57d0d2f5d1e00d90406a0d /lib
parente18945b159a1cdbc031f1d3b0b7e515a33bdcbf7 (diff)
parent15c03dd4859ab16f9212238f29dd315654aa94f6 (diff)
Merge 3.12-rc3 into driver-core-next
We want the driver core and sysfs fixes in here to make merges and development easier. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject.c5
-rw-r--r--lib/lockref.c23
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index a5a9b13b0648..151089788c21 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -1006,10 +1006,7 @@ const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj)
1006 1006
1007bool kobj_ns_current_may_mount(enum kobj_ns_type type) 1007bool kobj_ns_current_may_mount(enum kobj_ns_type type)
1008{ 1008{
1009 bool may_mount = false; 1009 bool may_mount = true;
1010
1011 if (type == KOBJ_NS_TYPE_NONE)
1012 return true;
1013 1010
1014 spin_lock(&kobj_ns_type_lock); 1011 spin_lock(&kobj_ns_type_lock);
1015 if ((type > KOBJ_NS_TYPE_NONE) && (type < KOBJ_NS_TYPES) && 1012 if ((type > KOBJ_NS_TYPE_NONE) && (type < KOBJ_NS_TYPES) &&
diff --git a/lib/lockref.c b/lib/lockref.c
index 677d036cf3c7..6f9d434c1521 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -4,6 +4,22 @@
4#ifdef CONFIG_CMPXCHG_LOCKREF 4#ifdef CONFIG_CMPXCHG_LOCKREF
5 5
6/* 6/*
7 * Allow weakly-ordered memory architectures to provide barrier-less
8 * cmpxchg semantics for lockref updates.
9 */
10#ifndef cmpxchg64_relaxed
11# define cmpxchg64_relaxed cmpxchg64
12#endif
13
14/*
15 * Allow architectures to override the default cpu_relax() within CMPXCHG_LOOP.
16 * This is useful for architectures with an expensive cpu_relax().
17 */
18#ifndef arch_mutex_cpu_relax
19# define arch_mutex_cpu_relax() cpu_relax()
20#endif
21
22/*
7 * Note that the "cmpxchg()" reloads the "old" value for the 23 * Note that the "cmpxchg()" reloads the "old" value for the
8 * failure case. 24 * failure case.
9 */ 25 */
@@ -14,12 +30,13 @@
14 while (likely(arch_spin_value_unlocked(old.lock.rlock.raw_lock))) { \ 30 while (likely(arch_spin_value_unlocked(old.lock.rlock.raw_lock))) { \
15 struct lockref new = old, prev = old; \ 31 struct lockref new = old, prev = old; \
16 CODE \ 32 CODE \
17 old.lock_count = cmpxchg64(&lockref->lock_count, \ 33 old.lock_count = cmpxchg64_relaxed(&lockref->lock_count, \
18 old.lock_count, new.lock_count); \ 34 old.lock_count, \
35 new.lock_count); \
19 if (likely(old.lock_count == prev.lock_count)) { \ 36 if (likely(old.lock_count == prev.lock_count)) { \
20 SUCCESS; \ 37 SUCCESS; \
21 } \ 38 } \
22 cpu_relax(); \ 39 arch_mutex_cpu_relax(); \
23 } \ 40 } \
24} while (0) 41} while (0)
25 42