All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-11-29 12:02 Xiao Yang
  2017-12-04  8:29 ` Eryu Guan
  0 siblings, 1 reply; 21+ messages in thread
From: Xiao Yang @ 2017-11-29 12:02 UTC (permalink / raw)
  To: fstests; +Cc: Xiao Yang

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>
---
 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




^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-11-29 12:02 [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev Xiao Yang
@ 2017-12-04  8:29 ` Eryu Guan
  2017-12-04  9:15     ` Xiao Yang
  0 siblings, 1 reply; 21+ messages in thread
From: Eryu Guan @ 2017-12-04  8:29 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, Omar Sandoval, linux-block

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-04  8:29 ` Eryu Guan
@ 2017-12-04  9:15     ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-04  9:15 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Omar Sandoval, linux-block

On 2017/12/04 16:29, Eryu Guan wrote:
> 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?
Hi Eryu,

Do you think test cases which use scsi_debug module should be moved into 
blktests?
(e.g. generic/108, generic/349, generic/350, generic/351)

Thanks,
Xiao Yang
> 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
> --
> 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
>
>
> .
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-12-04  9:15     ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-04  9:15 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Omar Sandoval, linux-block

On 2017/12/04 16:29, Eryu Guan wrote:
> 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?
Hi Eryu,

Do you think test cases which use scsi_debug module should be moved into 
blktests?
(e.g. generic/108, generic/349, generic/350, generic/351)

Thanks,
Xiao Yang
> 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
> --
> 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
>
>
> .
>




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-04  9:15     ` Xiao Yang
  (?)
@ 2017-12-04  9:25     ` Eryu Guan
  2017-12-04  9:48         ` Xiao Yang
  -1 siblings, 1 reply; 21+ messages in thread
From: Eryu Guan @ 2017-12-04  9:25 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, Omar Sandoval, linux-block

On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
> On 2017/12/04 16:29, Eryu Guan wrote:
> > 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?
> Hi Eryu,
> 
> Do you think test cases which use scsi_debug module should be moved into
> blktests?
> (e.g. generic/108, generic/349, generic/350, generic/351)

I don't think they need to be moved to blktests. Most other tests that
take use of scsi_debug are for filesystem testing, e.g. generic/108.
generic/349 generic/35[01] are a bit special, they were there before
blktests was announced available, so they're in a special blockdev group
and not in the auto group. If Omar agrees, I think they can be ported to
blktests.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-04  9:25     ` Eryu Guan
@ 2017-12-04  9:48         ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-04  9:48 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Omar Sandoval, linux-block

On 2017/12/04 17:25, Eryu Guan wrote:
> On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
>> On 2017/12/04 16:29, Eryu Guan wrote:
>>> 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?
>> Hi Eryu,
>>
>> Do you think test cases which use scsi_debug module should be moved into
>> blktests?
>> (e.g. generic/108, generic/349, generic/350, generic/351)
> I don't think they need to be moved to blktests. Most other tests that
> take use of scsi_debug are for filesystem testing, e.g. generic/108.
> generic/349 generic/35[01] are a bit special, they were there before
> blktests was announced available, so they're in a special blockdev group
> and not in the auto group. If Omar agrees, I think they can be ported to
> blktests.
Hi Eryu,

Thanks for your explanation, and i will try to send it to blktests.

Thanks,
Xiao Yang
> Thanks,
> Eryu
>
>
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-12-04  9:48         ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-04  9:48 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Omar Sandoval, linux-block

On 2017/12/04 17:25, Eryu Guan wrote:
> On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
>> On 2017/12/04 16:29, Eryu Guan wrote:
>>> 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?
>> Hi Eryu,
>>
>> Do you think test cases which use scsi_debug module should be moved into
>> blktests?
>> (e.g. generic/108, generic/349, generic/350, generic/351)
> I don't think they need to be moved to blktests. Most other tests that
> take use of scsi_debug are for filesystem testing, e.g. generic/108.
> generic/349 generic/35[01] are a bit special, they were there before
> blktests was announced available, so they're in a special blockdev group
> and not in the auto group. If Omar agrees, I think they can be ported to
> blktests.
Hi Eryu,

Thanks for your explanation, and i will try to send it to blktests.

