Commit 71d521c6 authored by Theodore Ts'o's avatar Theodore Ts'o
Browse files

ChangeLog, pass1.c, pass1b.c:

  pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
  	pass1_check_directory): Add a safety check to make sure
  	ctx->stashed_inode is non-zero.
  pass1b.c (pass1b): Use e2fsck_use_inode_shortcuts() to disable the
  	inode shortcut processing, instead of manually clearing only half of
  	the function pointers that needed to be NULL'ed out.  This caused
  	nasty bugs if the last inode in the filesystem needed dup block
  	processing.
  pass1b.c (clone_file_block): When cloning a directory's metadata
  	block, don't try to update the directory block list database, since
  	indirect blocks aren't stored in the database and the resulting error
  	will abort the file clone operation.
parent 5e4f0709
2001-06-01 Theodore Tso <tytso@valinux.com>
* pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
pass1_check_directory): Add a safety check to make sure
ctx->stashed_inode is non-zero.
* pass1b.c (pass1b): Use e2fsck_use_inode_shortcuts() to disable
the inode shortcut processing, instead of manually
clearing only half of the function pointers that needed to
be NULL'ed out. This caused nasty bugs if the last inode
in the filesystem needed dup block processing.
* pass1b.c (clone_file_block): When cloning a directory's metadata
block, don't try to update the directory block list
database, since indirect blocks aren't stored in the
database and the resulting error will abort the file clone
operation.
2001-05-25 Theodore Tso <tytso@valinux.com>
* Release of E2fsprogs 1.20
......
......@@ -1522,7 +1522,7 @@ static errcode_t pass1_get_blocks(ext2_filsys fs, ext2_ino_t ino,
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
int i;
if (ino != ctx->stashed_ino)
if ((ino != ctx->stashed_ino) || !ctx->stashed_inode)
return EXT2_ET_CALLBACK_NOTHANDLED;
for (i=0; i < EXT2_N_BLOCKS; i++)
......@@ -1535,7 +1535,7 @@ static errcode_t pass1_read_inode(ext2_filsys fs, ext2_ino_t ino,
{
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino != ctx->stashed_ino)
if ((ino != ctx->stashed_ino) || !ctx->stashed_inode)
return EXT2_ET_CALLBACK_NOTHANDLED;
*inode = *ctx->stashed_inode;
return 0;
......@@ -1546,7 +1546,7 @@ static errcode_t pass1_write_inode(ext2_filsys fs, ext2_ino_t ino,
{
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino == ctx->stashed_ino)
if ((ino == ctx->stashed_ino) && ctx->stashed_inode)
*ctx->stashed_inode = *inode;
return EXT2_ET_CALLBACK_NOTHANDLED;
}
......@@ -1555,7 +1555,7 @@ static errcode_t pass1_check_directory(ext2_filsys fs, ext2_ino_t ino)
{
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino != ctx->stashed_ino)
if ((ino != ctx->stashed_ino) || !ctx->stashed_inode)
return EXT2_ET_CALLBACK_NOTHANDLED;
if (!LINUX_S_ISDIR(ctx->stashed_inode->i_mode))
......@@ -1580,5 +1580,3 @@ void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int bool)
fs->write_inode = 0;
}
}
......@@ -226,8 +226,7 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
}
}
ext2fs_close_inode_scan(scan);
fs->get_blocks = 0;
fs->check_directory = 0;
e2fsck_use_inode_shortcuts(ctx, 0);
}
static int process_pass1b_block(ext2_filsys fs,
......@@ -586,7 +585,7 @@ static int clone_file_block(ext2_filsys fs,
cs->errcode = retval;
return BLOCK_ABORT;
}
if (cs->dir) {
if (cs->dir && (blockcnt >= 0)) {
retval = ext2fs_set_dir_block(fs->dblist,
cs->dir, new_block, blockcnt);
if (retval) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment