linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: fdmanana@kernel.org
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
	Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] fstests: generic test for fsync after hole punching
Date: Tue, 3 Nov 2015 10:53:09 +1100	[thread overview]
Message-ID: <20151102235309.GK10656@dastard> (raw)
In-Reply-To: <1446467577-32220-1-git-send-email-fdmanana@kernel.org>

On Mon, Nov 02, 2015 at 12:32:57PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@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
david@fromorbit.com

  reply	other threads:[~2015-11-02 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 12:32 [PATCH] fstests: generic test for fsync after hole punching fdmanana
2015-11-02 23:53 ` Dave Chinner [this message]
2015-11-04  9:58 ` [PATCH v2] " fdmanana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151102235309.GK10656@dastard \
    --to=david@fromorbit.com \
    --cc=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).