Thanks,
Xiao Yang
> Thanks,
> Eryu
>
>
>




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-04  9:48         ` Xiao Yang
  (?)
@ 2017-12-04 18:29         ` Omar Sandoval
  2017-12-19 10:30             ` xiao yang
  2017-12-19 10:45             ` Xiao Yang
  -1 siblings, 2 replies; 21+ messages in thread
From: Omar Sandoval @ 2017-12-04 18:29 UTC (permalink / raw)
  To: Xiao Yang; +Cc: Eryu Guan, fstests, linux-block

On Mon, Dec 04, 2017 at 05:48:36PM +0800, Xiao Yang wrote:
> On 2017/12/04 17:25, Eryu Guan wrote:
> > On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
> > > On 2017/12/04 16:29, Eryu Guan wrote:
> > > > 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?
> > > Hi Eryu,
> > > 
> > > Do you think test cases which use scsi_debug module should be moved into
> > > blktests?
> > > (e.g. generic/108, generic/349, generic/350, generic/351)
> > I don't think they need to be moved to blktests. Most other tests that
> > take use of scsi_debug are for filesystem testing, e.g. generic/108.
> > generic/349 generic/35[01] are a bit special, they were there before
> > blktests was announced available, so they're in a special blockdev group
> > and not in the auto group. If Omar agrees, I think they can be ported to
> > blktests.
> Hi Eryu,
> 
> Thanks for your explanation, and i will try to send it to blktests.
> 
> Thanks,
> Xiao Yang

I agree, the three tests Eryu mentioned and this new test would be a
good fit for blktests. Let me know if you need any help porting, things
are a little different from xfstests.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH blktests] block/013: Add test for BLKRRPART ioctl
  2017-12-04 18:29         ` Omar Sandoval
@ 2017-12-19 10:30             ` xiao yang
  2017-12-19 10:45             ` Xiao Yang
  1 sibling, 0 replies; 21+ messages in thread
From: xiao yang @ 2017-12-19 10:30 UTC (permalink / raw)
  To: osandov; +Cc: eguan, fstests, linux-block, xiao yang

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>
---
 tests/block/013     | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/013.out |  3 +++
 2 files changed, 65 insertions(+)
 create mode 100755 tests/block/013
 create mode 100644 tests/block/013.out

diff --git a/tests/block/013 b/tests/block/013
new file mode 100755
index 0000000..77ae55c
--- /dev/null
+++ b/tests/block/013
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# 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.
+#
+# Regression test for commit 77032ca66f86 ("Return EBUSY from
+# BLKRRPART for mounted whole-dev fs").
+#
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="test return EBUSY from BLKRRPART for mounted whole-dev"
+QUICK=1
+
+requires() {
+	_have_program mkfs.ext3
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	rm -f "$FULL"
+	mkdir "$TMPDIR/mntpoint"
+
+	# Format
+	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1
+
+	# Mount
+	mount "$TEST_DEV" "$TMPDIR/mntpoint"
+
+	# Check mounted whole-dev
+	local out=$(blockdev --rereadpt "$TEST_DEV" 2>&1)
+	echo $out | grep -q "Device or resource busy"
+	if [ $? -eq 0 ]; then
+		echo "Return EBUSY for mounted whole-dev"
+	else
+		echo "Don't return EBUSY for mounted whole-dev"
+	fi
+
+	echo $out >> "$FULL"
+
+	# Umount
+	umount "$TMPDIR/mntpoint"
+
+	rm -rf "$TMPDIR/mntpoint"
+
+	echo "Test complete"
+}
diff --git a/tests/block/013.out b/tests/block/013.out
new file mode 100644
index 0000000..74d1d08
--- /dev/null
+++ b/tests/block/013.out
@@ -0,0 +1,3 @@
+Running block/013
+Return EBUSY for mounted whole-dev
+Test complete
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH blktests] block/013: Add test for BLKRRPART ioctl
@ 2017-12-19 10:30             ` xiao yang
  0 siblings, 0 replies; 21+ messages in thread
From: xiao yang @ 2017-12-19 10:30 UTC (permalink / raw)
  To: osandov; +Cc: eguan, fstests, linux-block, xiao yang

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>
---
 tests/block/013     | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/013.out |  3 +++
 2 files changed, 65 insertions(+)
 create mode 100755 tests/block/013
 create mode 100644 tests/block/013.out

