Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / kernel / locking / lockdep.c
index eb8a54783fa0f47bb9b51568ec9dfed3d51cc48d..bf0c6b0dd9c59cd04a3ee00ef1f7c83cf38c49d0 100644 (file)
@@ -1936,12 +1936,12 @@ check_prevs_add(struct task_struct *curr, struct held_lock *next)
 
        for (;;) {
                int distance = curr->lockdep_depth - depth + 1;
-               hlock = curr->held_locks + depth-1;
+               hlock = curr->held_locks + depth - 1;
                /*
                 * Only non-recursive-read entries get new dependencies
                 * added:
                 */
-               if (hlock->read != 2) {
+               if (hlock->read != 2 && hlock->check) {
                        if (!check_prev_add(curr, hlock, next,
                                                distance, trylock_loop))
                                return 0;
@@ -2098,7 +2098,7 @@ static int validate_chain(struct task_struct *curr, struct lockdep_map *lock,
         * (If lookup_chain_cache() returns with 1 it acquires
         * graph_lock for us)
         */
-       if (!hlock->trylock && (hlock->check == 2) &&
+       if (!hlock->trylock && hlock->check &&
            lookup_chain_cache(curr, hlock, chain_key)) {
                /*
                 * Check whether last held lock:
@@ -2517,7 +2517,7 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
 
                BUG_ON(usage_bit >= LOCK_USAGE_STATES);
 
-               if (hlock_class(hlock)->key == __lockdep_no_validate__.subkeys)
+               if (!hlock->check)
                        continue;
 
                if (!mark_lock(curr, hlock, usage_bit))
@@ -3055,9 +3055,6 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        int class_idx;
        u64 chain_key;
 
-       if (!prove_locking)
-               check = 1;
-
        if (unlikely(!debug_locks))
                return 0;
 
@@ -3069,8 +3066,8 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
                return 0;
 
-       if (lock->key == &__lockdep_no_validate__)
-               check = 1;
+       if (!prove_locking || lock->key == &__lockdep_no_validate__)
+               check = 0;
 
        if (subclass < NR_LOCKDEP_CACHING_CLASSES)
                class = lock->class_cache[subclass];
@@ -3138,7 +3135,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        hlock->holdtime_stamp = lockstat_clock();
 #endif
 
-       if (check == 2 && !mark_irqflags(curr, hlock))
+       if (check && !mark_irqflags(curr, hlock))
                return 0;
 
        /* mark it as used: */