Wietse Venema: > Mark Martinec: > > On Friday 13 November 2009 18:52:03 Wietse Venema wrote: > > > 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). > > Victor found it (missing fflush before ftruncate). If you can back > out the changes and apply the patch below. >
To be really safe, replace vstream_fflush(stream) by (vstream_bufstat(stream, VSTREAM_BST_OUT_PEND) && vstream_fflush(stream)). Wietse *** ./smtpd_proxy.c.orig Mon Nov 9 19:41:50 2009 --- ./smtpd_proxy.c Fri Nov 13 13:29:55 2009 *************** *** 1030,1035 **** --- 1030,1041 ---- (p)->a10, (p)->a11, (p)) /* + * Sanity check. + */ + if (state->proxy != 0) + msg_panic("smtpd_proxy_create: handle still exists"); + + /* * Connect to the before-queue filter immediately. */ if ((flags & SMTPD_PROXY_FLAG_SPEED_ADJUST) == 0) { *************** *** 1126,1132 **** */ if (smtpd_proxy_replay_stream == 0) return; ! if (vstream_ferror(smtpd_proxy_replay_stream)) { (void) vstream_fclose(smtpd_proxy_replay_stream); smtpd_proxy_replay_stream = 0; return; --- 1132,1140 ---- */ if (smtpd_proxy_replay_stream == 0) return; ! if ((vstream_bufstat(smtpd_proxy_replay_stream, VSTREAM_BST_OUT_PEND) > 0 ! && vstream_fflush(smtpd_proxy_replay_stream) != 0) ! || vstream_ferror(smtpd_proxy_replay_stream)) { (void) vstream_fclose(smtpd_proxy_replay_stream); smtpd_proxy_replay_stream = 0; return;