diff --git a/tests/block/013 b/tests/block/013
new file mode 100755
index 0000000..77ae55c
--- /dev/null
+++ b/tests/block/013
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# 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.
+#
+# Regression test for commit 77032ca66f86 ("Return EBUSY from
+# BLKRRPART for mounted whole-dev fs").
+#
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="test return EBUSY from BLKRRPART for mounted whole-dev"
+QUICK=1
+
+requires() {
+	_have_program mkfs.ext3
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	rm -f "$FULL"
+	mkdir "$TMPDIR/mntpoint"
+
+	# Format
+	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1
+
+	# Mount
+	mount "$TEST_DEV" "$TMPDIR/mntpoint"
+
+	# Check mounted whole-dev
+	local out=$(blockdev --rereadpt "$TEST_DEV" 2>&1)
+	echo $out | grep -q "Device or resource busy"
+	if [ $? -eq 0 ]; then
+		echo "Return EBUSY for mounted whole-dev"
+	else
+		echo "Don't return EBUSY for mounted whole-dev"
+	fi
+
+	echo $out >> "$FULL"
+
+	# Umount
+	umount "$TMPDIR/mntpoint"
+
+	rm -rf "$TMPDIR/mntpoint"
+
+	echo "Test complete"
+}
diff --git a/tests/block/013.out b/tests/block/013.out
new file mode 100644
index 0000000..74d1d08
--- /dev/null
+++ b/tests/block/013.out
@@ -0,0 +1,3 @@
+Running block/013
+Return EBUSY for mounted whole-dev
+Test complete
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-04 18:29         ` Omar Sandoval
@ 2017-12-19 10:45             ` Xiao Yang
  2017-12-19 10:45             ` Xiao Yang
  1 sibling, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-19 10:45 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Eryu Guan, fstests, linux-block

On 2017/12/05 2:29, Omar Sandoval wrote:
> On Mon, Dec 04, 2017 at 05:48:36PM +0800, Xiao Yang wrote:
>> On 2017/12/04 17:25, Eryu Guan wrote:
>>> On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
>>>> On 2017/12/04 16:29, Eryu Guan wrote:
>>>>> 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?
>>>> Hi Eryu,
>>>>
>>>> Do you think test cases which use scsi_debug module should be moved into
>>>> blktests?
>>>> (e.g. generic/108, generic/349, generic/350, generic/351)
>>> I don't think they need to be moved to blktests. Most other tests that
>>> take use of scsi_debug are for filesystem testing, e.g. generic/108.
>>> generic/349 generic/35[01] are a bit special, they were there before
>>> blktests was announced available, so they're in a special blockdev group
>>> and not in the auto group. If Omar agrees, I think they can be ported to
>>> blktests.
>> Hi Eryu,
>>
>> Thanks for your explanation, and i will try to send it to blktests.
>>
>> Thanks,
>> Xiao Yang
> I agree, the three tests Eryu mentioned and this new test would be a
> good fit for blktests. Let me know if you need any help porting, things
> are a little different from xfstests.
Hi Omar,

With gcc v4.4.7 on RHEL6, i got the following compiler error:
----------------------------------------------------------------------------------------------------------------------
[root@RHEL6U9GA_Intel64 blktests]# make
make -C src all
make[1]: Entering directory `/root/blktests/src'
cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
sg/syzkaller1.c: In function �segv_handler�:
sg/syzkaller1.c:118: warning: implicit declaration of function 
�__atomic_load_n�
sg/syzkaller1.c:118: error: �__ATOMIC_RELAXED� undeclared (first use in 
this function)
sg/syzkaller1.c:118: error: (Each undeclared identifier is reported only 
once
sg/syzkaller1.c:118: error: for each function it appears in.)
sg/syzkaller1.c: In function �syz_open_dev�:
sg/syzkaller1.c:204: warning: implicit declaration of function 
�__atomic_fetch_add�
sg/syzkaller1.c:204: error: �__ATOMIC_SEQ_CST� undeclared (first use in 
this function)
sg/syzkaller1.c:204: warning: implicit declaration of function 
�__atomic_fetch_sub�
sg/syzkaller1.c: In function �test�:
sg/syzkaller1.c:406: error: �__ATOMIC_SEQ_CST� undeclared (first use in 
this function)
make[1]: *** [sg/syzkaller1] Error 1
make[1]: Leaving directory `/root/blktests/src'
make: *** [all] Error 2
-----------------------------------------------------------------------------------------------------------------------

It seems that __atomic_* functions are not available, and could you tell 
me how to fix
the compiler error?

Thanks,
Xiao Yang
>
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-12-19 10:45             ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-19 10:45 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Eryu Guan, fstests, linux-block

On 2017/12/05 2:29, Omar Sandoval wrote:
> On Mon, Dec 04, 2017 at 05:48:36PM +0800, Xiao Yang wrote:
>> On 2017/12/04 17:25, Eryu Guan wrote:
>>> On Mon, Dec 04, 2017 at 05:15:17PM +0800, Xiao Yang wrote:
>>>> On 2017/12/04 16:29, Eryu Guan wrote:
>>>>> 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?
>>>> Hi Eryu,
>>>>
>>>> Do you think test cases which use scsi_debug module should be moved into
>>>> blktests?
>>>> (e.g. generic/108, generic/349, generic/350, generic/351)
>>> I don't think they need to be moved to blktests. Most other tests that
>>> take use of scsi_debug are for filesystem testing, e.g. generic/108.
>>> generic/349 generic/35[01] are a bit special, they were there before
>>> blktests was announced available, so they're in a special blockdev group
>>> and not in the auto group. If Omar agrees, I think they can be ported to
>>> blktests.
>> Hi Eryu,
>>
>> Thanks for your explanation, and i will try to send it to blktests.
>>
>> Thanks,
>> Xiao Yang
> I agree, the three tests Eryu mentioned and this new test would be a
> good fit for blktests. Let me know if you need any help porting, things
> are a little different from xfstests.
Hi Omar,

With gcc v4.4.7 on RHEL6, i got the following compiler error:
----------------------------------------------------------------------------------------------------------------------
[root@RHEL6U9GA_Intel64 blktests]# make
make -C src all
make[1]: Entering directory `/root/blktests/src'
cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
sg/syzkaller1.c: In function ‘segv_handler’:
sg/syzkaller1.c:118: warning: implicit declaration of function 
‘__atomic_load_n’
sg/syzkaller1.c:118: error: ‘__ATOMIC_RELAXED’ undeclared (first use in 
this function)
sg/syzkaller1.c:118: error: (Each undeclared identifier is reported only 
once
sg/syzkaller1.c:118: error: for each function it appears in.)
sg/syzkaller1.c: In function ‘syz_open_dev’:
sg/syzkaller1.c:204: warning: implicit declaration of function 
‘__atomic_fetch_add’
sg/syzkaller1.c:204: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use in 
this function)
sg/syzkaller1.c:204: warning: implicit declaration of function 
‘__atomic_fetch_sub’
sg/syzkaller1.c: In function ‘test’:
sg/syzkaller1.c:406: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use in 
this function)
make[1]: *** [sg/syzkaller1] Error 1
make[1]: Leaving directory `/root/blktests/src'
make: *** [all] Error 2
-----------------------------------------------------------------------------------------------------------------------

It seems that __atomic_* functions are not available, and could you tell 
me how to fix
the compiler error?

Thanks,
Xiao Yang
>
>




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH blktests] block/013: Add test for BLKRRPART ioctl
  2017-12-19 10:30             ` xiao yang
