public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Don't claim block from group which has corrupt bitmap
@ 2008-02-11 11:30 Aneesh Kumar K.V
  2008-02-11 11:36 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2008-02-11 11:30 UTC (permalink / raw)
  To: tytso, cmm; +Cc: linux-ext4, Aneesh Kumar K.V

In ext4_mb_complex_scan_group, if the extent length of the newly
found extentet is greater than than the total free blocks counted
in group info, break without claiming the block.

Document different ext4_error usage, explaining the state with which we
continue if we mount with errors=continue

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/ext4/mballoc.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index dd0fcfc..898eefc 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -967,6 +967,10 @@ static void ext4_mb_generate_buddy(struct super_block *sb,
 		ext4_error(sb, __FUNCTION__,
 			"EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n",
 			group, free, grp->bb_free);
+		/*
+		 * If we intent to continue, we consider group descritor
+		 * corrupt and update bb_free using bitmap value
+		 */
 		grp->bb_free = free;
 	}
 
@@ -1822,7 +1826,7 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
 						EXT4_BLOCKS_PER_GROUP(sb), i);
 		if (i >= EXT4_BLOCKS_PER_GROUP(sb)) {
 			/*
-			 * IF we corrupt the bitmap  we won't find any
+			 * IF we have corrupt bitmap, we won't find any
 			 * free blocks even though group info says we
 			 * we have free blocks
 			 */
@@ -1838,6 +1842,12 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
 			ext4_error(sb, __FUNCTION__, "%d free blocks as per "
 					"group info. But got %d blocks\n",
 					free, ex.fe_len);
+			/*
+			 * The number of free blocks differs. This mostly
+			 * indicate that the bitmap is corrupt. So exit
+			 * without claiming the space.
+			 */
+			break;
 		}
 
 		ext4_mb_measure_extent(ac, &ex, e4b);
@@ -3771,6 +3781,10 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b,
 			(unsigned long) pa->pa_len);
 		ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n",
 						free, pa->pa_free);
+		/*
+		 * pa is already deleted so we use the value obtained
+		 * from the bitmap and continue.
+		 */
 	}
 	atomic_add(free, &sbi->s_mb_discarded);
 	if (ac)
-- 
1.5.4.23.gef5b9-dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Don't claim block from group which has corrupt bitmap
  2008-02-11 11:30 [PATCH] ext4: Don't claim block from group which has corrupt bitmap Aneesh Kumar K.V
@ 2008-02-11 11:36 ` Aneesh Kumar K.V
  0 siblings, 0 replies; 2+ messages in thread
From: Aneesh Kumar K.V @ 2008-02-11 11:36 UTC (permalink / raw)
  To: tytso, cmm; +Cc: linux-ext4

On Mon, Feb 11, 2008 at 05:00:18PM +0530, Aneesh Kumar K.V wrote:
> In ext4_mb_complex_scan_group, if the extent length of the newly
> found extentet is greater than than the total free blocks counted
> in group info, break without claiming the block.
> 
> Document different ext4_error usage, explaining the state with which we
> continue if we mount with errors=continue
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  fs/ext4/mballoc.c |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)


This was actually part of the version 2 of the patch
ext4_avoid_panic_in_case_of_corrupted_bitmap.patch. But we missed it
in the last update. So sending it as a separate patch.


-aneesh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-11 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-11 11:30 [PATCH] ext4: Don't claim block from group which has corrupt bitmap Aneesh Kumar K.V
2008-02-11 11:36 ` Aneesh Kumar K.V

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox