xfs
[Top] [All Lists]

Re: [PATCH 3/3] xfs: add a test for unlinked inodes due to O_TMPFILE

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/3] xfs: add a test for unlinked inodes due to O_TMPFILE
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 13 Mar 2014 22:29:07 +1100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140313101433.608283621@xxxxxxxxxxxxxxxxxxxxxx>
References: <20140313101302.996355155@xxxxxxxxxxxxxxxxxxxxxx> <20140313101433.608283621@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxx>
> ---
>  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@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>