qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 2c94e2: qemu-iotests: Extend non-shared stora


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 2c94e2: qemu-iotests: Extend non-shared storage migration ...
Date: Thu, 31 Aug 2017 06:33:14 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 2c94e2714c728354d2924c04dec97f12e31742ad
      
https://github.com/qemu/qemu/commit/2c94e2714c728354d2924c04dec97f12e31742ad
  Author: Kashyap Chamarthy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M tests/qemu-iotests/194
    M tests/qemu-iotests/194.out

  Log Message:
  -----------
  qemu-iotests: Extend non-shared storage migration test (194)

This is the follow-up patch that was discussed[*] as part of feedback to
qemu-iotest 194.

Changes in this patch:

  - Supply 'job-id' parameter to `drive-mirror` invocation.

  - Once migration completes, issue QMP `block-job-cancel` command on
    the source QEMU to gracefully complete `drive-mirror` operation.

  - Once the BLOCK_JOB_COMPLETED event is emitted, stop the NBD server
    on the destination QEMU.

  - Check for both the events: MIGRATION and BLOCK_JOB_COMPLETED.

With the above, the test will also be (almost) in sync with the
procedure outlined in the document 'live-block-operations.rst'[+]
(section: "QMP invocation for live storage migration with
``drive-mirror`` + NBD").

[*] https://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg04820.html
    -- qemu-iotests: add 194 non-shared storage migration test
[+] 
https://git.qemu.org/gitweb.cgi?p=qemu.git;a=blob;f=docs/interop/live-block-operations.rst

Signed-off-by: Kashyap Chamarthy <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: 3c2d5183f9fa4eac3d17d841e26da65a0181ae7b
      
https://github.com/qemu/qemu/commit/3c2d5183f9fa4eac3d17d841e26da65a0181ae7b
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M block/nbd-client.c

  Log Message:
  -----------
  nbd-client: avoid read_reply_co entry if send failed

The following segfault is encountered if the NBD server closes the UNIX
domain socket immediately after negotiation:

  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  aio_co_schedule (ctx=0x0, co=0xd3c0ff2ef0) at util/async.c:441
  441       QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
  (gdb) bt
  #0  0x000000d3c01a50f8 in aio_co_schedule (ctx=0x0, co=0xd3c0ff2ef0) at 
util/async.c:441
  #1  0x000000d3c012fa90 in nbd_coroutine_end (address@hidden, 
request=<optimized out>) at block/nbd-client.c:207
  #2  0x000000d3c012fb58 in nbd_client_co_preadv (bs=0xd3c0fec650, offset=0, 
bytes=<optimized out>, qiov=0x7ffc10a91b20, flags=0) at block/nbd-client.c:237
  #3  0x000000d3c0128e63 in bdrv_driver_preadv (address@hidden, address@hidden, 
address@hidden, address@hidden, flags=0) at block/io.c:836
  #4  0x000000d3c012c3e0 in bdrv_aligned_preadv (address@hidden, 
address@hidden, address@hidden, address@hidden, address@hidden, address@hidden, 
f
+lags=0) at block/io.c:1086
  #5  0x000000d3c012c6b8 in bdrv_co_preadv (child=0xd3c0ff51d0, address@hidden, 
address@hidden, address@hidden, address@hidden) at block/io.c:1182
  #6  0x000000d3c011cc17 in blk_co_preadv (blk=0xd3c0ff4f80, offset=0, 
bytes=512, qiov=0x7ffc10a91b20, flags=0) at block/block-backend.c:1032
  #7  0x000000d3c011ccec in blk_read_entry (opaque=0x7ffc10a91b40) at 
block/block-backend.c:1079
  #8  0x000000d3c01bbb96 in coroutine_trampoline (i0=<optimized out>, 
i1=<optimized out>) at util/coroutine-ucontext.c:79
  #9  0x00007f3196cb8600 in __start_context () at /lib64/libc.so.6

The problem is that nbd_client_init() uses
nbd_client_attach_aio_context() -> aio_co_schedule(new_context,
client->read_reply_co).  Execution of read_reply_co is deferred to a BH
which doesn't run until later.

