[systemd-devel] [PATCH] [RFCv2 (typos)] Add sync timer to journal server

Lennart Poettering lennart at poettering.net
Mon Mar 18 06:32:22 PDT 2013


On Sat, 16.03.13 18:45, Oleksii Shevchuk (alxchk at gmail.com) wrote:

> +int journal_file_sync(JournalFile *f) {
> +        if (! (f->writable && f->fd >= 0))
> +                return -1;
> +
> +        if (fdatasync(f->fd))
> +                return -errno;
> +
> +        return 0;
> +}

I'd really prefer if we'd go much further here, and actually
"soft-close" the file, i.e. unmark it as "dirty" in the header, so that
it would be considered "clean" on a hard reset after the syncing...

> +                if (sfsi.ssi_signo == SIGALRM) {

Using signal-based wakeups isn't really that nice. Please use timerfd()
instead. SIGALRM is an awful API and can only have a single owner
really, so we really shouldn't use it unless we really have no other
option. timerfd() is not exclusive, and much nicer, so please use that.


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list