security/apparmor: Replace homebrew use of write_can_lock with lockdep
Subsystems (14)
PATCH 1/2 security/apparmor: Replace homebrew use of write_can_lock with lockdep
The lockdep subsystem provides a robust way to assert that a lock is held, so use that instead of write_can_lock, which can give incorrect results for qrwlocks.
--- security/apparmor/include/lib.h | 11 ----------- security/apparmor/label.c | 8 ++++---- 2 files changed, 4 insertions(+), 15 deletions(-)
security/apparmor/include/lib.h +0 -11
@@ -19,17 +19,6 @@#include "match.h" -/* Provide our own test for whether a write lock is held for asserts -* this is because on none SMP systems write_can_lock will always -* resolve to true, which is what you want for code making decisions -* based on it, but wrong for asserts checking that the lock is held -*/ -#ifdef CONFIG_SMP -#define write_is_locked (X ) !write_can_lock(X) -#else -#define write_is_locked (X ) (1) -#endif /* CONFIG_SMP */ -/* * DEBUG remains global (no per profile flag) since it is mostly used in sysctl * which is not related to profile accesses.
security/apparmor/label.c +4 -4
@@ -80,7 +80,7 @@ void __aa_proxy_redirect(struct aa_label *orig, struct aa_label *new)AA_BUG (!orig);AA_BUG (!new); -AA_BUG (!write_is_locked (&labels_set (orig)->lock)); +lockdep_assert_held_exclusive (&labels_set (orig)->lock); tmp =rcu_dereference_protected (orig->proxy->label, &labels_ns (orig)->lock);
@@ -571,7 +571,7 @@ static bool __label_remove(struct aa_label *label, struct aa_label *new)AA_BUG (!ls);AA_BUG (!label); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);if (new)__aa_proxy_redirect (label, new);
@@ -608,7 +608,7 @@ static bool __label_replace(struct aa_label *old, struct aa_label *new)AA_BUG (!ls);AA_BUG (!old);AA_BUG (!new); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);AA_BUG (new->flags &FLAG_IN_TREE );if (!label_is_stale (old))
@@ -645,7 +645,7 @@ static struct aa_label *__label_insert(struct aa_labelset *ls,AA_BUG (!ls);AA_BUG (!label);AA_BUG (labels_set (label) != ls); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);AA_BUG (label->flags &FLAG_IN_TREE );/* Figure out where to put new node */
Signature · 1 line
2.1.4
PATCH 2/2 locking: Remove {read,write}_can_lock
read_can_lock has no users in tree, and the last remaining user of write_can_lock (apparmor) is moved over to lockdep by the previous path.
Remove the unused macros, since they don't work in a concurrent environment and can give incorrect results for qrwlock.
--- arch/alpha/include/asm/spinlock.h | 10 ---------- arch/arc/include/asm/spinlock.h | 3 --- arch/arm/include/asm/spinlock.h | 6 ------ arch/blackfin/include/asm/spinlock.h | 10 ---------- arch/hexagon/include/asm/spinlock.h | 10 ---------- arch/ia64/include/asm/spinlock.h | 3 --- arch/m32r/include/asm/spinlock.h | 12 ------------ arch/metag/include/asm/spinlock_lnkget.h | 30 ------------------------------ arch/metag/include/asm/spinlock_lock1.h | 20 -------------------- arch/mn10300/include/asm/spinlock.h | 12 ------------ arch/parisc/include/asm/spinlock.h | 18 ------------------ arch/powerpc/include/asm/spinlock.h | 3 --- arch/s390/include/asm/spinlock.h | 12 ------------ arch/sh/include/asm/spinlock-cas.h | 12 ------------ arch/sh/include/asm/spinlock-llsc.h | 12 ------------ arch/sparc/include/asm/spinlock_32.h | 3 --- arch/tile/include/asm/spinlock_32.h | 16 ---------------- arch/tile/include/asm/spinlock_64.h | 18 ------------------ arch/xtensa/include/asm/spinlock.h | 2 -- include/asm-generic/qrwlock.h | 20 -------------------- include/linux/rwlock.h | 3 --- include/linux/spinlock_up.h | 3 --- kernel/locking/spinlock.c | 2 -- 23 files changed, 240 deletions(-)
arch/alpha/include/asm/spinlock.h +0 -10
@@ -54,16 +54,6 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)/***********************************************************/ -static inline int arch_read_can_lock (arch_rwlock_t *lock) -{ -return (lock->lock &1 ) ==0 ; -} - -static inline int arch_write_can_lock (arch_rwlock_t *lock) -{ -return lock->lock ==0 ; -} -static inline void arch_read_lock (arch_rwlock_t *lock) {long regx;
arch/arc/include/asm/spinlock.h +0 -3
@@ -410,9 +410,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#endif -#define arch_read_can_lock (x) ((x)->counter > 0) -#define arch_write_can_lock (x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__) -#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock)
arch/arm/include/asm/spinlock.h +0 -6
@@ -193,9 +193,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)dsb_sev (); } -/* write_can_lock - would write_trylock() succeed? */ -#define arch_write_can_lock (x) (ACCESS_ONCE((x)->lock) == 0) -/* * Read locks are a bit more hairy: * - Exclusively load the lock value.
@@ -273,9 +270,6 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) } } -/* read_can_lock - would read_trylock() succeed? */ -#define arch_read_can_lock (x) (ACCESS_ONCE((x)->lock) < 0x80000000) -#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock)
arch/blackfin/include/asm/spinlock.h +0 -10
@@ -48,16 +48,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)__raw_spin_unlock_asm (&lock->lock); } -static inline int arch_read_can_lock (arch_rwlock_t *rw) -{ -return __raw_uncached_fetch_asm (&rw->lock) >0 ; -} - -static inline int arch_write_can_lock (arch_rwlock_t *rw) -{ -return __raw_uncached_fetch_asm (&rw->lock) ==RW_LOCK_BIAS ; -} -static inline void arch_read_lock (arch_rwlock_t *rw) {__raw_read_lock_asm (&rw->lock);
arch/hexagon/include/asm/spinlock.h +0 -10
@@ -86,16 +86,6 @@ static inline int arch_read_trylock(arch_rwlock_t *lock)return temp; } -static inline int arch_read_can_lock (arch_rwlock_t *rwlock) -{ -return rwlock->lock ==0 ; -} - -static inline int arch_write_can_lock (arch_rwlock_t *rwlock) -{ -return rwlock->lock ==0 ; -} -/* Stuffs a -1 in the lock value? */ static inline void arch_write_lock (arch_rwlock_t *lock) {
arch/ia64/include/asm/spinlock.h +0 -3
@@ -127,9 +127,6 @@ static __always_inline void arch_spin_lock_flags(arch_spinlock_t *lock,arch_spin_lock (lock); } -#define arch_read_can_lock (rw) (*(volatile int *)(rw) >= 0) -#define arch_write_can_lock (rw) (*(volatile int *)(rw) == 0) -#ifdef ASM_SUPPORTED static __always_inline void
arch/m32r/include/asm/spinlock.h +0 -12
@@ -137,18 +137,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)* semaphore.h for details. -ben */ -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_read_can_lock (x) ((int)(x)->lock > 0) - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_write_can_lock (x) ((x)->lock == RW_LOCK_BIAS) -static inline void arch_read_lock (arch_rwlock_t *rw) {unsigned long tmp0, tmp1;
arch/metag/include/asm/spinlock_lnkget.h +0 -30
@@ -136,21 +136,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) : "memory"); } -/* write_can_lock - would write_trylock() succeed? */ -static inline int arch_write_can_lock (arch_rwlock_t *rw) -{ -int ret; - - asmvolatile ("LNKGETD %0, [%1]\n" -"CMP %0, #0\n" -"MOV %0, #1\n" -"XORNZ %0, %0, %0\n" - :"=&d" (ret) - :"da" (&rw->lock) - :"cc" ); -return ret; -} -/* * Read locks are a bit more hairy: * - Exclusively load the lock value.
@@ -224,21 +209,6 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)return tmp; } -/* read_can_lock - would read_trylock() succeed? */ -static inline int arch_read_can_lock (arch_rwlock_t *rw) -{ -int tmp; - - asmvolatile ("LNKGETD %0, [%1]\n" -"CMP %0, %2\n" -"MOV %0, #1\n" -"XORZ %0, %0, %0\n" - :"=&d" (tmp) - :"da" (&rw->lock),"bd" (0x80000000 ) - :"cc" ); -return tmp; -} -#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock)
arch/metag/include/asm/spinlock_lock1.h +0 -20
@@ -104,16 +104,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) rw->lock =0 ; } -/* write_can_lock - would write_trylock() succeed? */ -static inline int arch_write_can_lock (arch_rwlock_t *rw) -{ -unsigned int ret; - -barrier (); - ret = rw->lock; -return (ret ==0 ); -} -/* * Read locks are a bit more hairy: * - Exclusively load the lock value.
@@ -171,14 +161,4 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) return (ret < 0x80000000); } -/* read_can_lock - would read_trylock() succeed? */ -static inline int arch_read_can_lock (arch_rwlock_t *rw) -{ -unsigned int ret; - -barrier (); - ret = rw->lock; -return (ret <0x80000000 ); -} -#endif /* __ASM_SPINLOCK_LOCK1_H */
arch/mn10300/include/asm/spinlock.h +0 -12
@@ -98,18 +98,6 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *lock,* read-locks. */ -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_read_can_lock (x) ((int)(x)->lock > 0) - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_write_can_lock (x) ((x)->lock == RW_LOCK_BIAS) -/* * On mn10300, we implement read-write locks as a 32-bit counter * with the high bit (sign) being the "contended" bit.
arch/parisc/include/asm/spinlock.h +0 -18
@@ -168,24 +168,6 @@ static __inline__ int arch_write_trylock(arch_rwlock_t *rw)return result; } -/* -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -static __inline__int arch_read_can_lock (arch_rwlock_t *rw) -{ -return rw->counter >=0 ; -} - -/* -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -static __inline__int arch_write_can_lock (arch_rwlock_t *rw) -{ -return !rw->counter; -} -#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock)
arch/powerpc/include/asm/spinlock.h +0 -3
@@ -181,9 +181,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)* read-locks. */ -#define arch_read_can_lock (rw) ((rw)->lock >= 0) -#define arch_write_can_lock (rw) (!(rw)->lock) -#ifdef CONFIG_PPC64 #define __DO_SIGN_EXTEND "extsw %0,%0\n"#define WRLOCK_TOKEN LOCK_TOKEN/* it's negative */
arch/s390/include/asm/spinlock.h +0 -12
@@ -110,18 +110,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp)* read-locks. */ -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_read_can_lock (x) ((int)(x)->lock >= 0) - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_write_can_lock (x) ((x)->lock == 0) -extern int _raw_read_trylock_retry (arch_rwlock_t *lp);extern int _raw_write_trylock_retry (arch_rwlock_t *lp);
arch/sh/include/asm/spinlock-cas.h +0 -12
@@ -53,18 +53,6 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)* read-locks. */ -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_read_can_lock (x) ((x)->lock > 0) - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_write_can_lock (x) ((x)->lock == RW_LOCK_BIAS) -static inline void arch_read_lock (arch_rwlock_t *rw) {unsigned old;
arch/sh/include/asm/spinlock-llsc.h +0 -12
@@ -89,18 +89,6 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)* read-locks. */ -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_read_can_lock (x) ((x)->lock > 0) - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -#define arch_write_can_lock (x) ((x)->lock == RW_LOCK_BIAS) -static inline void arch_read_lock (arch_rwlock_t *rw) {unsigned long tmp;
arch/sparc/include/asm/spinlock_32.h +0 -3
@@ -190,9 +190,6 @@ static inline int __arch_read_trylock(arch_rwlock_t *rw)#define arch_read_relax (lock) cpu_relax()#define arch_write_relax (lock) cpu_relax() -#define arch_read_can_lock (rw) (!((rw)->lock & 0xff)) -#define arch_write_can_lock (rw) (!(rw)->lock) -#endif /* !(__ASSEMBLY__) */ #endif /* __SPARC_SPINLOCK_H */
arch/tile/include/asm/spinlock_32.h +0 -16
@@ -80,22 +80,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)#define _RD_COUNT_WIDTH 8/** -* arch_read_can_lock() - would read_trylock() succeed? -*/ -static inline int arch_read_can_lock (arch_rwlock_t *rwlock) -{ -return (rwlock->lock << _RD_COUNT_WIDTH) ==0 ; -} - -/** -* arch_write_can_lock() - would write_trylock() succeed? -*/ -static inline int arch_write_can_lock (arch_rwlock_t *rwlock) -{ -return rwlock->lock ==0 ; -} - -/** * arch_read_lock() - acquire a read lock. */ void arch_read_lock (arch_rwlock_t *rwlock);
arch/tile/include/asm/spinlock_64.h +0 -18
@@ -93,24 +93,6 @@ static inline int arch_write_val_locked(int val)return val <0 ;/* Optimize "val & __WRITE_LOCK_BIT". */ } -/** -* read_can_lock - would read_trylock() succeed? -* @lock: the rwlock in question. -*/ -static inline int arch_read_can_lock (arch_rwlock_t *rw) -{ -return !arch_write_val_locked (rw->lock); -} - -/** -* write_can_lock - would write_trylock() succeed? -* @lock: the rwlock in question. -*/ -static inline int arch_write_can_lock (arch_rwlock_t *rw) -{ -return rw->lock ==0 ; -} -extern void __read_lock_failed (arch_rwlock_t *rw);static inline void arch_read_lock (arch_rwlock_t *rw)
arch/xtensa/include/asm/spinlock.h +0 -2
@@ -97,8 +97,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)* 0x80000000 one writer owns the rwlock, no other writers, no readers */ -#define arch_write_can_lock (x) ((x)->lock == 0) -static inline void arch_write_lock (arch_rwlock_t *rw) {unsigned long tmp;
include/asm-generic/qrwlock.h +0 -20
@@ -53,24 +53,6 @@ extern void queued_read_lock_slowpath(struct qrwlock *lock, u32 cnts);extern void queued_write_lock_slowpath (struct qrwlock *lock);/** -* queued_read_can_lock- would read_trylock() succeed? -* @lock: Pointer to queue rwlock structure -*/ -static inline int queued_read_can_lock (struct qrwlock *lock) -{ -return !(atomic_read (&lock->cnts) & _QW_WMASK); -} - -/** -* queued_write_can_lock- would write_trylock() succeed? -* @lock: Pointer to queue rwlock structure -*/ -static inline int queued_write_can_lock (struct qrwlock *lock) -{ -return !atomic_read (&lock->cnts); -} - -/** * queued_read_trylock - try to acquire read lock of a queue rwlock * @lock : Pointer to queue rwlock structure * Return: 1 if lock acquired, 0 if failed
@@ -169,8 +151,6 @@ static inline void queued_write_unlock(struct qrwlock *lock)* Remapping rwlock architecture specific functions to the corresponding * queue rwlock functions. */ -#define arch_read_can_lock (l) queued_read_can_lock(l) -#define arch_write_can_lock (l) queued_write_can_lock(l)#define arch_read_lock (l) queued_read_lock(l)#define arch_write_lock (l) queued_write_lock(l)#define arch_read_trylock (l) queued_read_trylock(l)
include/linux/rwlock.h +0 -3
@@ -50,9 +50,6 @@ do { \# define do_raw_write_unlock (rwlock) do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)#endif -#define read_can_lock (rwlock) arch_read_can_lock(&(rwlock)->raw_lock) -#define write_can_lock (rwlock) arch_write_can_lock(&(rwlock)->raw_lock) -/* * Define the various rw_lock methods. Note we define these * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
include/linux/spinlock_up.h +0 -3
@@ -77,7 +77,4 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)#define arch_spin_is_contended (lock) (((void)(lock), 0)) -#define arch_read_can_lock (lock) (((void)(lock), 1)) -#define arch_write_can_lock (lock) (((void)(lock), 1)) -#endif /* __LINUX_SPINLOCK_UP_H */
kernel/locking/spinlock.c +0 -2
@@ -32,8 +32,6 @@* include/linux/spinlock_api_smp.h */ #else -#define raw_read_can_lock (l) read_can_lock(l) -#define raw_write_can_lock (l) write_can_lock(l)/* * Some architectures can relax in favour of the CPU owning the lock.
Signature · 1 line
2.1.4
Peter Zijlstra
maintainerQuoted 7 lines · Will Deacon
The lockdep subsystem provides a robust way to assert that a lock is held, so use that instead of
write_can_lock, which can give incorrect results for qrwlocks.Cc John Johansen <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Will Deacon <[email protected]>
Thanks Will, good to be able to finally remove that API.
Quoted 10 lines · Peter Zijlstra
Quoted 7 lines · Will Deacon
The lockdep subsystem provides a robust way to assert that a lock is held, so use that instead of
write_can_lock, which can give incorrect results for qrwlocks.Cc John Johansen <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Will Deacon <[email protected]>Thanks Will, good to be able to finally remove that API.
Yup, but my grep-fu missed these guys in kernel/locking/spinlock.c:
while (!raw_##op##_can_lock(lock) && (lock)->break_lock
so diff below to catch those and remove spin_can_lock too.
Let me spin a v2...
Will
--->8
include/linux/spinlock.h +0 -11
@@ -278,12 +278,6 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) 1 : ({ local_irq_restore(flags); 0; }); \ }) -/** -* raw_spin_can_lock - would raw_spin_trylock() succeed? -* @lock: the spinlock in question. -*/ -#define raw_spin_can_lock (lock) (!raw_spin_is_locked(lock)) -/* Include rwlock functions */ #include <linux/rwlock.h>
@@ -396,11 +390,6 @@ static __always_inline int spin_is_contended(spinlock_t *lock)return raw_spin_is_contended (&lock->rlock); } -static __always_inline int spin_can_lock(spinlock_t *lock) -{ -return raw_spin_can_lock (&lock->rlock); -} -#define assert_spin_locked (lock) assert_raw_spin_locked(&(lock)->rlock)/*
kernel/locking/spinlock.c +2 -2
@@ -66,7 +66,7 @@ void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ \if (!(lock)->break_lock) \ (lock)->break_lock =1 ; \ - while (!raw_##op##_can_lock(lock) && (lock)->break_lock)\ +while ((lock)->break_lock) \ arch_##op##_relax(&lock->raw_lock); \ } \ (lock)->break_lock =0 ; \
@@ -86,7 +86,7 @@ unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ \if (!(lock)->break_lock) \ (lock)->break_lock =1 ; \ - while (!raw_##op##_can_lock(lock) && (lock)->break_lock)\ +while ((lock)->break_lock) \ arch_##op##_relax(&lock->raw_lock); \ } \ (lock)->break_lock =0 ; \
Quoted 7 lines · Will Deacon
The lockdep subsystem provides a robust way to assert that a lock is held, so use that instead of
write_can_lock, which can give incorrect results for qrwlocks.Cc John Johansen <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Will Deacon <[email protected]>
oh nice,
Quoted 68 lines
--- security/apparmor/include/lib.h | 11 ----------- security/apparmor/label.c | 8 ++++---- 2 files changed, 4 insertions(+), 15 deletions(-)security/apparmor/include/lib.h +0
-11@@ -19,17 +19,6 @@#include "match.h" -/* Provide our own test for whether a write lock is held for asserts -* this is because on none SMP systems write_can_lock will always -* resolve to true, which is what you want for code making decisions -* based on it, but wrong for asserts checking that the lock is held -*/ -#ifdef CONFIG_SMP -#define write_is_locked (X ) !write_can_lock(X) -#else -#define write_is_locked (X ) (1) -#endif /* CONFIG_SMP */ -/* * DEBUG remains global (no per profile flag) since it is mostly used in sysctl * which is not related to profile accesses. security/apparmor/label.c +4
-4@@ -80,7 +80,7 @@ void __aa_proxy_redirect(struct aa_label *orig, struct aa_label *new)AA_BUG (!orig);AA_BUG (!new); -AA_BUG (!write_is_locked (&labels_set (orig)->lock)); +lockdep_assert_held_exclusive (&labels_set (orig)->lock); tmp =rcu_dereference_protected (orig->proxy->label, &labels_ns (orig)->lock);@@ -571,7 +571,7 @@ static bool __label_remove(struct aa_label *label, struct aa_label *new)AA_BUG (!ls);AA_BUG (!label); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);if (new)__aa_proxy_redirect (label, new);@@ -608,7 +608,7 @@ static bool __label_replace(struct aa_label *old, struct aa_label *new)AA_BUG (!ls);AA_BUG (!old);AA_BUG (!new); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);AA_BUG (new->flags &FLAG_IN_TREE );if (!label_is_stale (old))@@ -645,7 +645,7 @@ static struct aa_label *__label_insert(struct aa_labelset *ls,AA_BUG (!ls);AA_BUG (!label);AA_BUG (labels_set (label) != ls); -AA_BUG (!write_is_locked (&ls->lock)); +lockdep_assert_held_exclusive (&ls->lock);AA_BUG (label->flags &FLAG_IN_TREE );/* Figure out where to put new node */