public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/3] xfs: add a test for unlinked inodes due to O_TMPFILE
Date: Thu, 13 Mar 2014 22:29:07 +1100	[thread overview]
Message-ID: <20140313112907.GJ4263@dastard> (raw)
In-Reply-To: <20140313101433.608283621@bombadil.infradead.org>

On Thu, Mar 13, 2014 at 03:13:05AM -0700, Christoph Hellwig wrote:
> Make sure that we see unlinked inodes when shutting a filesystem
> down that has an open O_TMPFILE descriptor, and make sure that it
> has been deleted after a mount/umount cycle.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/xfs/006     |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/006.out |   43 ++++++++++++++++++++++++++
>  tests/xfs/group   |    1 +
>  3 files changed, 133 insertions(+)
>  create mode 100755 tests/xfs/006
>  create mode 100644 tests/xfs/006.out
> 
> diff --git a/tests/xfs/006 b/tests/xfs/006
> new file mode 100755
> index 0000000..7dae43d
> --- /dev/null
> +++ b/tests/xfs/006
> @@ -0,0 +1,89 @@
> +#! /bin/bash
> +# XFS QA Test No. 006
> +#
> +# Test O_TMPFILE interaction with log recovery and repair.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Christoph Hellwig.  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=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -f $tmp.*
> +    rm -f ${testfile}

No need to remove the testfile on a scratch device here.

...

> +testfile="${SCRATCH_MNT}/tst-tmpfile-flink"

isn't used.

> +
> +_scratch_mount
> +
> +#
> +# Test creating a r/w tmpfile, make sure it goes out to disk while still
> +# open using a freeze/thaw, and then shut down the filesystem.
> +#
> +$XFS_IO_PROG -x -T \
> +	-c "pwrite 0 4096" \
> +	-c "pread 0 4096" \
> +	-c "freeze" \
> +	-c "thaw" \
> +	-c "shutdown" \
> +	${SCRATCH_MNT} | _filter_xfs_io

So that's an inode on the unlinked list with a link count of zero.

> +_scratch_unmount
> +
> +# repair should find an unlinked inode now
> +_scratch_xfs_repair -n 2>&1 | \
> +	_filter_repair > $tmp.repair

The filter removes the AGI unlinked bucket inode listings, which is
what we really want to see here. The checking for disconnected
inodes is a side effect of using no-modify mode - if it was a real
repair that inode would be trashed, not seen as a disconnected
inode.

Hence I think this is really checking for the wrong thing...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-03-13 11:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-13 10:13 [PATCH 0/3] O_TMPFILE tests, v2 Christoph Hellwig
2014-03-13 10:13 ` [PATCH 1/3] common: add flink support to _require_xfs_io_command Christoph Hellwig
2014-03-13 11:10   ` Dave Chinner
2014-03-13 10:13 ` [PATCH 2/3] generic: add a basic O_TMPFILE test Christoph Hellwig
2014-03-13 11:16   ` Dave Chinner
2014-03-13 10:13 ` [PATCH 3/3] xfs: add a test for unlinked inodes due to O_TMPFILE Christoph Hellwig
2014-03-13 11:29   ` Dave Chinner [this message]
2014-04-03 11:07     ` Christoph Hellwig
2014-04-03 21:32       ` Dave Chinner

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=20140313112907.GJ4263@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.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