In the mean time blk_co_preadv() can be called and nbd_coroutine_end()
calls aio_wake() on read_reply_co.  At this point in time
read_reply_co's ctx isn't set because it has never been entered yet.

This patch simplifies the nbd_co_send_request() ->
nbd_co_receive_reply() -> nbd_coroutine_end() lifecycle to just
nbd_co_send_request() -> nbd_co_receive_reply().  The request is "ended"
if an error occurs at any point.  Callers no longer have to invoke
nbd_coroutine_end().

This cleanup also eliminates the segfault because we don't call
aio_co_schedule() to wake up s->read_reply_co if sending the request
failed.  It is only necessary to wake up s->read_reply_co if a reply was
received.

Note this only happens with UNIX domain sockets on Linux.  It doesn't
seem possible to reproduce this with TCP sockets.

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: 6e592fc92234a58c7156c385840633c17dedd24f
      
https://github.com/qemu/qemu/commit/6e592fc92234a58c7156c385840633c17dedd24f
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M tests/qemu-iotests/nbd-fault-injector.py

  Log Message:
  -----------
  qemu-iotests: improve nbd-fault-injector.py startup protocol

Currently 083 waits for the nbd-fault-injector.py server to start up by
looping until netstat shows the TCP listen socket.

The startup protocol can be simplified by passing a 0 port number to
nbd-fault-injector.py.  The kernel will allocate a port in bind(2) and
the final port number can be printed by nbd-fault-injector.py.

This should make it slightly nicer and less TCP-specific to wait for
server startup.  This patch changes nbd-fault-injector.py, the next one
will rewrite server startup in 083.

Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: 02d2d860d25e439f0e88658c701668ab684568fb
      
https://github.com/qemu/qemu/commit/02d2d860d25e439f0e88658c701668ab684568fb
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M tests/qemu-iotests/083
    M tests/qemu-iotests/083.out
    M tests/qemu-iotests/common.filter

  Log Message:
  -----------
  qemu-iotests: test NBD over UNIX domain sockets in 083

083 only tests TCP.  Some failures might be specific to UNIX domain
sockets.

A few adjustments are necessary:

1. Generating a port number and waiting for server startup is
   TCP-specific.  Use the new nbd-fault-injector.py startup protocol to
   fetch the address.  This is a little more elegant because we don't
   need netstat anymore.

2. The NBD filter does not work for the UNIX domain sockets URIs we
   generate and must be extended.

3. Run all tests twice: once for TCP and once for UNIX domain sockets.

Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: a0acf3a8f716946d7c425870bd05bc6dfe7667a2
      
https://github.com/qemu/qemu/commit/a0acf3a8f716946d7c425870bd05bc6dfe7667a2
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M nbd/client.c

  Log Message:
  -----------
  nbd/client: fix nbd_opt_go

Do not send NBD_OPT_ABORT to the broken server. After sending
NBD_REP_ACK on NBD_OPT_GO server is most probably in transmission
phase, when option sending is finished.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: ab01df1fe21c013d1fd9e3f4c782430741c7dd33
      
https://github.com/qemu/qemu/commit/ab01df1fe21c013d1fd9e3f4c782430741c7dd33
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M nbd/client.c
    M nbd/nbd-internal.h
    M tests/qemu-iotests/083.out

  Log Message:
  -----------
  nbd/client: refactor nbd_read_eof

Refactor nbd_read_eof to return 1 on success, 0 on eof, when no
data was read and <0 for other cases, because returned size of
read data is not actually used.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
[eblake: tweak function comments, rebase to test 083 enhancements]
Signed-off-by: Eric Blake <address@hidden>


  Commit: ba8456442b597848fb5585273c47de8476c3a0c1
      
https://github.com/qemu/qemu/commit/ba8456442b597848fb5585273c47de8476c3a0c1
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M include/block/nbd.h
    M nbd/client.c

  Log Message:
  -----------
  nbd/client: refactor nbd_receive_reply

Refactor nbd_receive_reply to return 1 on success, 0 on eof, when no
data was read and <0 for other cases, because returned size of read
data is not actually used.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
[eblake: tweak function comments]
Signed-off-by: Eric Blake <address@hidden>


  Commit: 490dc5ed9bfbaf50ed8186c9729a81f530a11188
      
