linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsprogs: fix ext2fs_extent_get for uninit leaf extents
@ 2008-03-19 20:20 Eric Sandeen
  2008-03-20 20:20 ` Theodore Tso
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2008-03-19 20:20 UTC (permalink / raw)
  To: ext4 development, Theodore Tso; +Cc: Aneesh Kumar K.V

Fix ext2fs_extent_get for uninit leaf extents

From: Eric Sandeen <sandeen@redhat.com>

The ext2fs_extent_get() function was not OR-ing together UNINIT
and LEAF flags in the case where an extent was both; so if we 
had an extent which was both uniint and leaf, pass1 would bail
out where depth == max_depth but was not marked as leaf, and
e2fsck (from the next branch) would abort with:

e2fsck 1.40.8 (13-Mar-2008)
Pass 1: Checking inodes, blocks, and sizes
Error1: No 'down' extent
Aborted

Also, if the error is encountered again, print the inode number
to aid debugging until it's properly handled, at least.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

---

diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index ab211b1..c616984 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -463,10 +463,10 @@ retry:
 			((__u64) ext2fs_le16_to_cpu(ex->ee_start_hi) << 32);
 		extent->e_lblk = ext2fs_le32_to_cpu(ex->ee_block);
 		extent->e_len = ext2fs_le16_to_cpu(ex->ee_len);
-		extent->e_flags = EXT2_EXTENT_FLAGS_LEAF;
+		extent->e_flags |= EXT2_EXTENT_FLAGS_LEAF;
 		if (extent->e_len > EXT_INIT_MAX_LEN) {
 			extent->e_len -= EXT_INIT_MAX_LEN;
-			extent->e_flags = EXT2_EXTENT_FLAGS_UNINIT;
+			extent->e_flags |= EXT2_EXTENT_FLAGS_UNINIT;
 		}
 	} else {
 		extent->e_pblk = ext2fs_le32_to_cpu(ix->ei_leaf) +

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 50e38e1..79e9f23 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1622,14 +1622,16 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
 			pctx->errcode = ext2fs_extent_get(ehandle,
 						  EXT2_EXTENT_DOWN, &extent);
 			if (pctx->errcode) {
-				printf("Error1: %s\n", error_message(pctx->errcode));
+				printf("Error1: %s on inode %lld\n",
+					error_message(pctx->errcode), pctx->ino);
 				abort();
 			}
 			scan_extent_node(ctx, pctx, pb, ehandle);
 			pctx->errcode = ext2fs_extent_get(ehandle,
 						  EXT2_EXTENT_UP, &extent);
 			if (pctx->errcode) {
-				printf("Error1: %s\n", error_message(pctx->errcode));
+				printf("Error1: %s on inode %lld\n",
+					error_message(pctx->errcode), pctx->ino);
 				abort();
 			}
 			goto next;


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

end of thread, other threads:[~2008-03-20 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19 20:20 [PATCH] e2fsprogs: fix ext2fs_extent_get for uninit leaf extents Eric Sandeen
2008-03-20 20:20 ` Theodore Tso
2008-03-20 21:04   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).