User: | Jiri Slaby |
Error type: | Double Lock |
Error type description: | Some lock is locked twice unintentionally in a sequence |
File location: | fs/mbcache.c |
Line in file: | 585 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
Smatch (1.59) |
Entered: | 2011-11-07 22:19:59 UTC |
555static struct mb_cache_entry * 556__mb_cache_entry_find(struct list_head *l, struct list_head *head, 557 int index, struct block_device *bdev, unsigned int key) 558{ 559 while (l != head) { 560 struct mb_cache_entry *ce = 561 list_entry(l, struct mb_cache_entry, 562 e_indexes[index].o_list); 563 if (ce->e_bdev == bdev && ce->e_indexes[index].o_key == key) { 564 DEFINE_WAIT(wait); 565 566 if (!list_empty(&ce->e_lru_list)) 567 list_del_init(&ce->e_lru_list); 568 569 /* Incrementing before holding the lock gives readers 570 priority over writers. */ 571 ce->e_used++; 572 while (ce->e_used >= MB_CACHE_WRITER) { 573 ce->e_queued++; 574 prepare_to_wait(&mb_cache_queue, &wait, 575 TASK_UNINTERRUPTIBLE); 576 spin_unlock(&mb_cache_spinlock); 577 schedule(); 578 spin_lock(&mb_cache_spinlock); 579 ce->e_queued--; 580 } 581 finish_wait(&mb_cache_queue, &wait); 582 583 if (!__mb_cache_entry_is_hashed(ce)) { 584 __mb_cache_entry_release_unlock(ce); 585 spin_lock(&mb_cache_spinlock); 586 return ERR_PTR(-EAGAIN); 587 } 588 return ce; 589 } 590 l = l->next; 591 } 592 return NULL; 593} 594 595