RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1493890 - qemu hangs if shut down NBD service then make snapshot of the extra NBD disk.
Summary: qemu hangs if shut down NBD service then make snapshot of the extra NBD disk.
Keywords:
Status: CLOSED DUPLICATE of bug 1482478
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.4
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Longxiang Lyu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-21 06:40 UTC by Longxiang Lyu
Modified: 2017-10-06 18:03 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-06 18:03:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Longxiang Lyu 2017-09-21 06:40:23 UTC
Description of problem:
qemu hangs if shut down NBD service then make snapshot of the extra NBD disk.

Version-Release number of selected component (if applicable):
kernel-3.10.0-709.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.8


How reproducible:
100%

Steps to Reproduce:
1. use qemu to  export a disk as NBD driver
# qemu-kvm -drive file=test.qcow2,format=raw,id=img0 -qmp tcp:0:5555,server,nowait -monitor stdio -incoming tcp:0:6666
qmp:
{ "execute": "qmp_capabilities" }
{ "execute": "nbd-server-start", "arguments": { "addr": { "type": "inet", "data": { "host": "10.66.11.1", "port": "9000" } } } }
{ "execute": "nbd-server-add", "arguments": { "device": "img0", "writable": true } }

2. boot up a VM with the NBD image as additional driver
...
-drive file=/home/test/streamnbd/test.raw,format=raw,if=none,cache=none,snapshot=off,rerror=stop,werror=stop,id=img0 \
-device ide-hd,bus=ide.0,unit=0,drive=img0,id=ide-disk0,bootindex=0 \
-drive file=nbd://10.66.11.1:9000/img0,format=qcow2,if=none,cache=none,snapshot=off,rerror=stop,werror=stop,id=img1 \
-device ide-hd,bus=ide.0,unit=1,drive=img1,id=ide-disk1 \
…

3. stop nbd service
{ "execute" : "nbd-server-stop", "arguments" : {} }

4. do snapshot of img1
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "img1", "snapshot-file": "/home/test/streamnbd/sn1.qcow2", "format": "qcow2", "mode": "absolute-paths" } }


Actual results:
guest hangs.
nothing returns after the snapshot command.

Expected results:
guest functions normally and qemu should output error of snapshot

Additional info:
gdb output of the hanged qemu process
# gdb -batch -ex bt -p 26715
[New LWP 26754]
[New LWP 26746]
[New LWP 26731]
[New LWP 26730]
[New LWP 26729]
[New LWP 26728]
[New LWP 26716]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f4e4be03aff in ppoll () from /lib64/libc.so.6
#0  0x00007f4e4be03aff in ppoll () from /lib64/libc.so.6
#1  0x0000562eecf45fbb in ppoll (__ss=0x0, __timeout=0x0, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/bits/poll2.h:77
#2  qemu_poll_ns (fds=<optimized out>, nfds=<optimized out>, timeout=timeout@entry=-1) at util/qemu-timer.c:322
#3  0x0000562eecf47c75 in aio_poll (ctx=ctx@entry=0x562eee587980, blocking=<optimized out>) at util/aio-posix.c:622
#4  0x0000562eeced64a4 in bdrv_flush (bs=0x562eee6f0800) at block/io.c:2418
#5  0x0000562eecd49857 in external_snapshot_prepare (common=0x562ef0c98df0, errp=0x7fffe7aef268) at blockdev.c:1729
#6  0x0000562eecd4c1b7 in qmp_transaction (dev_list=dev_list@entry=0x7fffe7aef2e0, has_props=has_props@entry=false, props=<optimized out>, props@entry=0x0, errp=errp@entry=0x7fffe7aef398) at blockdev.c:2249
#7  0x0000562eecd4c3b4 in blockdev_do_action (errp=0x7fffe7aef398, action=0x7fffe7aef2d0) at blockdev.c:1257
#8  qmp_blockdev_snapshot_sync (has_device=<optimized out>, device=<optimized out>, has_node_name=<optimized out>, node_name=<optimized out>, snapshot_file=<optimized out>, has_snapshot_node_name=<optimized out>, snapshot_node_name=0x0, has_format=true, format=0x562eefbb85b8 "qcow2", has_mode=true, mode=NEW_IMAGE_MODE_ABSOLUTE_PATHS, errp=errp@entry=0x7fffe7aef398) at blockdev.c:1285
#9  0x0000562eecd592b1 in qmp_marshal_blockdev_snapshot_sync (args=<optimized out>, ret=<optimized out>, errp=0x7fffe7aef448) at qmp-marshal.c:1023
#10 0x0000562eecf3c189 in do_qmp_dispatch (errp=0x7fffe7aef440, request=0x562ef0438800, cmds=0x562eed53c420 <qmp_commands>) at qapi/qmp-dispatch.c:104
#11 qmp_dispatch (cmds=0x562eed53c420 <qmp_commands>, request=request@entry=0x562ef0438800) at qapi/qmp-dispatch.c:131
#12 0x0000562eecc791e7 in handle_qmp_command (parser=<optimized out>, tokens=<optimized out>) at /usr/src/debug/qemu-2.9.0/monitor.c:3850
#13 0x0000562eecf41618 in json_message_process_token (lexer=0x562eee50e088, input=0x562eee512580, type=JSON_RCURLY, x=170, y=5) at qobject/json-streamer.c:105
#14 0x0000562eecf5dd4b in json_lexer_feed_char (lexer=lexer@entry=0x562eee50e088, ch=125 '}', flush=flush@entry=false) at qobject/json-lexer.c:319
#15 0x0000562eecf5de0e in json_lexer_feed (lexer=0x562eee50e088, buffer=<optimized out>, size=<optimized out>) at qobject/json-lexer.c:369
#16 0x0000562eecf416d9 in json_message_parser_feed (parser=<optimized out>, buffer=<optimized out>, size=<optimized out>) at qobject/json-streamer.c:124
#17 0x0000562eecc7777b in monitor_qmp_read (opaque=<optimized out>, buf=<optimized out>, size=<optimized out>) at /usr/src/debug/qemu-2.9.0/monitor.c:3893
#18 0x0000562eecef8d1d in tcp_chr_read (chan=<optimized out>, cond=<optimized out>, opaque=<optimized out>) at chardev/char-socket.c:414
#19 0x00007f4e4d8004c9 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#20 0x0000562eecf46dec in glib_pollfds_poll () at util/main-loop.c:213
#21 os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:261
#22 main_loop_wait (nonblocking=nonblocking@entry=0) at util/main-loop.c:517
#23 0x0000562eecc3818c in main_loop () at vl.c:1909
#24 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4733

