Thanks for the logging. If you have time, can you change the code to print information about the non-zero size? This could be a filesystem feature where ftruncate() does not reset st_size until the file is rewritten or closed (in which case my attempt to force easly release of disk blocks are in vain).
Otherwise, I'll try some experiments over the weekend. Wietse *** ./smtpd_proxy.c.orig Mon Nov 9 19:41:50 2009 --- ./smtpd_proxy.c Fri Nov 13 12:44:46 2009 *************** *** 975,983 **** (void) vstream_fclose(smtpd_proxy_replay_stream); smtpd_proxy_replay_stream = 0; } else { ! if (st.st_size > 0) ! msg_panic("%s: non-empty before-queue filter speed-adjust log", ! myname); vstream_clearerr(smtpd_proxy_replay_stream); if (msg_verbose) msg_info("%s: reuse speed-adjust stream fd=%d", myname, --- 975,992 ---- (void) vstream_fclose(smtpd_proxy_replay_stream); smtpd_proxy_replay_stream = 0; } else { ! /* This file system does not reset st_size after ftruncate(). */ ! if (st.st_size > 0) { ! msg_warn("%s: non-zero speed-adjust logfile size: %lu", ! myname, (unsigned long) st.st_size); ! if (ftruncate(vstream_fileno(smtpd_proxy_replay_stream), (off_t) 0) < 0) { ! msg_warn("truncate before-queue filter speed-adjust log: %m"); ! (void) vstream_fclose(smtpd_proxy_replay_stream); ! smtpd_proxy_replay_stream = 0; ! } ! } ! } ! if (smtpd_proxy_replay_stream != 0) { vstream_clearerr(smtpd_proxy_replay_stream); if (msg_verbose) msg_info("%s: reuse speed-adjust stream fd=%d", myname,