linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Filipe Manana <fdmanana@suse.com>, fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3] fstests: generic test for directory fsync after adding hard links
Date: Tue, 24 Feb 2015 17:40:05 -0600	[thread overview]
Message-ID: <54ED0BD5.3040504@redhat.com> (raw)
In-Reply-To: <1424820589-3593-1-git-send-email-fdmanana@suse.com>

On 2/24/15 5:29 PM, Filipe Manana wrote:
> This test is motivated by an fsync issue discovered in btrfs.
> The issue was that after adding a new hard link to an existing file
> (one that was created in a past transaction) and fsync'ing the parent
> directory of the new hard link, after the fsync log replay the file's
> inode link count did not get its link count incremented, while the new
> directory entry was visible.
> Also, unlike xfs and ext4, new files under the directory we fsync were
> not being written to the fsync log, nor were any child directories and
> new files and links under the children directories. So this test verifies
> too that btrfs has the same behaviour as xfs and ext4.
> 
> The btrfs issue was fixed by the following linux kernel patch:
> 
>   Btrfs: fix metadata inconsistencies after directory fsync
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> 
> V2: Make use of the new function '_require_metadata_journaling' added
>     by Eric. Make the test pass on ext3 - unlike ext4 (and xfs), the
>     file hello gets all its data synced, so we don't get an empty file
>     after the fsync log is replayed.
> 
> V3: Make our file 'foo' not empty and verify that after log replay its
>     content remains unchanged. Motivated by an issue found during development
>     of the btrfs fix.
> 
>  tests/generic/060     | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/060.out |  11 ++++
>  tests/generic/group   |   1 +
>  3 files changed, 187 insertions(+)
>  create mode 100755 tests/generic/060
>  create mode 100644 tests/generic/060.out
> 
> diff --git a/tests/generic/060 b/tests/generic/060
> new file mode 100755
> index 0000000..0d459fa
> --- /dev/null
> +++ b/tests/generic/060
> @@ -0,0 +1,175 @@
> +#! /bin/bash
> +# FS QA Test No. 060
> +#
> +# This test is motivated by an fsync issue discovered in btrfs.
> +# The issue was that after adding a new hard link to an existing file (one that
> +# was created in a past transaction) and fsync'ing the parent directory of the
> +# new hard link, after the fsync log replay the file's inode link count did not
> +# get its link count incremented, while the new directory entry was visible.
> +# Also, unlike xfs and ext4, new files under the directory we fsync were not
> +# being written to the fsync log, nor were any child directories and new files
> +# and links under the children directories. So this test verifies too that
> +# btrfs has the same behaviour as xfs and ext3/4.
> +#
> +# The btrfs issue was fixed by the following linux kernel patch:
> +#
> +#  Btrfs: fix metadata inconsistencies after directory fsync


I still would like to know *what this test does* - not some narrative about
btrfs's troubled past.  ;)

Could you please add that line or two, and feel free to keep all the detail about
the btrfs-specific bug later?  We're getting a lot of these tests, and a
short description of what a test does is just How We Do It(tm).  It saves having to 
read a lot of bash code just to get some idea of what is under test.

i.e. like this, or whatever is accurate:

# Test that link counts remain correct after fsyncing a parent directory
# containing hardlinks, and subsequent log recovery
#
# <insert fascinating btrfs story here>

Please just do this; it'll save people time, down the line, if/when
this test fails in the future, or needs to be maintained by someone
else.

If btrfs folks don't want simple test descriptions under tests/btrfs, your choice,
but I really would like to have this clarity on the generic tests.

Thanks,
-Eric

  reply	other threads:[~2015-02-24 23:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 18:29 [PATCH] fstests: generic test for directory fsync after adding hard links Filipe Manana
2015-02-24 11:20 ` [PATCH v2] " Filipe Manana
2015-02-24 23:29 ` [PATCH v3] " Filipe Manana
2015-02-24 23:40   ` Eric Sandeen [this message]
2015-02-25  0:06     ` Dave Chinner
2015-02-25  9:15       ` Lukáš Czerner
2015-02-25  0:51 ` [PATCH v4] " Filipe Manana
2015-02-25  1:39   ` Eric Sandeen

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=54ED0BD5.3040504@redhat.com \
    --to=sandeen@redhat.com \
    --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).