Comment 2 Eric Blake 2017-09-26 18:45:04 UTC
(In reply to Longxiang Lyu from comment #0)
> Description of problem:
> qemu hangs if shut down NBD service then make snapshot of the extra NBD disk.
> 
> Version-Release number of selected component (if applicable):
> kernel-3.10.0-709.el7.x86_64
> qemu-kvm-rhev-2.9.0-16.el7_4.8
> 
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1. use qemu to  export a disk as NBD driver
> # qemu-kvm -drive file=test.qcow2,format=raw,id=img0 -qmp
> tcp:0:5555,server,nowait -monitor stdio -incoming tcp:0:6666
> qmp:
> { "execute": "qmp_capabilities" }
> { "execute": "nbd-server-start", "arguments": { "addr": { "type": "inet",
> "data": { "host": "10.66.11.1", "port": "9000" } } } }
> { "execute": "nbd-server-add", "arguments": { "device": "img0", "writable":
> true } }

Can you reproduce the VM hanging by using qemu-nbd instead of qemu-kvm as the NBD export?
qemu-nbd -f raw test.qcow2 -p 9000 -x img0

> 
> 2. boot up a VM with the NBD image as additional driver
> ...
> -drive
> file=/home/test/streamnbd/test.raw,format=raw,if=none,cache=none,
> snapshot=off,rerror=stop,werror=stop,id=img0 \
> -device ide-hd,bus=ide.0,unit=0,drive=img0,id=ide-disk0,bootindex=0 \
> -drive
> file=nbd://10.66.11.1:9000/img0,format=qcow2,if=none,cache=none,snapshot=off,
> rerror=stop,werror=stop,id=img1 \
> -device ide-hd,bus=ide.0,unit=1,drive=img1,id=ide-disk1 \
> …
> 

This requests that on EIO error on the NBD drive, the guest should stop...

> 3. stop nbd service
> { "execute" : "nbd-server-stop", "arguments" : {} }

...and this should cause an EIO error on the next access to the NBD drive

> 
> 4. do snapshot of img1
> { "execute": "blockdev-snapshot-sync", "arguments": { "device": "img1",
> "snapshot-file": "/home/test/streamnbd/sn1.qcow2", "format": "qcow2",
> "mode": "absolute-paths" } }
> 
> 
> Actual results:
> guest hangs.
> nothing returns after the snapshot command.

I'm suspecting that this is yet another symptom of NBD client fixes that went in just before 2.10 was released; I'll try to reproduce it and double check whether this is a duplicate.

> 
> Expected results:
> guest functions normally and qemu should output error of snapshot

The guest may be stopped at this point (due to the werror policy), but the QMP monitor should remain responsive.

Comment 4 Eric Blake 2017-09-27 17:36:13 UTC
The set of NBD fixes that made it into 2.10 is incomplete compared to what I tested for fixing the bug in 2.9; therefore, even RHEL 7.5 will need backports (I'm waiting for the 7.5 build tree to open up). I'm adding 7.4.z?, since we probably also want this in z-stream.

The following commits on top of 2.9.0-16.el7_4.8 are needed:
already in 2.10:
72b6ffc7
d0a18013
d3d7d03f
missed 2.10:
3c2db183
6e592fc9
02d2d860
a6934370

Comment 6 Longxiang Lyu 2017-09-28 07:52:56 UTC
(In reply to Eric Blake from comment #2)
> (In reply to Longxiang Lyu from comment #0)
> > Description of problem:
> > qemu hangs if shut down NBD service then make snapshot of the extra NBD disk.
> > 
> > Version-Release number of selected component (if applicable):
> > kernel-3.10.0-709.el7.x86_64
> > qemu-kvm-rhev-2.9.0-16.el7_4.8
> > 
> > 
> > How reproducible:
> > 100%
> > 
> > Steps to Reproduce:
> > 1. use qemu to  export a disk as NBD driver
> > # qemu-kvm -drive file=test.qcow2,format=raw,id=img0 -qmp
> > tcp:0:5555,server,nowait -monitor stdio -incoming tcp:0:6666
> > qmp:
> > { "execute": "qmp_capabilities" }
> > { "execute": "nbd-server-start", "arguments": { "addr": { "type": "inet",
> > "data": { "host": "10.66.11.1", "port": "9000" } } } }
> > { "execute": "nbd-server-add", "arguments": { "device": "img0", "writable":
> > true } }
> 
> Can you reproduce the VM hanging by using qemu-nbd instead of qemu-kvm as
> the NBD export?
> qemu-nbd -f raw test.qcow2 -p 9000 -x img0
> 
> > 
> > 2. boot up a VM with the NBD image as additional driver
> > ...
> > -drive
> > file=/home/test/streamnbd/test.raw,format=raw,if=none,cache=none,
> > snapshot=off,rerror=stop,werror=stop,id=img0 \
> > -device ide-hd,bus=ide.0,unit=0,drive=img0,id=ide-disk0,bootindex=0 \
> > -drive
> > file=nbd://10.66.11.1:9000/img0,format=qcow2,if=none,cache=none,snapshot=off,
> > rerror=stop,werror=stop,id=img1 \
> > -device ide-hd,bus=ide.0,unit=1,drive=img1,id=ide-disk1 \
> > …
> > 
> 
> This requests that on EIO error on the NBD drive, the guest should stop...
> 
> > 3. stop nbd service
> > { "execute" : "nbd-server-stop", "arguments" : {} }
> 
> ...and this should cause an EIO error on the next access to the NBD drive
> 
> > 
> > 4. do snapshot of img1
> > { "execute": "blockdev-snapshot-sync", "arguments": { "device": "img1",
> > "snapshot-file": "/home/test/streamnbd/sn1.qcow2", "format": "qcow2",
> > "mode": "absolute-paths" } }
> > 
> > 
> > Actual results:
> > guest hangs.
> > nothing returns after the snapshot command.
> 
> I'm suspecting that this is yet another symptom of NBD client fixes that
> went in just before 2.10 was released; I'll try to reproduce it and double
> check whether this is a duplicate.
> 
> > 
> > Expected results:
> > guest functions normally and qemu should output error of snapshot
> 
> The guest may be stopped at this point (due to the werror policy), but the
> QMP monitor should remain responsive.


Yes, I could reproduce this with qemu-nbd.
1. export addition.qcow2
# qemu-nbd -f raw addition.qcow2 -p 9000 -t -x addition.qcow2

2. boot up a VM with addition.qcow2 as second disk
-drive file=/home/test/streamnbd/test.raw,format=raw,if=none,cache=none,snapshot=off,rerror=stop,werror=stop,id=img0 \
-device virtio-blk-pci,drive=img0,id=disk0,bootindex=0 \
-drive file=nbd://10.66.11.1:9000/addition.qcow2,format=qcow2,if=none,cache=none,snapshot=off,rerror=stop,werror=stop,id=img1 \
-device virtio-blk-pci,drive=img1,id=disk1 \

3. kill qemu-nbd
# kill -9 $(ps aux | grep qemu-nbd | head -n1 | awk '{ print $2 }')

4. do snapshot
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "img1", "snapshot-file": "/home/test/streamnbd/sn1.qcow2", "format": "qcow2", "mode": "absolute-paths" } }

result: qemu hangs

Comment 8 Eric Blake 2017-10-06 18:03:36 UTC

*** This bug has been marked as a duplicate of bug 1482478 ***


Note You need to log in before you can comment on or make changes to this bug.