Richard W.M. Jones
2023-Jun-12 18:27 UTC
[Libguestfs] [PATCH libnbd 1/2] info: Avoid calling nbd_opt_abort if not in option negotiation mode
This change avoids the following harmless but annoying warning on the normal exit path: libnbd: debug: nbd1: nbd_opt_abort: enter: libnbd: debug: nbd1: nbd_opt_abort: leave: error="nbd_opt_abort: invalid state: READY: the handle must be negotiating: Invalid argument" --- info/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/info/main.c b/info/main.c index 1b99e08966..c6b3fca0f8 100644 --- a/info/main.c +++ b/info/main.c @@ -136,6 +136,7 @@ main (int argc, char *argv[]) size_t output_len = 0; bool content_flag = false, no_content_flag = false; bool list_okay = true; + bool opt_mode = false; progname = argv[0]; colour = isatty (STDOUT_FILENO); @@ -278,7 +279,8 @@ main (int argc, char *argv[]) nbd_set_uri_allow_local_file (nbd, true); /* Allow ?tls-psk-file. */ /* Set optional modes in the handle. */ - if (!can && !map && !size_only) { + opt_mode = !can && !map && !size_only; + if (opt_mode) { nbd_set_opt_mode (nbd, true); nbd_set_full_info (nbd, true); } @@ -345,7 +347,8 @@ main (int argc, char *argv[]) } free_exports (); - nbd_opt_abort (nbd); + if (opt_mode) + nbd_opt_abort (nbd); nbd_shutdown (nbd, 0); nbd_close (nbd); -- 2.40.1
Eric Blake
2023-Jun-12 19:32 UTC
[Libguestfs] [PATCH libnbd 1/2] info: Avoid calling nbd_opt_abort if not in option negotiation mode
On Mon, Jun 12, 2023 at 07:27:52PM +0100, Richard W.M. Jones wrote:> This change avoids the following harmless but annoying warning on the > normal exit path: > > libnbd: debug: nbd1: nbd_opt_abort: enter: > libnbd: debug: nbd1: nbd_opt_abort: leave: error="nbd_opt_abort: invalid state: READY: the handle must be negotiating: Invalid argument" > --- > info/main.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-)Reviewed-by: Eric Blake <eblake at redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Possibly Parallel Threads
- [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
- [libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
- [libnbd PATCH 0/2] NBD_OPT_INFO support
- [PATCH libnbd 0/2] Two simple patches
- [libnbd PATCH v2 06/13] api: Add nbd_opt_abort and nbd_aio_opt_abort