[Libguestfs] [libnbd PATCH 0/4] Work towards fixing nbdcopy silent corruption

Eric Blake eblake at redhat.com
Tue Feb 1 19:44:46 UTC 2022


These are the trivial patches modeled after Nir's commit 7ba6ef67,
fixing further places that fail to check *error during callbacks.
nbdcopy still has a bigger bug in that it is NOT properly checking for
*error in the pread/pwrite completion handlers, but fixing that
gracefully (rather than just quitting the process immediately, as we
can do in the examples), requires more invasive patches which I will
be posting separately for review, while the ones posted here are
trivial enough that I'm pushing them now (commits 23bcea4a..1373d423).

I also audited other uses of completion callbacks:
- in tests, closure-lifetimes, errors, server-death, and
  shutdown-flags are all safe (either the callback returns 0 and the
  code later calls nbd_aio_command_completed, or we are explicitly
  testing aspects of completion callbacks)
- in fuse/operations.c, the completion callback returns 0 and calls
  nbd_aio_command_completed later
- in examples/strict-structured-reads.c, the completion callback
  properly checks *error

I also checked that nbdkit's nbd plugin properly checks *error.

Eric Blake (4):
  examples: aio-connect-read.c: Fix error handling
  examples: glib-main-loop: don't strand commands when gsource
    disappears
  examples: glib-main-loop: Fix error handling
  copy: Ignore extents if we encountered earlier error

 examples/aio-connect-read.c |  7 +++++++
 examples/glib-main-loop.c   | 14 ++++++++++++--
 copy/nbd-ops.c              |  4 ++--
 3 files changed, 21 insertions(+), 4 deletions(-)

-- 
2.34.1




More information about the Libguestfs mailing list