@ 2017-12-19 10:47               ` Johannes Thumshirn
  -1 siblings, 0 replies; 21+ messages in thread
From: Johannes Thumshirn @ 2017-12-19 10:47 UTC (permalink / raw)
  To: xiao yang; +Cc: osandov, eguan, fstests, linux-block

xiao yang <yangx.jy@cn.fujitsu.com> writes:

> +requires() {
> +	_have_program mkfs.ext3
> +}
[...]
> +	# Format
> +	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1

What's the reason to limit the test case to ext3 only? Can you switch it
to the generic 'mkfs' command? IIRC we require 'util-linux' to be
present for blktests but mkfs.ext3 is (at least in SUSE based distros)
in the e2fsprogs package.

apart from that:
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH blktests] block/013: Add test for BLKRRPART ioctl
@ 2017-12-19 10:47               ` Johannes Thumshirn
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Thumshirn @ 2017-12-19 10:47 UTC (permalink / raw)
  To: xiao yang; +Cc: osandov, eguan, fstests, linux-block

xiao yang <yangx.jy@cn.fujitsu.com> writes:

> +requires() {
> +	_have_program mkfs.ext3
> +}
[...]
> +	# Format
> +	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1

What's the reason to limit the test case to ext3 only? Can you switch it
to the generic 'mkfs' command? IIRC we require 'util-linux' to be
present for blktests but mkfs.ext3 is (at least in SUSE based distros)
in the e2fsprogs package.

