2008-04-11 18:18:28

by Eric Sandeen

[permalink] [raw]
Subject: [PATCH 1/1] only check PR_1_EXTENT_ENDS_BEYOND for leaf nodes

pass1 was checking that an "extent's" start+len did not extend
past the last filesystem block, but unless we are at a leaf
block, the physical block is that of a node in the tree, and
the length may include sparseness. The test is only valid
for leaf blocks.

Signed-off-by: Eric Sandeen <[email protected]>
---
e2fsck/pass1.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 67a8370..4f21c3f 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1593,7 +1593,8 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
if (extent.e_pblk < ctx->fs->super->s_first_data_block ||
extent.e_pblk >= ctx->fs->super->s_blocks_count)
problem = PR_1_EXTENT_BAD_START_BLK;
- else if ((extent.e_pblk + extent.e_len) >
+ else if (is_leaf &&
+ (extent.e_pblk + extent.e_len) >
ctx->fs->super->s_blocks_count)
problem = PR_1_EXTENT_ENDS_BEYOND;

--
1.5.4.1