[Libguestfs] [PATCH libnbd 2/2] examples: copy-libev.c: Fix error handling

Nir Soffer nsoffer at redhat.com
Sun Jan 30 16:52:00 UTC 2022


On Thu, Jan 27, 2022 at 8:36 PM Eric Blake <eblake at redhat.com> wrote:
>
> On Thu, Jan 27, 2022 at 01:49:31AM +0200, Nir Soffer wrote:
> > This example failed to check the *error parameter to the completion and
> > extent callbacks.
> >
> > - If the source NBD server failed a read, we wrote stale data from the
> >   request buffer to the destination image, corrupting the
> >   image.
> >
> > - If the destination NBD server failed a write or zero command, we
> >   ignored the error, leaving previous content on the destination image,
> >   corrupting the image.
> >
> > - Error in the extents callbacks were ignored. I'm not sure if this was
> >   a real problem, but it is a very bad example.
> >
> > In all cases, the copy would end with zero exit code creating a
> > corrupted image.
>
> Oh well.  This silent data corruption affects more than copy-libev.c;

Right, this issue should be fixed in nbdcopy, many examples, and
some tests. I started with this example since it was easier for me,
and I know you are working on nbdcopy fix.

Nir




More information about the Libguestfs mailing list