apart from that:
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-19 10:45             ` Xiao Yang
@ 2017-12-19 10:53               ` Johannes Thumshirn
  -1 siblings, 0 replies; 21+ messages in thread
From: Johannes Thumshirn @ 2017-12-19 10:53 UTC (permalink / raw)
  To: Xiao Yang; +Cc: Omar Sandoval, Eryu Guan, fstests, linux-block

Xiao Yang <yangx.jy@cn.fujitsu.com> writes:
> [root@RHEL6U9GA_Intel64 blktests]# make
> make -C src all
> make[1]: Entering directory `/root/blktests/src'
> cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
> sg/syzkaller1.c: In function ‘segv_handler’:
> sg/syzkaller1.c:118: warning: implicit declaration of function
> ‘__atomic_load_n’
> sg/syzkaller1.c:118: error: ‘__ATOMIC_RELAXED’ undeclared (first use
> in this function)
> sg/syzkaller1.c:118: error: (Each undeclared identifier is reported
> only once
> sg/syzkaller1.c:118: error: for each function it appears in.)
> sg/syzkaller1.c: In function ‘syz_open_dev’:
> sg/syzkaller1.c:204: warning: implicit declaration of function
> ‘__atomic_fetch_add’
> sg/syzkaller1.c:204: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
> in this function)
> sg/syzkaller1.c:204: warning: implicit declaration of function
> ‘__atomic_fetch_sub’
> sg/syzkaller1.c: In function ‘test’:
> sg/syzkaller1.c:406: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
> in this function)
> make[1]: *** [sg/syzkaller1] Error 1
> make[1]: Leaving directory `/root/blktests/src'
> make: *** [all] Error 2
> -----------------------------------------------------------------------------------------------------------------------
>
> It seems that __atomic_* functions are not available, and could you
> tell me how to fix
> the compiler error?

It seems like gcc 4.4 is too old to handle __ATOMIC_*. The oldest
version of gcc I tried was 4.8 which could handle this code perfectly
fine.

I think we need hacks in the makefile to see which compiler version we
have and conditionally compile the code.

Byte,
        Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-12-19 10:53               ` Johannes Thumshirn
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Thumshirn @ 2017-12-19 10:53 UTC (permalink / raw)
  To: Xiao Yang; +Cc: Omar Sandoval, Eryu Guan, fstests, linux-block

Xiao Yang <yangx.jy@cn.fujitsu.com> writes:
> [root@RHEL6U9GA_Intel64 blktests]# make
> make -C src all
> make[1]: Entering directory `/root/blktests/src'
> cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
> sg/syzkaller1.c: In function ‘segv_handler’:
> sg/syzkaller1.c:118: warning: implicit declaration of function
> ‘__atomic_load_n’
> sg/syzkaller1.c:118: error: ‘__ATOMIC_RELAXED’ undeclared (first use
> in this function)
> sg/syzkaller1.c:118: error: (Each undeclared identifier is reported
> only once
> sg/syzkaller1.c:118: error: for each function it appears in.)
> sg/syzkaller1.c: In function ‘syz_open_dev’:
> sg/syzkaller1.c:204: warning: implicit declaration of function
> ‘__atomic_fetch_add’
> sg/syzkaller1.c:204: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
> in this function)
> sg/syzkaller1.c:204: warning: implicit declaration of function
> ‘__atomic_fetch_sub’
> sg/syzkaller1.c: In function ‘test’:
> sg/syzkaller1.c:406: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
> in this function)
> make[1]: *** [sg/syzkaller1] Error 1
> make[1]: Leaving directory `/root/blktests/src'
> make: *** [all] Error 2
> -----------------------------------------------------------------------------------------------------------------------
>
> It seems that __atomic_* functions are not available, and could you
> tell me how to fix
> the compiler error?

It seems like gcc 4.4 is too old to handle __ATOMIC_*. The oldest
version of gcc I tried was 4.8 which could handle this code perfectly
fine.

I think we need hacks in the makefile to see which compiler version we
have and conditionally compile the code.

Byte,
        Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
  2017-12-19 10:53               ` Johannes Thumshirn
@ 2017-12-19 10:59                 ` Xiao Yang
  -1 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-19 10:59 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Omar Sandoval, Eryu Guan, fstests, linux-block

On 2017/12/19 18:53, Johannes Thumshirn wrote:
> Xiao Yang<yangx.jy@cn.fujitsu.com>  writes:
>> [root@RHEL6U9GA_Intel64 blktests]# make
>> make -C src all
>> make[1]: Entering directory `/root/blktests/src'
>> cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
>> sg/syzkaller1.c: In function ‘segv_handler’:
>> sg/syzkaller1.c:118: warning: implicit declaration of function
>> ‘__atomic_load_n’
>> sg/syzkaller1.c:118: error: ‘__ATOMIC_RELAXED’ undeclared (first use
>> in this function)
>> sg/syzkaller1.c:118: error: (Each undeclared identifier is reported
>> only once
>> sg/syzkaller1.c:118: error: for each function it appears in.)
>> sg/syzkaller1.c: In function ‘syz_open_dev’:
>> sg/syzkaller1.c:204: warning: implicit declaration of function
>> ‘__atomic_fetch_add’
>> sg/syzkaller1.c:204: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
>> in this function)
>> sg/syzkaller1.c:204: warning: implicit declaration of function
>> ‘__atomic_fetch_sub’
>> sg/syzkaller1.c: In function ‘test’:
>> sg/syzkaller1.c:406: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
>> in this function)
>> make[1]: *** [sg/syzkaller1] Error 1
>> make[1]: Leaving directory `/root/blktests/src'
>> make: *** [all] Error 2
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> It seems that __atomic_* functions are not available, and could you
>> tell me how to fix
>> the compiler error?
> It seems like gcc 4.4 is too old to handle __ATOMIC_*. The oldest
> version of gcc I tried was 4.8 which could handle this code perfectly
> fine.
>
> I think we need hacks in the makefile to see which compiler version we
> have and conditionally compile the code.
Hi Johannes,

Thanks for your quick reply.  i will try to fix it as you suggested.

Thanks,
Xiao Yang
> Byte,
>          Johannes
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev
@ 2017-12-19 10:59                 ` Xiao Yang
  0 siblings, 0 replies; 21+ messages in thread
From: Xiao Yang @ 2017-12-19 10:59 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Omar Sandoval, Eryu Guan, fstests, linux-block

On 2017/12/19 18:53, Johannes Thumshirn wrote:
> Xiao Yang<yangx.jy@cn.fujitsu.com>  writes:
>> [root@RHEL6U9GA_Intel64 blktests]# make
>> make -C src all
>> make[1]: Entering directory `/root/blktests/src'
>> cc -Wall -o sg/syzkaller1 -O2 sg/syzkaller1.c
>> sg/syzkaller1.c: In function ‘segv_handler’:
>> sg/syzkaller1.c:118: warning: implicit declaration of function
>> ‘__atomic_load_n’
>> sg/syzkaller1.c:118: error: ‘__ATOMIC_RELAXED’ undeclared (first use
>> in this function)
>> sg/syzkaller1.c:118: error: (Each undeclared identifier is reported
>> only once
>> sg/syzkaller1.c:118: error: for each function it appears in.)
>> sg/syzkaller1.c: In function ‘syz_open_dev’:
>> sg/syzkaller1.c:204: warning: implicit declaration of function
>> ‘__atomic_fetch_add’
>> sg/syzkaller1.c:204: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
>> in this function)
>> sg/syzkaller1.c:204: warning: implicit declaration of function
>> ‘__atomic_fetch_sub’
>> sg/syzkaller1.c: In function ‘test’:
>> sg/syzkaller1.c:406: error: ‘__ATOMIC_SEQ_CST’ undeclared (first use
>> in this function)
>> make[1]: *** [sg/syzkaller1] Error 1
>> make[1]: Leaving directory `/root/blktests/src'
>> make: *** [all] Error 2
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> It seems that __atomic_* functions are not available, and could you
>> tell me how to fix
>> the compiler error?
> It seems like gcc 4.4 is too old to handle __ATOMIC_*. The oldest
> version of gcc I tried was 4.8 which could handle this code perfectly
> fine.
>
> I think we need hacks in the makefile to see which compiler version we
> have and conditionally compile the code.
Hi Johannes,

