K 10 svn:author V 5 gibbs K 8 svn:date V 27 2012-05-30T00:27:12.382405Z K 7 svn:log V 1809 Properly terminate truncated events with a newline (end of event token), and discard any data that exceeds zfsd's MAX_EVENT_SIZE limit until zfsd is resynchronized with the event stream. This resolves issues (de)serializing CaseFiles with truncated events. cddl/sbin/zfsd/case_file.cc: Do not assume that deserialization of all events from a case file will be successful. Just skip over unparsable events. cddl/sbin/zfsd/zfsd.cc: cddl/sbin/zfsd/zfsd.h: o In EventBuffer::ExtractEvent(), remove code and a comment dealing with "start tokens" and "end tokens" sharing characters. In the normal case of untruncated events, the event terminator is present and distinct from the start token. Devd immediately closes our unix domain socket if it cannot write a complete event, which means a start token for a new event after a truncted event cannot happen. o In EventBuffer::ExtractEvent(), remove dead code that tested for end of event tokens other than '\n'. Due to the way that strcspn() operates, this cannot happen. o Add stateful resynchronization to the EventBuffer class. EventBuffer can get out of synch whenever it truncates an incoming event due to its internal event size limit. The original code dealt with this issue by looking for start tokens. Since start tokens may also be valid within an event body, the only fully safe option is to discard data until the end of event token (which can't occur within an event) is read. o When truncating an event, properly terminate it so that when EventBuffer is used for CaseFile deserialization the input data is properly formed. o EventBuffer::UnParsed() and EventBuffer::NextEventMaxLen() are const. Enforce this via the const keyword. Sponsored by: Spectra Logic Corporation END