]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: use ext2fs_write_dir_block3() instead of ext2fs_write_dir_block()
authorKit Westneat <kwestneat@ddn.com>
Tue, 3 Dec 2013 00:11:52 +0000 (19:11 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2013 00:11:52 +0000 (19:11 -0500)
The use of ext2fs_write_dir_block() meant that attempts to fix
deleted/unused inodes in a directory would not be fixed for file
systems with 64-bit block numbers.  (And some random block with the
high 32-bits cleared would get corrupted.)

Fix a similar problem when expanding directories and when creating the
lost+found dirctory.

Signed-off-by: Kit Westneat <kwestneat@ddn.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
e2fsck/pass2.c
e2fsck/pass3.c

index bceadfe6c093204ea1e1d1c18ca5296c934ca97c..f2ac2ddffe5ee736f25c68acddcb86d2a44dfe5f 100644 (file)
@@ -1132,7 +1132,7 @@ out_htree:
                }
        }
        if (dir_modified) {
-               cd->pctx.errcode = ext2fs_write_dir_block(fs, block_nr, buf);
+               cd->pctx.errcode = ext2fs_write_dir_block3(fs, block_nr, buf, 0);
                if (cd->pctx.errcode) {
                        if (!fix_problem(ctx, PR_2_WRITE_DIRBLOCK,
                                         &cd->pctx))
@@ -1455,7 +1455,7 @@ static int allocate_dir_block(e2fsck_t ctx,
                return 1;
        }
 
-       pctx->errcode = ext2fs_write_dir_block(fs, blk, block);
+       pctx->errcode = ext2fs_write_dir_block3(fs, blk, block, 0);
        ext2fs_free_mem(&block);
        if (pctx->errcode) {
                pctx->str = "ext2fs_write_dir_block";
index e358bb20a13d48316c9c6a57dcc889faae4271ae..926f462f6c9a3f420d9bcc8509ff016c1f0b57e9 100644 (file)
@@ -198,9 +198,9 @@ static void check_root(e2fsck_t ctx)
                return;
        }
 
-       pctx.errcode = ext2fs_write_dir_block(fs, blk, block);
+       pctx.errcode = ext2fs_write_dir_block3(fs, blk, block, 0);
        if (pctx.errcode) {
-               pctx.str = "ext2fs_write_dir_block";
+               pctx.str = "ext2fs_write_dir_block3";
                fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
                ctx->flags |= E2F_FLAG_ABORT;
                return;
@@ -444,7 +444,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
                return 0;
        }
 
-       retval = ext2fs_write_dir_block(fs, blk, block);
+       retval = ext2fs_write_dir_block3(fs, blk, block, 0);
        ext2fs_free_mem(&block);
        if (retval) {
                pctx.errcode = retval;
@@ -725,7 +725,7 @@ static int expand_dir_proc(ext2_filsys fs,
                        return BLOCK_ABORT;
                }
                es->num--;
-               retval = ext2fs_write_dir_block(fs, new_blk, block);
+               retval = ext2fs_write_dir_block3(fs, new_blk, block, 0);
        } else {
                retval = ext2fs_get_mem(fs->blocksize, &block);
                if (retval) {