On Mon, Nov 02, 2015 at 12:32:57PM +0000, fdman...@kernel.org wrote:
> From: Filipe Manana <fdman...@suse.com>
> 
> Test that a file fsync works after punching a hole for the same file
> range multiple times, and that after log/journal replay the file's
> content and layout are correct.
> 
> This test is motivated by a bug found in btrfs, which is fixed by
> the following linux kernel patch:
> 
>   "Btrfs: fix hole punching when using the no-holes feature"
....
> +# This test was motivated by an issue found in btrfs when the btrfs no-holes
> +# feature is enabled (introduced in kernel 3.14). So enable the feature if 
> the
> +# fs being tested is btrfs.
> +if [ $FSTYP == "btrfs" ]; then
> +     _require_btrfs_fs_feature "no_holes"
> +     _require_btrfs_mkfs_feature "no-holes"
> +     MKFS_OPTIONS="$MKFS_OPTIONS -O no-holes"
> +fi

This sort of transparent filesystem option should be tested by
executing the entire test suite with it enabled:

# MKFS_OPTIONS="-O no-holes" ./check -g auto

rather than only enabling for just this test.

> +# Silently drop all writes and unmount to simulate a crash/power failure.
> +_load_flakey_table $FLAKEY_DROP_WRITES
> +_unmount_flakey
> +
> +# Allow writes again, mount to trigger log replay and validate file contents.
> +_load_flakey_table $FLAKEY_ALLOW_WRITES
> +_mount_flakey

This is repeated often enough across many tests that a helper like:

# Silently drop all writes and unmount/remount to simulate a
# crash/power failure.
_flakey_drop_and_remount()
{
        _load_flakey_table $FLAKEY_DROP_WRITES
        _unmount_flakey

        _load_flakey_table $FLAKEY_ALLOW_WRITES
        _mount_flakey
}

is appropriate. Doesn't need to be in this patch, though.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to