Skip to contentSkip to conversation

iotests: Fix 226 on _my_ system

PATCH In review Fam Zheng 4 participants 8 messages Jul 24, 2018 – Jul 27, 2018

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover iotests: Fix 226 on _my_ system

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Fix the test case by disabling locking, and add a doc text about using test images.

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

 docs/devel/testing.rst | 11 +++++++++++
 tests/qemu-iotests/226 |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 docs: Describe using images in writing iotests

---
 docs/devel/testing.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
docs/devel/testing.rst +11 -0
index 5e19cd50da..8e1fa3a66e 100644
@@ -255,6 +255,17 @@ comparable library support for invoking and interacting with QEMU programs. If
 you opt for Python, it is strongly recommended to write Python 3 compatible
 code.
 
+Both Python and Bash frameworks in iotests provide helpers to manage test
+images. They can be used to create and clean up images under the test
+directory. If no I/O or any protocol specific feature is needed, it is often
+more convenient to use the pseudo block driver, ``null-co://``, as the test
+image, which doesn't require image creation or cleaning up. Avoid system-wide
+devices or files whenever possible, such as ``/dev/null`` or ``/dev/zero``.
+Otherwise, image locking implications have to be considered.  For example,
+another application on the host may have locked the file, possibly leading to a
+test failure.  If using such devices are explicitly desired, consider adding
+``locking=off`` option to disable image locking.
+
 Docker based tests
 ==================
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 iotests: Don't lock /dev/null in 226

In reply to Fam Zheng

On my system (Fedora 28), this script reports a 'failed to get "consistent read" lock' error. Following docs/devel/testing.rst, it's better to add locking=off here.

---
 tests/qemu-iotests/226 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/226 +2 -2
index 211ea9888a..8ec3e612dd 100755
@@ -56,10 +56,10 @@ for PROTO in "file" "host_device" "host_cdrom"; do
     echo
     echo "== Testing RO =="
     $QEMU_IO -c "open -r -o driver=$PROTO,filename=$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
-    $QEMU_IO -c "open -r -o driver=$PROTO,filename=/dev/null" 2>&1 | _filter_imgfmt
+    $QEMU_IO -c "open -r -o driver=$PROTO,filename=/dev/null,locking=off" 2>&1 | _filter_imgfmt
     echo "== Testing RW =="
     $QEMU_IO -c "open -o driver=$PROTO,filename=$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
-    $QEMU_IO -c "open -o driver=$PROTO,filename=/dev/null" 2>&1 | _filter_imgfmt
+    $QEMU_IO -c "open -o driver=$PROTO,filename=/dev/null,locking=off" 2>&1 | _filter_imgfmt
 done
 
 # success, all done
Signature · 1 line
2.17.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Fam Zheng
Quoted 5 lines · Fam Zheng

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Quoted 7 lines

Fix the test case by disabling locking, and add a doc text about using test images.

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

Quoted 4 lines
  docs/devel/testing.rst | 11 +++++++++++
  tests/qemu-iotests/226 |  4 ++--
  2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by on the v1 series
#4 lore raw
In reply to Fam Zheng
Quoted 8 lines · Fam Zheng

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Fix the test case by disabling locking, and add a doc text about using test images.

Quoted 8 lines

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

 docs/devel/testing.rst | 11 +++++++++++
 tests/qemu-iotests/226 |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

I think this is the better approach for now, yeah. Sorry my test caused so many problems... :[

author
#5 lore raw
In reply to Fam Zheng
Quoted 8 lines · Fam Zheng

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Fix the test case by disabling locking, and add a doc text about using test images.

Quoted 7 lines

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

 docs/devel/testing.rst | 11 +++++++++++
 tests/qemu-iotests/226 |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

Kevin, could you apply this for 3.0 too?

Fam

#6 lore raw

Am 27.07.2018 um 11:24 hat Fam Zheng geschrieben:

Quoted 13 lines · Fam Zheng
Quoted 12 lines

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Fix the test case by disabling locking, and add a doc text about using test images.

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

Quoted 5 lines
Quoted 3 lines
 docs/devel/testing.rst | 11 +++++++++++
 tests/qemu-iotests/226 |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

Kevin, could you apply this for 3.0 too?

Sure, applied to the block branch.

Out of curiosity, did you find out what had locked the devices?

Kevin

author
#7 lore raw
Quoted 19 lines · Kevin Wolf

Am 27.07.2018 um 11:24 hat Fam Zheng geschrieben:

Quoted 17 lines · Fam Zheng
Quoted 15 lines

Something has locked /dev/null on my system (I still don't know what to do with the annoying incapability of lslocks, or more precisely /proc/locks, on inspecting OFD lock information), and as a result 226 cannot pass due to the unexpected image locking error.

Fix the test case by disabling locking, and add a doc text about using test images.

Fam Zheng (2):
docs: Describe using images in writing iotests
iotests: Don't lock /dev/null in 226

 docs/devel/testing.rst | 11 +++++++++++
 tests/qemu-iotests/226 |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 1 line

Kevin, could you apply this for 3.0 too?

Sure, applied to the block branch.

Out of curiosity, did you find out what had locked the devices?

No, but I'll for sure allocate some time to understand kernel's OFD internals, find the holder application, then hopefully, propose something that can fix lslocks.

Thanks,
Fam

Quoted 2 lines

Kevin