Merge branch 'maint' into next

crypto
Theodore Ts'o 2014-08-15 19:01:24 -04:00
commit aef977196a
11 changed files with 107 additions and 46 deletions

View File

@ -1734,9 +1734,11 @@ no_journal:
}
e2fsck_write_bitmaps(ctx);
pctx.errcode = ext2fs_flush(ctx->fs);
if (pctx.errcode)
fix_problem(ctx, PR_6_FLUSH_FILESYSTEM, &pctx);
if (fs->flags & EXT2_FLAG_DIRTY) {
pctx.errcode = ext2fs_flush(ctx->fs);
if (pctx.errcode)
fix_problem(ctx, PR_6_FLUSH_FILESYSTEM, &pctx);
}
pctx.errcode = io_channel_flush(ctx->fs->io);
if (pctx.errcode)
fix_problem(ctx, PR_6_IO_FLUSH, &pctx);

View File

@ -329,16 +329,17 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
print_extent_info(&fm_ext, *num_extents - 1,
(last_block + 1) * st->st_blksize,
blk_shift, st);
fm_ext.fe_logical = logical;
fm_ext.fe_physical = block * st->st_blksize;
fm_ext.fe_length = 0;
(*num_extents)++;
} else if (last_block && (block != last_block + 1)) {
if (verbose)
printf("Discontinuity: Block %ld is at %lu (was "
"%lu)\n", i, block, last_block + 1);
fm_ext.fe_length = 0;
(*num_extents)++;
}
fm_ext.fe_logical = logical;
fm_ext.fe_physical = block * st->st_blksize;
fm_ext.fe_length += st->st_blksize;
last_block = block;
}

View File

@ -0,0 +1,11 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (4294968254, counted=958).
Fix? no
test_filesys: 11/256 files (9.1% non-contiguous), 18446744069414585410/2048 blocks
Exit status is 0
crc did not change. 2466215161

Binary file not shown.

View File

@ -0,0 +1 @@
ensure that a readonly check doesn't modify the fs

View File

@ -0,0 +1,46 @@
FSCK_OPT=-fn
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
gzip -d < $test_dir/image.gz > $TMPFILE
old="$($CRCSUM < $TMPFILE)"
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
new="$($CRCSUM < $TMPFILE)"
if [ "${old}" != "${new}" ]; then
echo "ERROR: crc mismatch! ${old} ${new}" >> $OUT
else
echo "crc did not change. ${old}" >> $OUT
fi
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP old new

View File

@ -0,0 +1,15 @@
i_e2image/image1024.orig
2161078647 image1024.orig
467277198 _image.raw
2164212449 _image.qcow2
467277198 _image.qcow2.raw
i_e2image/image2048.orig
672740642 image2048.orig
3688408350 _image.raw
3821412753 _image.qcow2
3688408350 _image.qcow2.raw
i_e2image/image4096.orig
4077552412 image4096.orig
4159471388 _image.raw
636354894 _image.qcow2
4159471388 _image.qcow2.raw

View File

@ -1,15 +0,0 @@
i_e2image/image1024.orig
d34914e0da07bdae80ab02288118fae2 image1024.orig
bbef4e50d7237546c7d9c521d3df5b68 _image.raw
1d4eb39452bed097dcd2c5bcd57180e6 _image.qcow2
bbef4e50d7237546c7d9c521d3df5b68 _image.qcow2.raw
i_e2image/image2048.orig
aa9f702de181188f2a6d2c5158686c09 image2048.orig
e6f8410d0690ef551bee0c2c0c642d8c _image.raw
dbbd9aa97c6c946b9122586bbd2a325a _image.qcow2
e6f8410d0690ef551bee0c2c0c642d8c _image.qcow2.raw
i_e2image/image4096.orig
1d3e7f15b2ce9ca07aa23c32951c5176 image4096.orig
734119dd8f240a33704139f8cdd8127c _image.raw
85fdbf5a8451b24b36ab82a02196deb9 _image.qcow2
734119dd8f240a33704139f8cdd8127c _image.qcow2.raw

View File

