Commit 5b116879 authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Linus Torvalds

[PATCH] Locking problems while EXT3FS_DEBUG on

I noticed some problems while running ext3 with the debug flag set on.
More precisely, I was unable to umount the filesystem.  Some investigation
took me to the patch that follows.

At a first glance , the lock/unlock I've taken out seems really not
necessary, as the main code (outside debug) does not lock the super.  The
only additional danger operations that debug code introduces seems to be
related to bitmap, but bitmap operations tends to be all atomic anyway.

I also took the opportunity to fix 2 spelling errors.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2384f55f
...@@ -1010,7 +1010,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, ...@@ -1010,7 +1010,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
* allocation within the reservation window. * allocation within the reservation window.
* *
* This will avoid keeping on searching the reservation list again and * This will avoid keeping on searching the reservation list again and
* again when someboday is looking for a free block (without * again when somebody is looking for a free block (without
* reservation), and there are lots of free blocks, but they are all * reservation), and there are lots of free blocks, but they are all
* being reserved. * being reserved.
* *
...@@ -1416,12 +1416,12 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) ...@@ -1416,12 +1416,12 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
unsigned long bitmap_count, x; unsigned long bitmap_count, x;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
lock_super(sb);
es = EXT3_SB(sb)->s_es; es = EXT3_SB(sb)->s_es;
desc_count = 0; desc_count = 0;
bitmap_count = 0; bitmap_count = 0;
gdp = NULL; gdp = NULL;
smp_rmb();
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
gdp = ext3_get_group_desc(sb, i, NULL); gdp = ext3_get_group_desc(sb, i, NULL);
if (!gdp) if (!gdp)
...@@ -1440,7 +1440,6 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) ...@@ -1440,7 +1440,6 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
brelse(bitmap_bh); brelse(bitmap_bh);
printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n", printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n",
le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count); le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count);
unlock_super(sb);
return bitmap_count; return bitmap_count;
#else #else
desc_count = 0; desc_count = 0;
......
...@@ -704,7 +704,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb) ...@@ -704,7 +704,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb)
unsigned long bitmap_count, x; unsigned long bitmap_count, x;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
lock_super (sb);
es = EXT3_SB(sb)->s_es; es = EXT3_SB(sb)->s_es;
desc_count = 0; desc_count = 0;
bitmap_count = 0; bitmap_count = 0;
...@@ -727,7 +726,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb) ...@@ -727,7 +726,6 @@ unsigned long ext3_count_free_inodes (struct super_block * sb)
brelse(bitmap_bh); brelse(bitmap_bh);
printk("ext3_count_free_inodes: stored = %u, computed = %lu, %lu\n", printk("ext3_count_free_inodes: stored = %u, computed = %lu, %lu\n",
le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count); le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count);
unlock_super(sb);
return desc_count; return desc_count;
#else #else
desc_count = 0; desc_count = 0;
......
...@@ -491,7 +491,7 @@ static unsigned long ext3_find_goal(struct inode *inode, long block, ...@@ -491,7 +491,7 @@ static unsigned long ext3_find_goal(struct inode *inode, long block,
* the same format as ext3_get_branch() would do. We are calling it after * the same format as ext3_get_branch() would do. We are calling it after
* we had read the existing part of chain and partial points to the last * we had read the existing part of chain and partial points to the last
* triple of that (one with zero ->key). Upon the exit we have the same * triple of that (one with zero ->key). Upon the exit we have the same
* picture as after the successful ext3_get_block(), excpet that in one * picture as after the successful ext3_get_block(), except that in one
* place chain is disconnected - *branch->p is still zero (we did not * place chain is disconnected - *branch->p is still zero (we did not
* set the last link), but branch->key contains the number that should * set the last link), but branch->key contains the number that should
* be placed into *branch->p to fill that gap. * be placed into *branch->p to fill that gap.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment