User: | Jiri Slaby |
Error type: | Double Unlock |
Error type description: | Some lock is unlocked twice unintentionally in a sequence |
File location: | fs/jffs2/nodemgmt.c |
Line in file: | 83 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2011-11-07 22:20:57 UTC |
53 D1(printk(KERN_DEBUG "jffs2_reserve_space(): alloc sem got\n")); 54 55 spin_lock(&c->erase_completion_lock); 56 57 /* this needs a little more thought (true <tglx> :)) */ 58 while(ret == -EAGAIN) { 59 while(c->nr_free_blocks + c->nr_erasing_blocks < blocksneeded) { 60 uint32_t dirty, avail; 61 62 /* calculate real dirty size 63 * dirty_size contains blocks on erase_pending_list 64 * those blocks are counted in c->nr_erasing_blocks. 65 * If one block is actually erased, it is not longer counted as dirty_space 66 * but it is counted in c->nr_erasing_blocks, so we add it and subtract it 67 * with c->nr_erasing_blocks * c->sector_size again. 68 * Blocks on erasable_list are counted as dirty_size, but not in c->nr_erasing_blocks 69 * This helps us to force gc and pick eventually a clean block to spread the load. 70 * We add unchecked_size here, as we hopefully will find some space to use. 71 * This will affect the sum only once, as gc first finishes checking 72 * of nodes. 73 */ 74 dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size + c->unchecked_size; 75 if (dirty < c->nospc_dirty_size) { 76 if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) { 77 D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n")); 78 break; 79 } 80 D1(printk(KERN_DEBUG "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n", 81 dirty, c->unchecked_size, c->sector_size)); 82 83 spin_unlock(&c->erase_completion_lock); 84 mutex_unlock(&c->alloc_sem); 85 return -ENOSPC; 86 } 87 88 /* Calc possibly available space. Possibly available means that we 89 * don't know, if unchecked size contains obsoleted nodes, which could give us some 90 * more usable space. This will affect the sum only once, as gc first finishes checking 91 * of nodes. 92 + Return -ENOSPC, if the maximum possibly available space is less or equal than 93 * blocksneeded * sector_size.