Whamcloud - gitweb
Fix ext2fs_extent_get for uninit leaf extents
authorEric Sandeen <sandeen@redhat.com>
Wed, 19 Mar 2008 20:20:18 +0000 (15:20 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 20 Mar 2008 19:45:27 +0000 (15:45 -0400)
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>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/pass1.c
lib/ext2fs/extent.c

index 50e38e1..79e9f23 100644 (file)
@@ -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;
index dd7faa7..e7733c5 100644 (file)
@@ -461,10 +461,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) +