Showing error 1691

User: Jiri Slaby
Error type: Double Lock
Error type description: Some lock is locked twice unintentionally in a sequence
File location: drivers/md/dm-region-hash.c
Line in file: 606
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 14:01:52 UTC


Source:

576        if (r <= 0)
577                return r;
578
579        /*
580         * Get this region, and start it quiescing by setting the
581         * recovering flag.
582         */
583        read_lock(&rh->hash_lock);
584        reg = __rh_find(rh, region);
585        read_unlock(&rh->hash_lock);
586
587        spin_lock_irq(&rh->region_lock);
588        reg->state = DM_RH_RECOVERING;
589
590        /* Already quiesced ? */
591        if (atomic_read(&reg->pending))
592                list_del_init(&reg->list);
593        else
594                list_move(&reg->list, &rh->quiesced_regions);
595
596        spin_unlock_irq(&rh->region_lock);
597
598        return 1;
599}
600
601void dm_rh_recovery_prepare(struct dm_region_hash *rh)
602{
603        /* Extra reference to avoid race with dm_rh_stop_recovery */
604        atomic_inc(&rh->recovery_in_flight);
605
606        while (!down_trylock(&rh->recovery_count)) {
607                atomic_inc(&rh->recovery_in_flight);
608                if (__rh_recovery_prepare(rh) <= 0) {
609                        atomic_dec(&rh->recovery_in_flight);
610                        up(&rh->recovery_count);
611                        break;
612                }
613        }
614
615        /* Drop the extra reference */
616        if (atomic_dec_and_test(&rh->recovery_in_flight))
Show full sources