Whamcloud - gitweb
Merge branch 'maint' into next
[tools/e2fsprogs.git] / e2fsck / pass2.c
index 85ce982..81a0f4b 100644 (file)
@@ -351,9 +351,9 @@ static int check_dot(e2fsck_t ctx,
 {
        struct ext2_dir_entry *nextdir;
        unsigned int    rec_len, new_len;
-       int     status = 0;
-       int     created = 0;
-       int     problem = 0;
+       int             status = 0;
+       int             created = 0;
+       problem_t       problem = 0;
 
        if (!dirent->inode)
                problem = PR_2_MISSING_DOT;
@@ -413,7 +413,7 @@ static int check_dotdot(e2fsck_t ctx,
                        struct ext2_dir_entry *dirent,
                        ext2_ino_t ino, struct problem_context *pctx)
 {
-       int             problem = 0;
+       problem_t       problem = 0;
        unsigned int    rec_len;
 
        if (!dirent->inode)
@@ -751,7 +751,7 @@ static int check_dir_block(ext2_filsys fs,
        struct check_dir_struct *cd;
        char                    *buf;
        e2fsck_t                ctx;
-       int                     problem;
+       problem_t               problem;
        struct ext2_dx_root_info *root;
        struct ext2_dx_countlimit *limit;
        static dict_t de_dict;
@@ -918,7 +918,7 @@ skip_checksum:
        dict_init(&de_dict, DICTCOUNT_T_MAX, dict_de_cmp);
        prev = 0;
        do {
-               int group;
+               dgrp_t group;
                ext2_ino_t first_unused_inode;
                unsigned int name_len;
 
@@ -1282,7 +1282,6 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
        struct del_block        del_block;
 
        e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
-       e2fsck_clear_inode(ctx, ino, &inode, 0, "deallocate_inode");
        clear_problem_context(&pctx);
        pctx.ino = ino;
 
@@ -1317,7 +1316,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
        }
 
        if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
-               return;
+               goto clear_inode;
 
        if (LINUX_S_ISREG(inode.i_mode) && EXT2_I_SIZE(&inode) >= 0x80000000UL)
                ctx->large_files--;
@@ -1332,6 +1331,10 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
                ctx->flags |= E2F_FLAG_ABORT;
                return;
        }
+clear_inode:
+       /* Inode may have changed by block_iterate, so reread it */
+       e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
+       e2fsck_clear_inode(ctx, ino, &inode, 0, "deallocate_inode");
 }
 
 /*
@@ -1358,7 +1361,7 @@ extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
        int                     not_fixed = 0;
        unsigned char           *frag, *fsize;
        struct problem_context  pctx;
-       int     problem = 0;
+       problem_t               problem = 0;
 
        e2fsck_read_inode(ctx, ino, &inode, "process_bad_inode");