NBD patches through 2020-10-08
The following changes since commit 497d415d76b9f59fcae27f22df1ca2c3fa4df64e:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20201008-1' into staging (2020-10-08 21:41:20 +0100)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2020-10-08-v2
for you to fetch changes up to 351a587410eff515ee28da619867030217b62457:
nbd: Simplify meta-context parsing (2020-10-09 08:34:15 -0500)
v2: fix BSD compilation error
----------------------------------------------------------------
nbd patches for 2020-10-08
- silence compilation warnings
- more fixes to prevent reconnect hangs
- improve 'qemu-nbd' termination behavior
- cleaner NBD protocol compliance on string handling
----------------------------------------------------------------
Christian Borntraeger (1):
nbd: silence maybe-uninitialized warnings
Eric Blake (3):
qemu-nbd: Honor SIGINT and SIGHUP nbd/server: Reject embedded NUL in NBD strings
nbd: Simplify meta-context parsing
Vladimir Sementsov-Ogievskiy (4):
block/nbd: fix drain dead-lock because of nbd reconnect-delay block/nbd: correctly use qio_channel_detach_aio_context when needed block/nbd: fix reconnect-delay
block/nbd: nbd_co_reconnect_loop(): don't connect if drained
block/nbd.c | 71 ++++++++++++++++--- nbd/server.c | 221 ++++++++++++++++++++++++----------------------------------- qemu-nbd.c | 15 ++-- 3 files changed, 157 insertions(+), 150 deletions(-)
Signature · 1 line
2.28.0
[PULL v2 6/8] qemu-nbd: Honor SIGINT and SIGHUP
Honoring just SIGTERM on Linux is too weak; we also want to handle other common signals, and do so even on BSD. Why? Because at least 'qemu-nbd -B bitmap' needs a chance to clean up the in-use bit on bitmaps when the server is shut down via a signal.
See also: http://bugzilla.redhat.com/1883608
Message-Id: <[email protected]>
[eblake: apply comment tweak suggested by Vladimir; fix ifdef around termsig_handler]
--- qemu-nbd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
qemu-nbd.c +8 -7
@@ -154,13 +154,13 @@ QEMU_COPYRIGHT "\n" , name); } -#if HAVE_NBD_DEVICE +#if CONFIG_POSIX static void termsig_handler (int signum) {qatomic_cmpxchg (&state,RUNNING ,TERMINATE );qemu_notify_event (); } -#endif /* HAVE_NBD_DEVICE */ +#endif /* CONFIG_POSIX */ static int qemu_nbd_client_list (SocketAddress *saddr,QCryptoTLSCreds *tls,const char *hostname)
@@ -581,17 +581,18 @@ int main(int argc, char **argv)const char *pid_file_name =NULL ;BlockExportOptions *export_opts; -#if HAVE_NBD_DEVICE -/* The client thread uses SIGTERM to interrupt the server. A signal -* handler ensures that "qemu-nbd -v -c" exits with a nice status code. +#ifdef CONFIG_POSIX +/* +* Exit gracefully on various signals, which includes SIGTERM used +* by 'qemu-nbd -v -c'. */ struct sigaction sa_sigterm;memset (&sa_sigterm,0 ,sizeof (sa_sigterm)); sa_sigterm.sa_handler = termsig_handler;sigaction (SIGTERM , &sa_sigterm,NULL ); -#endif /* HAVE_NBD_DEVICE */ +sigaction (SIGINT , &sa_sigterm,NULL ); +sigaction (SIGHUP , &sa_sigterm,NULL ); -#ifdef CONFIG_POSIX signal (SIGPIPE ,SIG_IGN );#endif
Signature · 1 line
2.28.0
Quoted 7 lines · Eric Blake
The following changes since commit
497d415d76b9f59fcae27f22df1ca2c3fa4df64e:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20201008-1' into staging (2020-10-08 21:41:20 +0100)
are available in the Git repository at:
Quoted 7 lines
https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2020-10-08-v2
for you to fetch changes up to
351a587410eff515ee28da619867030217b62457:nbd: Simplify meta-context parsing (2020-10-09 08:34:15 -0500)
v2: fix BSD compilation error
Compile failure on Windows:../../qemu-nbd.c:157:5: error: "CONFIG_POSIX" is not defined [-Werror=undef]
#if CONFIG_POSIX
^thanks
-- PMM
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Eric Blake
The following changes since commit
497d415d76b9f59fcae27f22df1ca2c3fa4df64e:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20201008-1' into staging (2020-10-08 21:41:20 +0100)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2020-10-08-v2
for you to fetch changes up to
351a587410eff515ee28da619867030217b62457:
Quoted 8 lines
Quoted 3 lines
nbd: Simplify meta-context parsing (2020-10-09 08:34:15 -0500)
v2: fix BSD compilation error
Compile failure on Windows:
../../qemu-nbd.c:157:5: error: "CONFIG_POSIX" is not defined [-Werror=undef]#if CONFIG_POSIX ^
Oh, everywhere else uses #ifdef. Urgh. v3 coming up.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org