Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] ext4fs reliability bug

2009-03-21 by Greg Troxel

manu@... writes:

> Greg Troxel <gdt@...> wrote:
>
>> fflush()
>> fsync()
>> fclose()
>
> So we would do that?
>
> Index: dump.c
> ===================================================================
> RCS file: /milter-greylist/milter-greylist/dump.c,v
> retrieving revision 1.35
> diff -U2 -r1.35 dump.c
> --- dump.c 29 Dec 2007 19:06:49 -0000 1.35
> +++ dump.c 20 Mar 2009 20:30:02 -0000
> @@ -288,5 +288,13 @@
> "whitelisted\n#\n", done, greylisted_count,
> whitelisted_count);
>
> - Fclose(dump);
> + /*
> + * Ensure that the data is really flushed to disk.
> + * Some systems might delay the data write from kernel buffer
> + * to disk even after the file is closed
> + */
> + (void)fflush(dump);
> + (void)fsync(fileno(dump));
> + (void)Fclose(dump);
> +
> if (s_buffer)
> free(s_buffer);

Yes, looks good. This isn't frequent, so it shouldn't hurt enough to
motivate figuring out how to not do it sometimes.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.