[Libguestfs] [PATCH nbdkit v5 FINAL 10/19] offset: Implement mapping of extents.
Richard W.M. Jones
rjones at redhat.com
Tue Apr 23 18:51:18 UTC 2019
On Tue, Apr 23, 2019 at 12:36:05PM -0500, Eric Blake wrote:
> On 3/28/19 11:18 AM, Richard W.M. Jones wrote:
> > Allows you to safely use nbdkit-offset-filter on top of a plugin
> > supporting extents.
> > ---
> > filters/offset/offset.c | 36 ++++++++++++++++++++++++++++++++++++
> > 1 file changed, 36 insertions(+)
> >
>
> > +
> > + extents2 = nbdkit_extents_new (offs + offset, real_size - offset);
> > + if (extents2 == NULL) {
> > + *err = errno;
> > + return -1;
> > + }
>
> Here, we are careful to set *err.
>
> > + if (next_ops->extents (nxdata, count, offs + offset,
> > + flags, extents2, err) == -1)
> > + goto error;
>
> And here.
>
> > +
> > + for (i = 0; i < nbdkit_extents_count (extents2); ++i) {
> > + e = nbdkit_get_extent (extents2, i);
> > + e.offset -= offset;
> > + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1)
> > + goto error;
>
> But here, *err remains unchanged. Is this a problem? Should
> nbdkit_add_extent() guarantee that errno is sane on failure (right now,
> it does not)?
>
> Affects several filters.
Yes I'm pretty certain this is a bug. I guess because this jumps to
'error:' I copied the previous pattern and thus forgot to set *err ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list