Fix ext2fs_extent_get for uninit leaf extents From: Eric Sandeen <sandeen@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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; -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html