[Ocfs2-tools-devel] [PATCH 11/11] Ocfs2-tools: Fix bug for EXTENT_EB_INVALID corruptor.
Joel Becker
Joel.Becker at oracle.com
Mon Jun 8 14:46:39 PDT 2009
On Mon, Jun 08, 2009 at 06:50:25PM +0800, Tristan Ye wrote:
> The fswreck EXTENT_EB_INVALID corrupter actually does EB_GEN.
> But the wrong fsck choice can make this not exercise the EXTENT_EB_INVALID.
> The corrupter for EXTENT_EB_INVALID should instead have an extent
> record pointing to an unused block, perhaps block 0.
Not quite right. You don't want to set the eb's record to 0 -
that may be an extent, not an extent block.
> @@ -171,11 +171,19 @@ static void damage_extent_block(ocfs2_filesys *fs, uint64_t blkno,
> fprintf(stdout, "EB_GEN: ");
> else if (type == EB_GEN_FIX)
> fprintf(stdout, "EB_GEN_FIX: ");
> - else
> + else {
> + oldno = eb->h_list->l_recs[0].e_blkno;
> + eb->h_list->l_recs[0].e_blkno = 0;
> fprintf(stdout, "EXTENT_EB_INVALID: ");
Actually, you're leaving the generation chage here too. Don't do
that. Separate out EB_INVALID completely from EB_GEN_*. Leave the two
EB_GEN_* cases as-is.
For EB_INVALID, actually set the inode's pointer to this extent
block bad. Let's set it to the inode itself, so that it's clearly an
invalid extent block.
case EXTENT_EB_INVALID:
el->l_recs[0].e_blkno = di->i_blkno;
fprintf(stdout, "Corrupt ino#%"PRIu64" such that "
"it points to an inode (itself) where it "
"should be pointing to the extent block at "
"%"PRIu64"\n",
blkno, eb->eb_blkno);
Joel
--
Life's Little Instruction Book #30
"Never buy a house without a fireplace."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list