[PATCH] CTDB fixes in sock_daemon and socket I/O code

Martin Schwenke martin at meltin.net
Thu Jan 5 03:40:43 UTC 2017


On Thu, 5 Jan 2017 11:06:43 +1100, Amitay Isaacs <amitay at gmail.com>
wrote:

> On Thu, Jan 5, 2017 at 9:45 AM, Martin Schwenke <martin at meltin.net> wrote:
> 
> > On Thu, 5 Jan 2017 00:54:30 +1100, Amitay Isaacs <amitay at gmail.com>
> > wrote:
> >  
> > > Here are the fixes to sock_daemon and sock_io abstractions with tests.
> > >
> > > This should fix the flakey ctdb autobuild.
> > >
> > > Please review and push.  
> >
> > The 4th commit breaks the -O3 developer build:
> >
> > [194/292] Compiling tests/src/sock_io_test.c
> > ../tests/src/sock_io_test.c: In function ‘test1_writer’:
> > ../tests/src/sock_io_test.c:64:3: error: dereferencing type-punned
> > pointer will break strict-aliasing rules [-Werror=strict-aliasing]
> >    *(uint32_t *)buf = buflen;
> >    ^
> > ../tests/src/sock_io_test.c: In function ‘test2_writer’:
> > ../tests/src/sock_io_test.c:195:3: error: dereferencing type-punned
> > pointer will break strict-aliasing rules [-Werror=strict-aliasing]
> >    *(uint32_t *)buf = buflen;
> >    ^
> > cc1: all warnings being treated as errors
> >
> > :-(
> >
> >  
> Good catch.  Here are the patches again with fixes for O3 build.
> 
> Also pushed to my ctdb-eventd branch.

Looks good.  Can we please add some details to the commit message for
commit #3?  It took me a long time to understand what the problem was.
Now that I understand it, it is blindingly obvious...  but it hurt my
brain!  :-)

Something like:

  queue->offset currently points to the end of available data.
  However, it is mistakenly also treated like the beginning of
  subsequent data by adding the packet size after processing a
  packet.  Instead, use queue->end to point to the end of available
  data and queue->begin to point to the beginning of unprocessed data.

With an improved commit message...

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

I won't push right now because I'm about to post another important
fix...  :-)

peace & happiness,
martin



More information about the samba-technical mailing list