[PATCH] ctdb: Introduce buffer.offset to avoid memmove

Martin Schwenke martin at meltin.net
Wed Aug 29 04:47:48 UTC 2018


Hi Swen,

On Tue, 21 Aug 2018 14:54:34 +0200, Swen Schillig <swen at vnet.ibm.com>
wrote:

> I found an error in the below patch.
> On Mon, 2018-08-13 at 16:52 +1000, Martin Schwenke wrote:
> > Hi Swen,
> > 
> > On Fri, 10 Aug 2018 10:13:26 +0200, Swen Schillig <swen at vnet.ibm.com>
> > wrote:
> >   
> > > Very good, slowly but surely we're making progress :-)
> > > Brilliant !
> > > 
> > > I incorporated all your suggestions and updated the patch.
> > > 
> > > Please have a look and let me know if that's ok.  
> > 
> > Thanks.  Looks good to me!
> > 
> > Reviewed-by: Martin Schwenke <martin at meltin.net>
> > 
> > Another team reviewer please?

> In the rare situation where we read an incomplete message and have to
> return to the queue_io_read routine to fetch the remaining data,
> we have to account for the buffer.offset as well when adding this data
> to the buffer.
> Therefore, this has to be updated
> 		nread = sys_read(queue->fd,
> 				 queue->buffer.data + queue->buffer.length,
> 				 num_ready);
> 
> to 
>                 nread = sys_read(queue->fd,
>                                 queue->buffer.data + queue->buffer.length,
>                                 queue->buffer.data +
>                                        queue->buffer.offset +
>                                        queue->buffer.length,
>                                  num_ready);
> 
> Sorry for the inconvenience.
> 
> Please review again...and push.

Yep, everywhere queue->buffer.data is referenced to handle packet
contents, it needs to have queue->buffer.offset added.

Sorry I missed that in review.  Thanks for catching it before it got
pushed.

Reviewed-by: Martin Schwenke <martin at meltin.net>

Another team reviewer please?

Thanks...

peace & happiness,
martin



More information about the samba-technical mailing list