From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH 1/2] generic: add a test for device removal with dirty data
Date: Tue, 25 Jul 2023 08:33:08 -0700 [thread overview]
Message-ID: <20230725153308.GD11340@frogsfrogsfrogs> (raw)
In-Reply-To: <20230724152927.33094-2-hch@lst.de>
On Mon, Jul 24, 2023 at 08:29:26AM -0700, Christoph Hellwig wrote:
> Test the removal of the underlying device when the file system still
> has dirty data.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good to me now,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> tests/generic/730 | 57 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/730.out | 2 ++
> 2 files changed, 59 insertions(+)
> create mode 100755 tests/generic/730
> create mode 100644 tests/generic/730.out
>
> diff --git a/tests/generic/730 b/tests/generic/730
> new file mode 100755
> index 00000000..11308cda
> --- /dev/null
> +++ b/tests/generic/730
> @@ -0,0 +1,57 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
> +# Copyright (c) 2023 Christoph Hellwig
> +#
> +# Test proper file system shut down when the block device is removed underneath
> +# and there is dirty data.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick
> +
> +_cleanup()
> +{
> + cd /
> + $UMOUNT_PROG $SCSI_DEBUG_MNT >>$seqres.full 2>&1
> + _put_scsi_debug_dev
> + rm -f $tmp.*
> +}
> +
> +. ./common/filter
> +. ./common/scsi_debug
> +
> +_supported_fs generic
> +
> +# We don't actually use the test device, but we need a block based fs
> +_require_test
> +_require_block_device $TEST_DEV
> +_require_scsi_debug
> +
> +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 512 512 0 256`
> +test -b "$SCSI_DEBUG_DEV" || _notrun "Failed to initialize scsi debug device"
> +echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full
> +
> +run_check _mkfs_dev $SCSI_DEBUG_DEV
> +
> +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq"
> +rm -rf $SCSI_DEBUG_MNT
> +mkdir $SCSI_DEBUG_MNT
> +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT
> +
> +# create a test file
> +$XFS_IO_PROG -f -c "pwrite 0 1M" $SCSI_DEBUG_MNT/testfile >>$seqres.full
> +
> +# open a file descriptor for reading the file
> +exec 3< $SCSI_DEBUG_MNT/testfile
> +
> +# delete the scsi debug device while it still has dirty data
> +echo 1 > /sys/block/$(_short_dev $SCSI_DEBUG_DEV)/device/delete
> +
> +# try to read from the file, which should give us -EIO
> +cat <&3 > /dev/null
> +
> +# close the file descriptor to not block unmount
> +exec 3<&-
> +
> +status=0
> +exit
> diff --git a/tests/generic/730.out b/tests/generic/730.out
> new file mode 100644
> index 00000000..79e96db8
> --- /dev/null
> +++ b/tests/generic/730.out
> @@ -0,0 +1,2 @@
> +QA output created by 730
> +cat: -: Input/output error
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-07-25 15:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 15:29 add device removal test v3 Christoph Hellwig
2023-07-24 15:29 ` [PATCH 1/2] generic: add a test for device removal with dirty data Christoph Hellwig
2023-07-24 18:23 ` Andrey Albershteyn
2023-07-24 19:52 ` Christoph Hellwig
2023-07-25 9:44 ` Andrey Albershteyn
2023-07-25 15:33 ` Darrick J. Wong [this message]
2023-08-06 14:11 ` Zorro Lang
2023-08-07 11:21 ` Christoph Hellwig
2023-07-24 15:29 ` [PATCH 2/2] generic: add a test for device removal without " Christoph Hellwig
2023-07-25 15:33 ` Darrick J. Wong
2023-07-25 7:28 ` add device removal test v3 Zorro Lang
-- strict thread matches above, loose matches on Subject: below --
2023-07-11 10:09 add device removal test v2 Christoph Hellwig
2023-07-11 10:09 ` [PATCH 1/2] generic: add a test for device removal with dirty data Christoph Hellwig
2023-07-18 10:34 ` Zorro Lang
2023-06-01 9:42 add device removal test Christoph Hellwig
2023-06-01 9:42 ` [PATCH 1/2] generic: add a test for device removal with dirty data Christoph Hellwig
2023-06-01 15:25 ` Darrick J. Wong
2023-06-01 15:27 ` Christoph Hellwig
2023-06-01 16:04 ` Darrick J. Wong
2023-06-02 4:13 ` Christoph Hellwig
2023-06-02 10:58 ` Zorro Lang
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=20230725153308.GD11340@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.