io: Make queue_io_read() safe for reentry
authorDavid Disseldorp <ddiss@suse.de>
Sun, 31 Jul 2011 01:14:54 +0000 (03:14 +0200)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 5 Aug 2011 04:28:43 +0000 (14:28 +1000)
commit8ec198b2fd2d33420714a154af99417c31cb6a9c
treeb4f68b42eb843ecaffbe84adf1ddf94922c73449
parentb335a9c97c890641971e0ca667966a9e3d13d831
io: Make queue_io_read() safe for reentry

queue_io_read() may be reentered via the queue callback, recoverd is
particularly guilty of this.

queue_io_read() is not safe for reentry if more than one packet is
received and partial chunks follow - data read off the pipe on re-entry
is assumed to be the start-of-packet four byte length. This leads to a
wrongly aligned stream and the notorious "Invalid packet of length 0"
errors.

This change fixes queue_io_read() to be safe under reentry, only a
single packet is processed per call.

https://bugzilla.samba.org/show_bug.cgi?id=8319
common/ctdb_io.c