@ -7,42 +7,42 @@ RAW_IMG=_image.raw
QCOW2_IMG=_image.qcow2
QCOW2_TO_RAW=_image.qcow2.raw
OUT=$test_name.log
MD5=$SRCDIR/$test_name/$test_name.md5
MD5_TMP=$test_name.md5.tmp
CRC=$SRCDIR/$test_name/$test_name.crc
CRC_TMP=$test_name.crc.tmp
rm -f $test_name/_image.* $MD5_TMP $OUT >/dev/null 2>&1
rm -f $test_name/_image.* $CRC_TMP $OUT >/dev/null 2>&1
(
for i in $ORIG_IMAGES; do
ORIG_IMG=$test_name/$i
echo $ORIG_IMG >> $MD5_TMP
echo $ORIG_IMG >> $CRC_TMP
bunzip2 < $SRCDIR/$ORIG_IMG.bz2 > $i
md5sum $i >> $MD5_TMP
echo "$($CRCSUM $i) $i" >> $CRC_TMP
rm -f $RAW_IMG
echo "e2image -r $ORIG_IMG $RAW_IMG"
$E2IMAGE -r $i $RAW_IMG
md5sum $RAW_IMG >> $MD5_TMP
echo "$($CRCSUM $RAW_IMG) $RAW_IMG" >> $CRC_TMP
echo "e2image -Q $ORIG_IMG $QCOW2_IMG"
$E2IMAGE -Q $i $QCOW2_IMG
md5sum $QCOW2_IMG >> $MD5_TMP
echo "$($CRCSUM $QCOW2_IMG) $QCOW2_IMG" >> $CRC_TMP
rm -f $QCOW2_TO_RAW
echo "e2image -r $QCOW2_IMG $QCOW2_TO_RAW"
$E2IMAGE -r $i $QCOW2_TO_RAW
md5sum $QCOW2_TO_RAW >> $MD5_TMP
echo "$($CRCSUM $QCOW2_TO_RAW) $QCOW2_TO_RAW" >> $CRC_TMP
rm -f $i
done
) >> $OUT 2>&1
echo "md5sums:" >> $OUT
cat $MD5_TMP >> $OUT
echo "checksum:" >> $OUT
cat $CRC_TMP >> $OUT
echo "" >> $OUT
diff $MD5 $MD5_TMP >> $OUT 2>&1
diff $CRC $CRC_TMP >> $OUT 2>&1
if [ $? -eq 0 ]; then
echo "$test_name: $test_description: ok"
@ -52,7 +52,7 @@ else
echo "$test_name: $test_description: failed"
fi
rm -f _image.* $MD5_TMP >/dev/null 2>&1
rm -f _image.* $CRC_TMP >/dev/null 2>&1
else #if test -x $E2IMAGE_EXE; then
echo "$test_name: $test_description: skipped"

View File

@ -11,19 +11,19 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
echo mke2fs -q -F -o Linux -b 1024 test.img > $OUT
$MKE2FS -F -o Linux -I 128 -b 1024 $TMPFILE >> $OUT 2>&1
md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum before mke2fs $md5 >> $OUT
crc=`$CRCSUM $TMPFILE`
echo $CRCSUM before mke2fs $crc >> $OUT
echo using mke2fs to test e2undo >> $OUT
$MKE2FS -q -F -o Linux -I 256 -O uninit_bg -E lazy_itable_init=1 -b 1024 $TMPFILE >> $OUT 2>&1
new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum after mke2fs $new_md5 >> $OUT
new_crc=`$CRCSUM $TMPFILE`
echo $CRCSUM after mke2fs $new_crc >> $OUT
$E2UNDO_EXE $TDB_FILE $TMPFILE >> $OUT 2>&1
new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum after e2undo $new_md5 >> $OUT
new_crc=`$CRCSUM $TMPFILE`
echo $CRCSUM after e2undo $new_crc >> $OUT
if [ $md5 = $new_md5 ]; then
if [ $crc = $new_crc ]; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else

View File

@ -11,19 +11,19 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
echo mke2fs -q -F -o Linux -b 1024 $TMPFILE > $OUT
$MKE2FS -q -F -o Linux -I 128 -b 1024 $TMPFILE >> $OUT 2>&1
md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum before tune2fs $md5 >> $OUT
crc=`$CRCSUM $TMPFILE`
echo $CRCSUM before tune2fs $crc >> $OUT
echo using tune2fs to test e2undo >> $OUT
$TUNE2FS -I 256 $TMPFILE >> $OUT 2>&1
new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum after tune2fs $new_md5 >> $OUT
new_crc=`$CRCSUM $TMPFILE`
echo $CRCSUM after tune2fs $new_crc >> $OUT
$E2UNDO_EXE $TDB_FILE $TMPFILE >> $OUT 2>&1
new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
echo md5sum after e2undo $new_md5 >> $OUT
new_crc=`$CRCSUM $TMPFILE`
echo $CRCSUM after e2undo $new_crc >> $OUT
if [ $md5 = $new_md5 ]; then
if [ $crc = $new_crc ]; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else