Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
/*
|
|
|
|
* e2fsck.c - superblock checks
|
|
|
|
*
|
|
|
|
* Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
|
|
|
|
*
|
|
|
|
* %Begin-Header%
|
|
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
|
|
* License.
|
|
|
|
* %End-Header%
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_ERRNO_H
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
|
1998-02-01 15:58:48 +03:00
|
|
|
#ifndef EXT2_SKIP_UUID
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
#include "uuid/uuid.h"
|
1998-02-01 15:58:48 +03:00
|
|
|
#endif
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
#include "e2fsck.h"
|
|
|
|
#include "problem.h"
|
|
|
|
|
|
|
|
#define MIN_CHECK 1
|
|
|
|
#define MAX_CHECK 2
|
|
|
|
|
|
|
|
static void check_super_value(e2fsck_t ctx, const char *descr,
|
|
|
|
unsigned long value, int flags,
|
1998-09-03 05:26:03 +04:00
|
|
|
unsigned long min_val, unsigned long max_val)
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
{
|
|
|
|
struct problem_context pctx;
|
|
|
|
|
1998-09-03 05:26:03 +04:00
|
|
|
if (((flags & MIN_CHECK) && (value < min_val)) ||
|
|
|
|
((flags & MAX_CHECK) && (value > max_val))) {
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
clear_problem_context(&pctx);
|
|
|
|
pctx.num = value;
|
|
|
|
pctx.str = descr;
|
|
|
|
fix_problem(ctx, PR_0_MISC_CORRUPT_SUPER, &pctx);
|
1997-11-03 22:42:40 +03:00
|
|
|
ctx->flags |= E2F_FLAG_ABORT; /* never get here! */
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-02-17 01:34:46 +03:00
|
|
|
/*
|
|
|
|
* This routine may get stubbed out in special compilations of the
|
|
|
|
* e2fsck code..
|
|
|
|
*/
|
|
|
|
#ifndef EXT2_SPECIAL_DEVICE_SIZE
|
|
|
|
errcode_t e2fsck_get_device_size(e2fsck_t ctx)
|
|
|
|
{
|
|
|
|
return (ext2fs_get_device_size(ctx->filesystem_name,
|
|
|
|
EXT2_BLOCK_SIZE(ctx->fs->super),
|
|
|
|
&ctx->num_blocks));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
/*
|
|
|
|
* helper function to release an inode
|
|
|
|
*/
|
|
|
|
struct process_block_struct {
|
2000-10-25 05:38:50 +04:00
|
|
|
e2fsck_t ctx;
|
|
|
|
char *buf;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
struct problem_context *pctx;
|
2000-10-25 05:38:50 +04:00
|
|
|
int truncating;
|
|
|
|
int truncate_offset;
|
2003-12-07 09:28:50 +03:00
|
|
|
e2_blkcnt_t truncate_block;
|
2000-10-25 05:38:50 +04:00
|
|
|
int truncated_blocks;
|
|
|
|
int abort;
|
|
|
|
errcode_t errcode;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static int release_inode_block(ext2_filsys fs,
|
|
|
|
blk_t *block_nr,
|
2003-12-07 09:28:50 +03:00
|
|
|
e2_blkcnt_t blockcnt,
|
|
|
|
blk_t ref_blk EXT2FS_ATTR((unused)),
|
|
|
|
int ref_offset EXT2FS_ATTR((unused)),
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
void *priv_data)
|
|
|
|
{
|
|
|
|
struct process_block_struct *pb;
|
2000-10-25 05:38:50 +04:00
|
|
|
e2fsck_t ctx;
|
|
|
|
struct problem_context *pctx;
|
|
|
|
blk_t blk = *block_nr;
|
|
|
|
int retval = 0;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
|
|
|
|
pb = (struct process_block_struct *) priv_data;
|
|
|
|
ctx = pb->ctx;
|
|
|
|
pctx = pb->pctx;
|
|
|
|
|
|
|
|
pctx->blk = blk;
|
|
|
|
pctx->blkcount = blockcnt;
|
|
|
|
|
|
|
|
if (HOLE_BLKADDR(blk))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ((blk < fs->super->s_first_data_block) ||
|
|
|
|
(blk >= fs->super->s_blocks_count)) {
|
|
|
|
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx);
|
2001-01-06 08:55:58 +03:00
|
|
|
return_abort:
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
pb->abort = 1;
|
|
|
|
return BLOCK_ABORT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ext2fs_test_block_bitmap(fs->block_map, blk)) {
|
|
|
|
fix_problem(ctx, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK, pctx);
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
2000-10-25 05:38:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we are deleting an orphan, then we leave the fields alone.
|
|
|
|
* If we are truncating an orphan, then update the inode fields
|
|
|
|
* and clean up any partial block data.
|
|
|
|
*/
|
|
|
|
if (pb->truncating) {
|
|
|
|
/*
|
|
|
|
* We only remove indirect blocks if they are
|
|
|
|
* completely empty.
|
|
|
|
*/
|
|
|
|
if (blockcnt < 0) {
|
|
|
|
int i, limit;
|
2001-01-06 08:55:58 +03:00
|
|
|
blk_t *bp;
|
2000-10-25 05:38:50 +04:00
|
|
|
|
|
|
|
pb->errcode = io_channel_read_blk(fs->io, blk, 1,
|
|
|
|
pb->buf);
|
|
|
|
if (pb->errcode)
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
2000-10-25 05:38:50 +04:00
|
|
|
|
|
|
|
limit = fs->blocksize >> 2;
|
2001-01-06 08:55:58 +03:00
|
|
|
for (i = 0, bp = (blk_t *) pb->buf;
|
|
|
|
i < limit; i++, bp++)
|
|
|
|
if (*bp)
|
2000-10-25 05:38:50 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* We don't remove direct blocks until we've reached
|
|
|
|
* the truncation block.
|
|
|
|
*/
|
|
|
|
if (blockcnt >= 0 && blockcnt < pb->truncate_block)
|
|
|
|
return 0;
|
|
|
|
/*
|
|
|
|
* If part of the last block needs truncating, we do
|
|
|
|
* it here.
|
|
|
|
*/
|
|
|
|
if ((blockcnt == pb->truncate_block) && pb->truncate_offset) {
|
|
|
|
pb->errcode = io_channel_read_blk(fs->io, blk, 1,
|
|
|
|
pb->buf);
|
|
|
|
if (pb->errcode)
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
2000-10-25 05:38:50 +04:00
|
|
|
memset(pb->buf + pb->truncate_offset, 0,
|
|
|
|
fs->blocksize - pb->truncate_offset);
|
|
|
|
pb->errcode = io_channel_write_blk(fs->io, blk, 1,
|
|
|
|
pb->buf);
|
|
|
|
if (pb->errcode)
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
2000-10-25 05:38:50 +04:00
|
|
|
}
|
|
|
|
pb->truncated_blocks++;
|
|
|
|
*block_nr = 0;
|
|
|
|
retval |= BLOCK_CHANGED;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
}
|
|
|
|
|
2002-08-17 18:19:44 +04:00
|
|
|
ext2fs_block_alloc_stats(fs, blk, -1);
|
2000-10-25 05:38:50 +04:00
|
|
|
return retval;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function releases an inode. Returns 1 if an inconsistency was
|
2000-10-25 05:38:50 +04:00
|
|
|
* found. If the inode has a link count, then it is being truncated and
|
|
|
|
* not deleted.
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
*/
|
Many files:
dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c,
message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c,
problem.h, scantest.c, super.c, swapfs.c: Change ino_t to ext2_ino_t.
2001-01-11 18:12:14 +03:00
|
|
|
static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino,
|
2001-01-13 00:05:57 +03:00
|
|
|
struct ext2_inode *inode, char *block_buf,
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
struct problem_context *pctx)
|
|
|
|
{
|
2002-08-17 18:19:44 +04:00
|
|
|
struct process_block_struct pb;
|
2000-10-25 05:38:50 +04:00
|
|
|
ext2_filsys fs = ctx->fs;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
errcode_t retval;
|
2002-08-17 18:19:44 +04:00
|
|
|
__u32 count;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
|
2001-06-23 04:35:38 +04:00
|
|
|
if (!ext2fs_inode_has_valid_blocks(inode))
|
|
|
|
return 0;
|
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
pb.buf = block_buf + 3 * ctx->fs->blocksize;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
pb.ctx = ctx;
|
|
|
|
pb.abort = 0;
|
2000-10-25 05:38:50 +04:00
|
|
|
pb.errcode = 0;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
pb.pctx = pctx;
|
2000-10-25 05:38:50 +04:00
|
|
|
if (inode->i_links_count) {
|
|
|
|
pb.truncating = 1;
|
2003-12-07 09:28:50 +03:00
|
|
|
pb.truncate_block = (e2_blkcnt_t)
|
2000-10-25 05:38:50 +04:00
|
|
|
((((long long)inode->i_size_high << 32) +
|
|
|
|
inode->i_size + fs->blocksize - 1) /
|
|
|
|
fs->blocksize);
|
|
|
|
pb.truncate_offset = inode->i_size % fs->blocksize;
|
|
|
|
} else {
|
|
|
|
pb.truncating = 0;
|
|
|
|
pb.truncate_block = 0;
|
|
|
|
pb.truncate_offset = 0;
|
|
|
|
}
|
|
|
|
pb.truncated_blocks = 0;
|
2003-12-07 09:28:50 +03:00
|
|
|
retval = ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_DEPTH_TRAVERSE,
|
2000-10-25 05:38:50 +04:00
|
|
|
block_buf, release_inode_block, &pb);
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
if (retval) {
|
2000-10-25 05:38:50 +04:00
|
|
|
com_err("release_inode_blocks", retval,
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
_("while calling ext2fs_block_iterate for inode %d"),
|
|
|
|
ino);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (pb.abort)
|
|
|
|
return 1;
|
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
/* Refresh the inode since ext2fs_block_iterate may have changed it */
|
|
|
|
e2fsck_read_inode(ctx, ino, inode, "release_inode_blocks");
|
|
|
|
|
|
|
|
if (pb.truncated_blocks)
|
|
|
|
inode->i_blocks -= pb.truncated_blocks *
|
|
|
|
(fs->blocksize / 512);
|
|
|
|
|
2002-08-17 18:19:44 +04:00
|
|
|
if (inode->i_file_acl) {
|
|
|
|
retval = ext2fs_adjust_ea_refcount(fs, inode->i_file_acl,
|
|
|
|
block_buf, -1, &count);
|
|
|
|
if (retval == EXT2_ET_BAD_EA_BLOCK_NUM) {
|
|
|
|
retval = 0;
|
|
|
|
count = 1;
|
|
|
|
}
|
|
|
|
if (retval) {
|
|
|
|
com_err("release_inode_blocks", retval,
|
|
|
|
_("while calling ext2fs_adjust_ea_refocunt for inode %d"),
|
|
|
|
ino);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (count == 0)
|
|
|
|
ext2fs_block_alloc_stats(fs, inode->i_file_acl, -1);
|
|
|
|
inode->i_file_acl = 0;
|
|
|
|
}
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function releases all of the orphan inodes. It returns 1 if
|
|
|
|
* it hit some error, and 0 on success.
|
|
|
|
*/
|
|
|
|
static int release_orphan_inodes(e2fsck_t ctx)
|
|
|
|
{
|
|
|
|
ext2_filsys fs = ctx->fs;
|
Many files:
dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c,
message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c,
problem.h, scantest.c, super.c, swapfs.c: Change ino_t to ext2_ino_t.
2001-01-11 18:12:14 +03:00
|
|
|
ext2_ino_t ino, next_ino;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
struct ext2_inode inode;
|
|
|
|
struct problem_context pctx;
|
|
|
|
char *block_buf;
|
|
|
|
|
|
|
|
if ((ino = fs->super->s_last_orphan) == 0)
|
|
|
|
return 0;
|
|
|
|
|
2000-08-18 19:31:37 +04:00
|
|
|
/*
|
|
|
|
* Win or lose, we won't be using the head of the orphan inode
|
|
|
|
* list again.
|
|
|
|
*/
|
|
|
|
fs->super->s_last_orphan = 0;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
2001-08-13 18:58:41 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the filesystem contains errors, don't run the orphan
|
|
|
|
* list, since the orphan list can't be trusted; and we're
|
|
|
|
* going to be running a full e2fsck run anyway...
|
|
|
|
*/
|
|
|
|
if (fs->super->s_state & EXT2_ERROR_FS)
|
|
|
|
return 0;
|
2000-08-18 19:31:37 +04:00
|
|
|
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
if ((ino < EXT2_FIRST_INODE(fs->super)) ||
|
|
|
|
(ino > fs->super->s_inodes_count)) {
|
|
|
|
clear_problem_context(&pctx);
|
2001-01-06 08:55:58 +03:00
|
|
|
pctx.ino = ino;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_HEAD_INODE, &pctx);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4,
|
2000-12-13 21:50:22 +03:00
|
|
|
"block iterate buffer");
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
e2fsck_read_bitmaps(ctx);
|
|
|
|
|
|
|
|
while (ino) {
|
2000-10-25 05:38:50 +04:00
|
|
|
e2fsck_read_inode(ctx, ino, &inode, "release_orphan_inodes");
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
clear_problem_context(&pctx);
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
pctx.ino = ino;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
pctx.inode = &inode;
|
2001-05-09 10:03:58 +04:00
|
|
|
pctx.str = inode.i_links_count ? _("Truncating") :
|
|
|
|
_("Clearing");
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
fix_problem(ctx, PR_0_ORPHAN_CLEAR_INODE, &pctx);
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
next_ino = inode.i_dtime;
|
|
|
|
if (next_ino &&
|
2000-08-23 01:41:52 +04:00
|
|
|
((next_ino < EXT2_FIRST_INODE(fs->super)) ||
|
|
|
|
(next_ino > fs->super->s_inodes_count))) {
|
|
|
|
pctx.ino = next_ino;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_INODE, &pctx);
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
}
|
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
if (release_inode_blocks(ctx, ino, &inode, block_buf, &pctx))
|
2001-01-06 08:55:58 +03:00
|
|
|
goto return_abort;
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
|
2000-10-25 05:38:50 +04:00
|
|
|
if (!inode.i_links_count) {
|
2002-08-17 18:19:44 +04:00
|
|
|
ext2fs_inode_alloc_stats2(fs, ino, -1,
|
|
|
|
LINUX_S_ISDIR(inode.i_mode));
|
2000-10-25 05:38:50 +04:00
|
|
|
inode.i_dtime = time(0);
|
2002-08-14 14:00:44 +04:00
|
|
|
} else {
|
|
|
|
inode.i_dtime = 0;
|
2000-10-25 05:38:50 +04:00
|
|
|
}
|
|
|
|
e2fsck_write_inode(ctx, ino, &inode, "delete_file");
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
ino = next_ino;
|
|
|
|
}
|
2003-08-01 17:41:07 +04:00
|
|
|
ext2fs_free_mem(&block_buf);
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
return 0;
|
2001-01-06 08:55:58 +03:00
|
|
|
return_abort:
|
2003-08-01 17:41:07 +04:00
|
|
|
ext2fs_free_mem(&block_buf);
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-12-24 09:42:22 +03:00
|
|
|
/*
|
|
|
|
* Check the resize inode to make sure it is sane. We check both for
|
|
|
|
* the case where on-line resizing is not enabled (in which case the
|
|
|
|
* resize inode should be cleared) as well as the case where on-line
|
|
|
|
* resizing is enabled.
|
|
|
|
*/
|
|
|
|
void check_resize_inode(e2fsck_t ctx)
|
|
|
|
{
|
|
|
|
ext2_filsys fs = ctx->fs;
|
|
|
|
struct ext2_inode inode;
|
|
|
|
struct problem_context pctx;
|
|
|
|
int i, j, gdt_off, ind_off;
|
|
|
|
blk_t blk, pblk, expect;
|
|
|
|
__u32 *dind_buf = 0, *ind_buf;
|
|
|
|
errcode_t retval;
|
|
|
|
|
|
|
|
clear_problem_context(&pctx);
|
|
|
|
pctx.ino = EXT2_RESIZE_INO;
|
|
|
|
retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
|
|
|
|
if (retval) {
|
|
|
|
ctx->flags |= E2F_FLAG_RESIZE_INODE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the resize inode feature isn't set, then
|
|
|
|
* s_reserved_gdt_blocks must be zero, and the resize inode
|
|
|
|
* must be cleared.
|
|
|
|
*/
|
|
|
|
if (!(fs->super->s_feature_compat &
|
|
|
|
EXT2_FEATURE_COMPAT_RESIZE_INODE)) {
|
|
|
|
if (fs->super->s_reserved_gdt_blocks) {
|
|
|
|
pctx.num = fs->super->s_reserved_gdt_blocks;
|
|
|
|
if (fix_problem(ctx, PR_0_NONZERO_RESERVED_GDT_BLOCKS,
|
|
|
|
&pctx)) {
|
|
|
|
fs->super->s_reserved_gdt_blocks = 0;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i=0; i < EXT2_N_BLOCKS; i++) {
|
|
|
|
if (inode.i_block[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((i < EXT2_N_BLOCKS) &&
|
|
|
|
fix_problem(ctx, PR_0_CLEAR_RESIZE_INODE, &pctx)) {
|
|
|
|
memset(&inode, 0, sizeof(inode));
|
|
|
|
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, &inode,
|
|
|
|
"clear_resize");
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* The resize inode feature is enabled; check to make sure the
|
|
|
|
* only block in use is the double indirect block
|
|
|
|
*/
|
|
|
|
blk = inode.i_block[EXT2_DIND_BLOCK];
|
|
|
|
for (i=0; i < EXT2_N_BLOCKS; i++) {
|
|
|
|
if (i != EXT2_DIND_BLOCK && inode.i_block[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((i < EXT2_N_BLOCKS) || !blk ||
|
|
|
|
(blk < fs->super->s_first_data_block ||
|
|
|
|
blk >= fs->super->s_blocks_count)) {
|
|
|
|
resize_inode_invalid:
|
|
|
|
if (fix_problem(ctx, PR_0_RESIZE_INODE_INVALID, &pctx)) {
|
|
|
|
memset(&inode, 0, sizeof(inode));
|
|
|
|
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, &inode,
|
|
|
|
"clear_resize");
|
|
|
|
ctx->flags |= E2F_FLAG_RESIZE_INODE;
|
|
|
|
}
|
|
|
|
if (!(ctx->options & E2F_OPT_READONLY)) {
|
|
|
|
fs->super->s_state &= ~EXT2_VALID_FS;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
dind_buf = (__u32 *) e2fsck_allocate_memory(ctx, fs->blocksize * 2,
|
|
|
|
"resize dind buffer");
|
|
|
|
ind_buf = (__u32 *) ((char *) dind_buf + fs->blocksize);
|
|
|
|
|
|
|
|
retval = io_channel_read_blk(fs->io, blk, 1, dind_buf);
|
|
|
|
if (retval)
|
|
|
|
goto resize_inode_invalid;
|
|
|
|
|
|
|
|
gdt_off = fs->desc_blocks;
|
|
|
|
pblk = fs->super->s_first_data_block + 1 + fs->desc_blocks;
|
|
|
|
for (i = 0; i < fs->super->s_reserved_gdt_blocks / 4;
|
|
|
|
i++, gdt_off++, pblk++) {
|
|
|
|
gdt_off %= fs->blocksize/4;
|
|
|
|
if (dind_buf[gdt_off] != pblk)
|
|
|
|
goto resize_inode_invalid;
|
|
|
|
retval = io_channel_read_blk(fs->io, pblk, 1, ind_buf);
|
|
|
|
if (retval)
|
|
|
|
goto resize_inode_invalid;
|
|
|
|
ind_off = 0;
|
|
|
|
for (j = 1; j < fs->group_desc_count; j++) {
|
|
|
|
if (!ext2fs_bg_has_super(fs, j))
|
|
|
|
continue;
|
|
|
|
expect = pblk + (j * fs->super->s_blocks_per_group);
|
|
|
|
if (ind_buf[ind_off] != expect)
|
|
|
|
goto resize_inode_invalid;
|
|
|
|
ind_off++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
if (dind_buf)
|
|
|
|
ext2fs_free_mem(&dind_buf);
|
|
|
|
|
|
|
|
}
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
void check_super_block(e2fsck_t ctx)
|
|
|
|
{
|
|
|
|
ext2_filsys fs = ctx->fs;
|
|
|
|
blk_t first_block, last_block;
|
2001-01-01 18:51:50 +03:00
|
|
|
struct ext2_super_block *sb = fs->super;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
blk_t blocks_per_group = fs->super->s_blocks_per_group;
|
2002-06-10 21:05:56 +04:00
|
|
|
blk_t bpg_max;
|
1999-10-20 22:29:18 +04:00
|
|
|
int inodes_per_block;
|
2002-06-10 21:05:56 +04:00
|
|
|
int ipg_max;
|
1998-09-03 05:26:03 +04:00
|
|
|
dgrp_t i;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
blk_t should_be;
|
|
|
|
struct problem_context pctx;
|
2003-04-06 07:50:44 +04:00
|
|
|
__u32 free_blocks = 0, free_inodes = 0;
|
2002-06-10 21:05:56 +04:00
|
|
|
|
|
|
|
inodes_per_block = EXT2_INODES_PER_BLOCK(fs->super);
|
|
|
|
ipg_max = inodes_per_block * (blocks_per_group - 4);
|
|
|
|
if (ipg_max > EXT2_MAX_INODES_PER_GROUP(sb))
|
|
|
|
ipg_max = EXT2_MAX_INODES_PER_GROUP(sb);
|
|
|
|
bpg_max = 8 * EXT2_BLOCK_SIZE(sb);
|
|
|
|
if (bpg_max > EXT2_MAX_BLOCKS_PER_GROUP(sb))
|
|
|
|
bpg_max = EXT2_MAX_BLOCKS_PER_GROUP(sb);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
|
Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
the ext2-specific header files are in a flat directory.
dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
super.c, swapfs.c, unix.c: Explicitly cast all assignments
from void * to be compatible with C++.
unix.c (sync_disk): Remove sync_disk and calls to that function,
since ext2fs_close() now takes care of this.
pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
ehandler.c, unix.c: Change use of private to be priv_data, to
avoid C++ reserved name clash.
1998-01-19 17:50:49 +03:00
|
|
|
ctx->invalid_inode_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
sizeof(int) * fs->group_desc_count, "invalid_inode_bitmap");
|
Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
the ext2-specific header files are in a flat directory.
dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
super.c, swapfs.c, unix.c: Explicitly cast all assignments
from void * to be compatible with C++.
unix.c (sync_disk): Remove sync_disk and calls to that function,
since ext2fs_close() now takes care of this.
pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
ehandler.c, unix.c: Change use of private to be priv_data, to
avoid C++ reserved name clash.
1998-01-19 17:50:49 +03:00
|
|
|
ctx->invalid_block_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
sizeof(int) * fs->group_desc_count, "invalid_block_bitmap");
|
Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
the ext2-specific header files are in a flat directory.
dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
super.c, swapfs.c, unix.c: Explicitly cast all assignments
from void * to be compatible with C++.
unix.c (sync_disk): Remove sync_disk and calls to that function,
since ext2fs_close() now takes care of this.
pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
ehandler.c, unix.c: Change use of private to be priv_data, to
avoid C++ reserved name clash.
1998-01-19 17:50:49 +03:00
|
|
|
ctx->invalid_inode_table_flag = (int *) e2fsck_allocate_memory(ctx,
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
sizeof(int) * fs->group_desc_count, "invalid_inode_table");
|
2002-06-10 21:05:56 +04:00
|
|
|
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
clear_problem_context(&pctx);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Verify the super block constants...
|
|
|
|
*/
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "inodes_count", sb->s_inodes_count,
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
MIN_CHECK, 1, 0);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "blocks_count", sb->s_blocks_count,
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
MIN_CHECK, 1, 0);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "first_data_block", sb->s_first_data_block,
|
|
|
|
MAX_CHECK, 0, sb->s_blocks_count);
|
|
|
|
check_super_value(ctx, "log_block_size", sb->s_log_block_size,
|
2002-05-17 18:53:07 +04:00
|
|
|
MIN_CHECK | MAX_CHECK, 0,
|
|
|
|
EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE);
|
2002-05-16 13:20:07 +04:00
|
|
|
check_super_value(ctx, "log_frag_size", sb->s_log_frag_size,
|
|
|
|
MIN_CHECK | MAX_CHECK, 0, sb->s_log_block_size);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "frags_per_group", sb->s_frags_per_group,
|
2001-04-17 04:40:02 +04:00
|
|
|
MIN_CHECK | MAX_CHECK, sb->s_blocks_per_group,
|
2002-06-10 21:05:56 +04:00
|
|
|
bpg_max);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "blocks_per_group", sb->s_blocks_per_group,
|
2002-06-10 21:05:56 +04:00
|
|
|
MIN_CHECK | MAX_CHECK, 8, bpg_max);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "inodes_per_group", sb->s_inodes_per_group,
|
2002-06-10 21:05:56 +04:00
|
|
|
MIN_CHECK | MAX_CHECK, inodes_per_block, ipg_max);
|
2001-01-01 18:51:50 +03:00
|
|
|
check_super_value(ctx, "r_blocks_count", sb->s_r_blocks_count,
|
ChangeLog, e2fsck.h, journal.c, problem.c, problem.h, super.c:
super.c (check_super_block): Be more strict on checking
s_r_blocks_count superblock field.
problem.c, problem.h (PR_0_JOURNAL_UNSUPP_ROCOMPAT,
PR_0_JOURNAL_UNSUPP_INCOMPAT, PR_0_JOURNAL_RESET_COMPAT): New problem
codes.
journal.c (e2fsck_journal_load): Use a problem code to report
unsupported feature flags. There is code to clear unsupported flags,
but since this is dangerous, it's not allowed in the problem code
table.
journal.c (e2fsck_journal_reset_super): initialize the journal
sequence number to a random value to avoid recovering bad transactions
from a corrupt journal.
2001-05-14 08:06:56 +04:00
|
|
|
MAX_CHECK, 0, sb->s_blocks_count / 4);
|
2004-12-24 09:42:22 +03:00
|
|
|
check_super_value(ctx, "reserved_gdt_blocks",
|
|
|
|
sb->s_reserved_gdt_blocks, MAX_CHECK, 0,
|
|
|
|
fs->blocksize/4);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
if (!ctx->num_blocks) {
|
1998-02-17 01:34:46 +03:00
|
|
|
pctx.errcode = e2fsck_get_device_size(ctx);
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
if (pctx.errcode && pctx.errcode != EXT2_ET_UNIMPLEMENTED) {
|
|
|
|
fix_problem(ctx, PR_0_GETSIZE_ERROR, &pctx);
|
1997-11-03 22:42:40 +03:00
|
|
|
ctx->flags |= E2F_FLAG_ABORT;
|
|
|
|
return;
|
|
|
|
}
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
if ((pctx.errcode != EXT2_ET_UNIMPLEMENTED) &&
|
2001-01-01 18:51:50 +03:00
|
|
|
(ctx->num_blocks < sb->s_blocks_count)) {
|
|
|
|
pctx.blk = sb->s_blocks_count;
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
pctx.blk2 = ctx->num_blocks;
|
|
|
|
if (fix_problem(ctx, PR_0_FS_SIZE_WRONG, &pctx)) {
|
|
|
|
ctx->flags |= E2F_FLAG_ABORT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 09:28:50 +03:00
|
|
|
if (sb->s_log_block_size != (__u32) sb->s_log_frag_size) {
|
2001-01-01 18:51:50 +03:00
|
|
|
pctx.blk = EXT2_BLOCK_SIZE(sb);
|
|
|
|
pctx.blk2 = EXT2_FRAG_SIZE(sb);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
fix_problem(ctx, PR_0_NO_FRAGMENTS, &pctx);
|
1997-11-03 22:42:40 +03:00
|
|
|
ctx->flags |= E2F_FLAG_ABORT;
|
|
|
|
return;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
|
2001-01-01 18:51:50 +03:00
|
|
|
should_be = sb->s_frags_per_group >>
|
|
|
|
(sb->s_log_block_size - sb->s_log_frag_size);
|
|
|
|
if (sb->s_blocks_per_group != should_be) {
|
|
|
|
pctx.blk = sb->s_blocks_per_group;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
pctx.blk2 = should_be;
|
|
|
|
fix_problem(ctx, PR_0_BLOCKS_PER_GROUP, &pctx);
|
1997-11-03 22:42:40 +03:00
|
|
|
ctx->flags |= E2F_FLAG_ABORT;
|
|
|
|
return;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
|
2001-01-01 18:51:50 +03:00
|
|
|
should_be = (sb->s_log_block_size == 0) ? 1 : 0;
|
|
|
|
if (sb->s_first_data_block != should_be) {
|
|
|
|
pctx.blk = sb->s_first_data_block;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
pctx.blk2 = should_be;
|
|
|
|
fix_problem(ctx, PR_0_FIRST_DATA_BLOCK, &pctx);
|
1997-11-03 22:42:40 +03:00
|
|
|
ctx->flags |= E2F_FLAG_ABORT;
|
|
|
|
return;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
|
2001-01-01 18:51:50 +03:00
|
|
|
should_be = sb->s_inodes_per_group * fs->group_desc_count;
|
|
|
|
if (sb->s_inodes_count != should_be) {
|
|
|
|
pctx.ino = sb->s_inodes_count;
|
1999-06-18 05:09:29 +04:00
|
|
|
pctx.ino2 = should_be;
|
|
|
|
if (fix_problem(ctx, PR_0_INODE_COUNT_WRONG, &pctx)) {
|
2001-01-01 18:51:50 +03:00
|
|
|
sb->s_inodes_count = should_be;
|
1999-06-18 05:09:29 +04:00
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
/*
|
|
|
|
* Verify the group descriptors....
|
|
|
|
*/
|
|
|
|
first_block = fs->super->s_first_data_block;
|
|
|
|
last_block = first_block + blocks_per_group;
|
|
|
|
|
|
|
|
for (i = 0; i < fs->group_desc_count; i++) {
|
|
|
|
pctx.group = i;
|
|
|
|
|
|
|
|
if (i == fs->group_desc_count - 1)
|
|
|
|
last_block = fs->super->s_blocks_count;
|
|
|
|
if ((fs->group_desc[i].bg_block_bitmap < first_block) ||
|
|
|
|
(fs->group_desc[i].bg_block_bitmap >= last_block)) {
|
|
|
|
pctx.blk = fs->group_desc[i].bg_block_bitmap;
|
2001-11-26 23:51:14 +03:00
|
|
|
if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx))
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
fs->group_desc[i].bg_block_bitmap = 0;
|
2001-11-26 23:51:14 +03:00
|
|
|
}
|
|
|
|
if (fs->group_desc[i].bg_block_bitmap == 0) {
|
|
|
|
ctx->invalid_block_bitmap_flag[i]++;
|
|
|
|
ctx->invalid_bitmaps++;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
if ((fs->group_desc[i].bg_inode_bitmap < first_block) ||
|
|
|
|
(fs->group_desc[i].bg_inode_bitmap >= last_block)) {
|
|
|
|
pctx.blk = fs->group_desc[i].bg_inode_bitmap;
|
2001-11-26 23:51:14 +03:00
|
|
|
if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx))
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
fs->group_desc[i].bg_inode_bitmap = 0;
|
2001-11-26 23:51:14 +03:00
|
|
|
}
|
|
|
|
if (fs->group_desc[i].bg_inode_bitmap == 0) {
|
|
|
|
ctx->invalid_inode_bitmap_flag[i]++;
|
|
|
|
ctx->invalid_bitmaps++;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
if ((fs->group_desc[i].bg_inode_table < first_block) ||
|
|
|
|
((fs->group_desc[i].bg_inode_table +
|
|
|
|
fs->inode_blocks_per_group - 1) >= last_block)) {
|
|
|
|
pctx.blk = fs->group_desc[i].bg_inode_table;
|
2001-11-26 23:51:14 +03:00
|
|
|
if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx))
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
fs->group_desc[i].bg_inode_table = 0;
|
2001-11-26 23:51:14 +03:00
|
|
|
}
|
|
|
|
if (fs->group_desc[i].bg_inode_table == 0) {
|
|
|
|
ctx->invalid_inode_table_flag[i]++;
|
|
|
|
ctx->invalid_bitmaps++;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
2003-04-06 07:50:44 +04:00
|
|
|
free_blocks += fs->group_desc[i].bg_free_blocks_count;
|
|
|
|
free_inodes += fs->group_desc[i].bg_free_inodes_count;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
first_block += fs->super->s_blocks_per_group;
|
|
|
|
last_block += fs->super->s_blocks_per_group;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If we have invalid bitmaps, set the error state of the
|
|
|
|
* filesystem.
|
|
|
|
*/
|
|
|
|
if (ctx->invalid_bitmaps && !(ctx->options & E2F_OPT_READONLY)) {
|
|
|
|
fs->super->s_state &= ~EXT2_VALID_FS;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
|
|
|
|
ChangeLog, problem.c, problem.h, super.c:
problem.c, problem.h (PR_0_HURD_CLEAR_FILETYPE): Add new problem code.
super.c (check_super_block): If the OS type in the superblock is the
Hurd, check to see if the filetype feature is set, and offer to clear
it if so. This needs to be done since the Hurd doesn't properly
support the filetype feature. (And since the hurd allows the
transmogrification of files to special files and vice versa --- for no
good reason that I can understand --- it can't support the filetype
feature for the forseeable future, either.)
ChangeLog, mke2fs.c:
mke2fs.c (main): We forcibly turn off the filetype feature if the OS
is the hurd, since the hurd doesn't support it. (And since the hurd
allows the transmogrification of files to special files and vice versa
--- for no good reason that I can understand --- it can't support the
filetype feature for the forseeable future, either.)
mke2fs.c (proceed_question): Fix reversed sense of proceed_question
that was busted due to the internationalization patch. Fixed bug
where if proceed_question was called twice, the input buffer wasn't
cleared of the previous question's newline.
ChangeLog, expect.1, expect.2, image.gz, name:
f_hurd: Add test for Hurd-specific features (right now, just checks to
make sure the filetype feature is cleared)
ChangeLog, ls.c:
ls.c (list_super): Change the string displayed for the Hurd to be
GNU/Hurd, instead of just "GNU".
2000-05-08 17:33:17 +04:00
|
|
|
clear_problem_context(&pctx);
|
|
|
|
|
1998-02-01 15:58:48 +03:00
|
|
|
#ifndef EXT2_SKIP_UUID
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
/*
|
|
|
|
* If the UUID field isn't assigned, assign it.
|
|
|
|
*/
|
2001-01-01 18:51:50 +03:00
|
|
|
if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) {
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) {
|
2001-01-01 18:51:50 +03:00
|
|
|
uuid_generate(sb->s_uuid);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
ext2fs_mark_super_dirty(fs);
|
2002-11-08 19:10:28 +03:00
|
|
|
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
}
|
|
|
|
}
|
1998-02-01 15:58:48 +03:00
|
|
|
#endif
|
2003-04-06 07:50:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the global counts from the block group counts. This
|
|
|
|
* is needed for an experimental patch which eliminates
|
|
|
|
* locking the entire filesystem when allocating blocks or
|
|
|
|
* inodes; if the filesystem is not unmounted cleanly, the
|
|
|
|
* global counts may not be accurate.
|
|
|
|
*/
|
|
|
|
if (!(ctx->options & E2F_OPT_READONLY) &&
|
|
|
|
((free_blocks != fs->super->s_free_blocks_count) ||
|
|
|
|
(free_inodes != fs->super->s_free_inodes_count))) {
|
|
|
|
fs->super->s_free_blocks_count = free_blocks;
|
|
|
|
fs->super->s_free_inodes_count = free_inodes;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
ChangeLog, problem.c, problem.h, super.c:
problem.c, problem.h (PR_0_HURD_CLEAR_FILETYPE): Add new problem code.
super.c (check_super_block): If the OS type in the superblock is the
Hurd, check to see if the filetype feature is set, and offer to clear
it if so. This needs to be done since the Hurd doesn't properly
support the filetype feature. (And since the hurd allows the
transmogrification of files to special files and vice versa --- for no
good reason that I can understand --- it can't support the filetype
feature for the forseeable future, either.)
ChangeLog, mke2fs.c:
mke2fs.c (main): We forcibly turn off the filetype feature if the OS
is the hurd, since the hurd doesn't support it. (And since the hurd
allows the transmogrification of files to special files and vice versa
--- for no good reason that I can understand --- it can't support the
filetype feature for the forseeable future, either.)
mke2fs.c (proceed_question): Fix reversed sense of proceed_question
that was busted due to the internationalization patch. Fixed bug
where if proceed_question was called twice, the input buffer wasn't
cleared of the previous question's newline.
ChangeLog, expect.1, expect.2, image.gz, name:
f_hurd: Add test for Hurd-specific features (right now, just checks to
make sure the filetype feature is cleared)
ChangeLog, ls.c:
ls.c (list_super): Change the string displayed for the Hurd to be
GNU/Hurd, instead of just "GNU".
2000-05-08 17:33:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For the Hurd, check to see if the filetype option is set,
|
|
|
|
* since it doesn't support it.
|
|
|
|
*/
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
if (!(ctx->options & E2F_OPT_READONLY) &&
|
|
|
|
fs->super->s_creator_os == EXT2_OS_HURD &&
|
ChangeLog, problem.c, problem.h, super.c:
problem.c, problem.h (PR_0_HURD_CLEAR_FILETYPE): Add new problem code.
super.c (check_super_block): If the OS type in the superblock is the
Hurd, check to see if the filetype feature is set, and offer to clear
it if so. This needs to be done since the Hurd doesn't properly
support the filetype feature. (And since the hurd allows the
transmogrification of files to special files and vice versa --- for no
good reason that I can understand --- it can't support the filetype
feature for the forseeable future, either.)
ChangeLog, mke2fs.c:
mke2fs.c (main): We forcibly turn off the filetype feature if the OS
is the hurd, since the hurd doesn't support it. (And since the hurd
allows the transmogrification of files to special files and vice versa
--- for no good reason that I can understand --- it can't support the
filetype feature for the forseeable future, either.)
mke2fs.c (proceed_question): Fix reversed sense of proceed_question
that was busted due to the internationalization patch. Fixed bug
where if proceed_question was called twice, the input buffer wasn't
cleared of the previous question's newline.
ChangeLog, expect.1, expect.2, image.gz, name:
f_hurd: Add test for Hurd-specific features (right now, just checks to
make sure the filetype feature is cleared)
ChangeLog, ls.c:
ls.c (list_super): Change the string displayed for the Hurd to be
GNU/Hurd, instead of just "GNU".
2000-05-08 17:33:17 +04:00
|
|
|
(fs->super->s_feature_incompat &
|
|
|
|
EXT2_FEATURE_INCOMPAT_FILETYPE)) {
|
|
|
|
if (fix_problem(ctx, PR_0_HURD_CLEAR_FILETYPE, &pctx)) {
|
|
|
|
fs->super->s_feature_incompat &=
|
|
|
|
~EXT2_FEATURE_INCOMPAT_FILETYPE;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
|
2000-12-13 21:11:44 +03:00
|
|
|
/*
|
|
|
|
* If we have any of the compatibility flags set, we need to have a
|
|
|
|
* revision 1 filesystem. Most kernels will not check the flags on
|
|
|
|
* a rev 0 filesystem and we may have corruption issues because of
|
|
|
|
* the incompatible changes to the filesystem.
|
|
|
|
*/
|
|
|
|
if (!(ctx->options & E2F_OPT_READONLY) &&
|
|
|
|
fs->super->s_rev_level == EXT2_GOOD_OLD_REV &&
|
|
|
|
(fs->super->s_feature_compat ||
|
|
|
|
fs->super->s_feature_ro_compat ||
|
|
|
|
fs->super->s_feature_incompat) &&
|
|
|
|
fix_problem(ctx, PR_0_FS_REV_LEVEL, &pctx)) {
|
2000-12-13 21:36:23 +03:00
|
|
|
ext2fs_update_dynamic_rev(fs);
|
2000-12-13 21:11:44 +03:00
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
}
|
|
|
|
|
2004-12-24 09:42:22 +03:00
|
|
|
check_resize_inode(ctx);
|
2004-12-17 04:13:45 +03:00
|
|
|
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
/*
|
|
|
|
* Clean up any orphan inodes, if present.
|
|
|
|
*/
|
|
|
|
if (!(ctx->options & E2F_OPT_READONLY) && release_orphan_inodes(ctx)) {
|
|
|
|
fs->super->s_state &= ~EXT2_VALID_FS;
|
2000-12-13 21:11:44 +03:00
|
|
|
ext2fs_mark_super_dirty(fs);
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
}
|
|
|
|
|
2001-10-07 05:26:27 +04:00
|
|
|
/*
|
|
|
|
* Move the ext3 journal file, if necessary.
|
|
|
|
*/
|
|
|
|
e2fsck_move_ext3_journal(ctx);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
return;
|
|
|
|
}
|