Thanks for your quick reply.  i will try to fix it as you suggested.

Thanks,
Xiao Yang
> Byte,
>          Johannes
>




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH blktests] block/013: Add test for BLKRRPART ioctl
  2017-12-19 10:47               ` Johannes Thumshirn
  (?)
@ 2017-12-19 19:42               ` Omar Sandoval
  2017-12-20  8:03                 ` Johannes Thumshirn
  -1 siblings, 1 reply; 21+ messages in thread
From: Omar Sandoval @ 2017-12-19 19:42 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: xiao yang, eguan, fstests, linux-block

On Tue, Dec 19, 2017 at 11:47:09AM +0100, Johannes Thumshirn wrote:
> xiao yang <yangx.jy@cn.fujitsu.com> writes:
> 
> > +requires() {
> > +	_have_program mkfs.ext3
> > +}
> [...]
> > +	# Format
> > +	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1
> 
> What's the reason to limit the test case to ext3 only? Can you switch it
> to the generic 'mkfs' command? IIRC we require 'util-linux' to be
> present for blktests but mkfs.ext3 is (at least in SUSE based distros)
> in the e2fsprogs package.

I'm fine with only testing one specific filesystem, since we're really
testing generic functionality and not any filesystem code. And according
to the manpage, bare mkfs is deprecated. I'm fine with requiring
e2fsprogs for this test, and xiao yang added the _have_program there for
it.

> apart from that:
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH blktests] block/013: Add test for BLKRRPART ioctl
  2017-12-19 10:30             ` xiao yang
  (?)
  (?)
@ 2017-12-19 23:42             ` Omar Sandoval
  -1 siblings, 0 replies; 21+ messages in thread
From: Omar Sandoval @ 2017-12-19 23:42 UTC (permalink / raw)
  To: xiao yang; +Cc: eguan, fstests, linux-block

On Tue, Dec 19, 2017 at 06:30:23PM +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>

Thanks, applied (with some slight modifications to make it easier to
diagnose a failure).

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH blktests] block/013: Add test for BLKRRPART ioctl
  2017-12-19 19:42               ` Omar Sandoval
@ 2017-12-20  8:03                 ` Johannes Thumshirn
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Thumshirn @ 2017-12-20  8:03 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: xiao yang, eguan, fstests, linux-block

Omar Sandoval <osandov@osandov.com> writes:

> On Tue, Dec 19, 2017 at 11:47:09AM +0100, Johannes Thumshirn wrote:
>> xiao yang <yangx.jy@cn.fujitsu.com> writes:
>> 
>> > +requires() {
>> > +	_have_program mkfs.ext3
>> > +}
>> [...]
>> > +	# Format
>> > +	mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1
>> 
>> What's the reason to limit the test case to ext3 only? Can you switch it
>> to the generic 'mkfs' command? IIRC we require 'util-linux' to be
>> present for blktests but mkfs.ext3 is (at least in SUSE based distros)
>> in the e2fsprogs package.
>
> I'm fine with only testing one specific filesystem, since we're really
> testing generic functionality and not any filesystem code. And according
> to the manpage, bare mkfs is deprecated. I'm fine with requiring
> e2fsprogs for this test, and xiao yang added the _have_program there for
> it.

what about something like (totally untested):

if _have_program mkfs.ext3; then
   mkfs_prog="mkfs.ext3"
   return 1
elif _have_program mkfs.xfs; then
   mkfs_prog="mkfs.xfs"
   return 1
elif _have_program mkfs.brtfs; then
   mkfs_prog="mkfs.brtfs"
   return 1
else
   retrun 0
fi


-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-12-20  8:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 12:02 [PATCH] generic/473: test return EBUSY from BLKRRPART for mounted whole-dev Xiao Yang
2017-12-04  8:29 ` Eryu Guan
2017-12-04  9:15   ` Xiao Yang
2017-12-04  9:15     ` Xiao Yang
2017-12-04  9:25     ` Eryu Guan
2017-12-04  9:48       ` Xiao Yang
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:30             ` xiao yang
2017-12-19 10:47             ` Johannes Thumshirn
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:45             ` Xiao Yang
2017-12-19 10:53             ` Johannes Thumshirn
2017-12-19 10:53               ` Johannes Thumshirn
2017-12-19 10:59               ` Xiao Yang
2017-12-19 10:59                 ` Xiao Yang

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.