https://github.com/qemu/qemu/commit/490dc5ed9bfbaf50ed8186c9729a81f530a11188
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M include/block/nbd.h
    M nbd/client.c

  Log Message:
  -----------
  nbd/client: fix nbd_send_request to return int

Fix nbd_send_request to return int, as it returns a return value
of nbd_write (which is int), and the only user of nbd_send_request's
return value (nbd_co_send_request) consider it as int too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: 6faa077772db366e5d2198ec0a14a50d0ccde1c6
      
https://github.com/qemu/qemu/commit/6faa077772db366e5d2198ec0a14a50d0ccde1c6
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M block/nbd-client.c

  Log Message:
  -----------
  block/nbd-client: get rid of ssize_t

Use int variable for nbd_co_send_request return value (as
nbd_co_send_request returns int).

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>


  Commit: 07b1b99c78e4b9479922fbe2d05a87ef810e6b7e
      
https://github.com/qemu/qemu/commit/07b1b99c78e4b9479922fbe2d05a87ef810e6b7e
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M block/nbd-client.c

  Log Message:
  -----------
  block/nbd-client: rename nbd_recv_coroutines_enter_all

Rename nbd_recv_coroutines_enter_all to nbd_recv_coroutines_wake_all,
as it most probably just adds all recv coroutines into co_queue_wakeup,
rather than directly enter them.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
[eblake: tweak commit message]
Signed-off-by: Eric Blake <address@hidden>


  Commit: f35dff7e13b84d3fffe1103c2c69afd81df5e4f5
      
https://github.com/qemu/qemu/commit/f35dff7e13b84d3fffe1103c2c69afd81df5e4f5
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-30 (Wed, 30 Aug 2017)

  Changed paths:
    M block/nbd-client.c

  Log Message:
  -----------
  block/nbd-client: refactor request send/receive

Add nbd_co_request, to remove code duplications in
nbd_client_co_{pwrite,pread,...} functions. Also this is
needed for further refactoring.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
[eblake: make nbd_co_request a wrapper, rather than merging two
existing functions]
Signed-off-by: Eric Blake <address@hidden>


  Commit: 2e75021eb64485f7a7cec98d18f40650516641d0
      
https://github.com/qemu/qemu/commit/2e75021eb64485f7a7cec98d18f40650516641d0
  Author: Peter Maydell <address@hidden>
  Date:   2017-08-31 (Thu, 31 Aug 2017)

  Changed paths:
    M block/nbd-client.c
    M include/block/nbd.h
    M nbd/client.c
    M nbd/nbd-internal.h
    M tests/qemu-iotests/083
    M tests/qemu-iotests/083.out
    M tests/qemu-iotests/194
    M tests/qemu-iotests/194.out
    M tests/qemu-iotests/common.filter
    M tests/qemu-iotests/nbd-fault-injector.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-08-30' into 
staging

nbd patches for 2017-08-30

- Kashyap Chamarthy: qemu-iotests: Extend non-shared storage migration test 
(194)
- Stefan Hajnaczi: 0/3 nbd-client: enter read_reply_co during init to avoid 
crash
- Vladimir Sementsov-Ogievskiy: portions of 0/17 nbd client refactoring and 
fixing

# gpg: Signature made Wed 30 Aug 2017 19:03:46 BST
# gpg:                using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <address@hidden>"
# gpg:                 aka "Eric Blake (Free Software Programmer) 
<address@hidden>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2017-08-30:
  block/nbd-client: refactor request send/receive
  block/nbd-client: rename nbd_recv_coroutines_enter_all
  block/nbd-client: get rid of ssize_t
  nbd/client: fix nbd_send_request to return int
  nbd/client: refactor nbd_receive_reply
  nbd/client: refactor nbd_read_eof
  nbd/client: fix nbd_opt_go
  qemu-iotests: test NBD over UNIX domain sockets in 083
  qemu-iotests: improve nbd-fault-injector.py startup protocol
  nbd-client: avoid read_reply_co entry if send failed
  qemu-iotests: Extend non-shared storage migration test (194)

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/1415e8ea1fa2...2e75021eb644

reply via email to

[Prev in Thread] Current Thread [Next in Thread]