Commit 5b11687924e40790deb0d5f959247ade82196665
Committed by
Linus Torvalds
1 parent
2384f55f8a
Exists in
master
and in
7 other branches
[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: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 3 additions and 6 deletions Side-by-side Diff
fs/ext3/balloc.c
... | ... | @@ -1010,7 +1010,7 @@ |
1010 | 1010 | * allocation within the reservation window. |
1011 | 1011 | * |
1012 | 1012 | * This will avoid keeping on searching the reservation list again and |
1013 | - * again when someboday is looking for a free block (without | |
1013 | + * again when somebody is looking for a free block (without | |
1014 | 1014 | * reservation), and there are lots of free blocks, but they are all |
1015 | 1015 | * being reserved. |
1016 | 1016 | * |
1017 | 1017 | |
... | ... | @@ -1416,12 +1416,12 @@ |
1416 | 1416 | unsigned long bitmap_count, x; |
1417 | 1417 | struct buffer_head *bitmap_bh = NULL; |
1418 | 1418 | |
1419 | - lock_super(sb); | |
1420 | 1419 | es = EXT3_SB(sb)->s_es; |
1421 | 1420 | desc_count = 0; |
1422 | 1421 | bitmap_count = 0; |
1423 | 1422 | gdp = NULL; |
1424 | 1423 | |
1424 | + smp_rmb(); | |
1425 | 1425 | for (i = 0; i < ngroups; i++) { |
1426 | 1426 | gdp = ext3_get_group_desc(sb, i, NULL); |
1427 | 1427 | if (!gdp) |
... | ... | @@ -1440,7 +1440,6 @@ |
1440 | 1440 | brelse(bitmap_bh); |
1441 | 1441 | printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n", |
1442 | 1442 | le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count); |
1443 | - unlock_super(sb); | |
1444 | 1443 | return bitmap_count; |
1445 | 1444 | #else |
1446 | 1445 | desc_count = 0; |
fs/ext3/ialloc.c
... | ... | @@ -704,7 +704,6 @@ |
704 | 704 | unsigned long bitmap_count, x; |
705 | 705 | struct buffer_head *bitmap_bh = NULL; |
706 | 706 | |
707 | - lock_super (sb); | |
708 | 707 | es = EXT3_SB(sb)->s_es; |
709 | 708 | desc_count = 0; |
710 | 709 | bitmap_count = 0; |
... | ... | @@ -727,7 +726,6 @@ |
727 | 726 | brelse(bitmap_bh); |
728 | 727 | printk("ext3_count_free_inodes: stored = %u, computed = %lu, %lu\n", |
729 | 728 | le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count); |
730 | - unlock_super(sb); | |
731 | 729 | return desc_count; |
732 | 730 | #else |
733 | 731 | desc_count = 0; |
fs/ext3/inode.c
... | ... | @@ -491,7 +491,7 @@ |
491 | 491 | * the same format as ext3_get_branch() would do. We are calling it after |
492 | 492 | * we had read the existing part of chain and partial points to the last |
493 | 493 | * triple of that (one with zero ->key). Upon the exit we have the same |
494 | - * picture as after the successful ext3_get_block(), excpet that in one | |
494 | + * picture as after the successful ext3_get_block(), except that in one | |
495 | 495 | * place chain is disconnected - *branch->p is still zero (we did not |
496 | 496 | * set the last link), but branch->key contains the number that should |
497 | 497 | * be placed into *branch->p to fill that gap. |