From: Eryu Guan <eguan@redhat.com>
To: Xiao Yang <yangx.jy@cn.fujitsu.com>
Cc: fstests@vger.kernel.org, Omar Sandoval <osandov@osandov.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
Date: Mon, 4 Dec 2017 16:29:23 +0800 [thread overview]
Message-ID: <20171204082923.GF2749@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1511956946-16667-1-git-send-email-yangx.jy@cn.fujitsu.com>
On Wed, Nov 29, 2017 at 08:02:26PM +0800, Xiao Yang wrote:
> If the entire block device is formatted with a filesystem and
> mounted, running "blockdev --rereadpt" should fail and return
> EBUSY instead of pass.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
As we have blktests[1] now, I think this may fit in blktests better?
Thanks,
Eryu
[1] https://github.com/osandov/blktests
> ---
> tests/generic/473 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/473.out | 2 ++
> tests/generic/group | 1 +
> 3 files changed, 86 insertions(+)
> create mode 100755 tests/generic/473
> create mode 100644 tests/generic/473.out
>
> diff --git a/tests/generic/473 b/tests/generic/473
> new file mode 100755
> index 0000000..d7998cd
> --- /dev/null
> +++ b/tests/generic/473
> @@ -0,0 +1,83 @@
> +#! /bin/bash
> +# FS QA Test No. 473
> +#
> +# Regression test for commit:
> +# 77032ca ("Return EBUSY from BLKRRPART for mounted whole-dev fs")
> +#
> +# If the entire block device is formatted with a filesystem and
> +# mounted, running "blockdev --rereadpt" should fail and return
> +# EBUSY. On buggy kernel, it passes unexpectedly.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
> +# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
> +#
> +# 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`
> +tmpdir=`mktemp -d`
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 7 15
> +
> +_cleanup()
> +{
> + # Umount
> + $UMOUNT_PROG $tmpdir >>$seqres.full 2>&1
> + # Destroy device
> + _put_scsi_debug_dev
> + rm -rf $tmpdir
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/scsi_debug
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_os Linux
> +_require_scsi_debug
> +
> +# Create and format
> +test_dev=`_get_scsi_debug_dev`
> +_mkfs_dev $test_dev >>$seqres.full 2>&1
> +
> +# Mount and check mounted whole-dev
> +_mount $test_dev $tmpdir
> +
> +out=$(blockdev --rereadpt $test_dev 2>&1)
> +res=$?
> +
> +echo $out | grep -q "Unknown command" && \
> + _notrun "blockdev --rereadpt was not supported"
> +
> +[ $res -eq 0 ] && _fail "blockdev --rereadpt passed when checking mounted whole-dev"
> +
> +echo $out | grep -q "Device or resource busy" || \
> + _fail "blockdev --rereadpt returned unexpected error when checking mounted whole-dev"
> +
> +echo $out >> $seqres.full
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/473.out b/tests/generic/473.out
> new file mode 100644
> index 0000000..854fbcd
> --- /dev/null
> +++ b/tests/generic/473.out
> @@ -0,0 +1,2 @@
> +QA output created by 473
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index 6c3bb03..54b9404 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -472,3 +472,4 @@
> 467 auto quick exportfs
> 468 shutdown auto quick metadata
> 469 auto quick
> +473 auto quick blockdev
> --
> 1.8.3.1
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next parent reply other threads:[~2017-12-04 8:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1511956946-16667-1-git-send-email-yangx.jy@cn.fujitsu.com>
2017-12-04 8:29 ` Eryu Guan [this message]
2017-12-04 9:15 ` [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev Xiao Yang
2017-12-04 9:25 ` Eryu Guan
2017-12-04 9:48 ` Xiao Yang
2017-12-04 18:29 ` Omar Sandoval
2017-12-19 10:30 ` [PATCH blktests] block/013: Add test for BLKRRPART ioctl xiao yang
2017-12-19 10:47 ` Johannes Thumshirn
2017-12-19 19:42 ` Omar Sandoval
2017-12-20 8:03 ` Johannes Thumshirn
2017-12-19 23:42 ` Omar Sandoval
2017-12-19 10:45 ` [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev Xiao Yang
2017-12-19 10:53 ` Johannes Thumshirn
2017-12-19 10:59 ` Xiao Yang
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=20171204082923.GF2749@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=osandov@osandov.com \
--cc=yangx.jy@cn.fujitsu.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