linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Filipe David Borba Manana <fdmanana@gmail.com>
Cc: xfs@oss.sgi.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] xfstests: add test for btrfs send issuing premature rmdir operations
Date: Mon, 24 Feb 2014 16:25:53 +1100	[thread overview]
Message-ID: <20140224052553.GJ4317@dastard> (raw)
In-Reply-To: <1392820352-8550-1-git-send-email-fdmanana@gmail.com>

On Wed, Feb 19, 2014 at 02:32:32PM +0000, Filipe David Borba Manana wrote:
> Regression test for btrfs incremental send issue where a rmdir instruction
> is sent against an orphan directory inode which is not empty yet, causing
> btrfs receive to fail when it attempts to remove the directory.
> 
> This issue is fixed by the following linux kernel btrfs patch:
> 
>    Btrfs: fix send attempting to rmdir non-empty directories
> 
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
> ---
>  tests/btrfs/041     |  153 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/041.out |    1 +
>  tests/btrfs/group   |    1 +
>  3 files changed, 155 insertions(+)
>  create mode 100755 tests/btrfs/041
>  create mode 100644 tests/btrfs/041.out
> 
> diff --git a/tests/btrfs/041 b/tests/btrfs/041
> new file mode 100755
> index 0000000..9de9326
> --- /dev/null
> +++ b/tests/btrfs/041
> @@ -0,0 +1,153 @@
> +#! /bin/bash
> +# FS QA Test No. btrfs/041
> +#
> +# Regression test for btrfs incremental send issue where a rmdir instruction
> +# is sent against an orphan directory inode which is not empty yet, causing
> +# btrfs receive to fail when it attempts to remove the directory.
> +#
> +# This issue is fixed by the following linux kernel btrfs patch:
> +#
> +#   Btrfs: fix send attempting to rmdir non-empty directories
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Filipe Manana.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=`mktemp -d`
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    rm -fr $tmp
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +_need_to_be_root
> +
> +FSSUM_PROG=$here/src/fssum
> +[ -x $FSSUM_PROG ] || _notrun "fssum not built"

This is duplicated across several tests now. Perhaps this should be
factored now into a _requires_fssum helper (separate patch is
fine)?

> +
> +_scratch_unmount
> +_check_btrfs_filesystem $SCRATCH_DEV

you should be able to use _check_scratch_fs() here. I note that the
btrfs path does not unmount the scratch device, so you should update
it to do so (like _check_xfs_filesytem does) and then
_check_scratch_fs() will just Do The Right Thing.

> +_scratch_mkfs >/dev/null 2>&1
> +_scratch_mount
> +
> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/1.snap
> +run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
> +
> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/2.snap
> +run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full

Hasn't run_check already redirected everything to $seqres.full?

> +_scratch_unmount
> +_check_btrfs_filesystem $SCRATCH_DEV

_check_scratch_fs() here too.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2014-02-24  5:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 14:32 [PATCH] xfstests: add test for btrfs send issuing premature rmdir operations Filipe David Borba Manana
2014-02-24  5:25 ` Dave Chinner [this message]
2014-02-24 11:58   ` Filipe David Manana
2014-02-24 11:54 ` [PATCH v2] " Filipe David Borba Manana
2014-03-07 18:22   ` Josef Bacik

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=20140224052553.GJ4317@dastard \
    --to=david@fromorbit.com \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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).