On Wed, 29.12.10 00:12, Tom Gundersen ([email protected]) wrote:

> Avoids data loss when systemd freezes and a hard-reset is required.

Hmm, I figure it might make more sense putting the sync() call right in
the freeze() function, since there's probably no reason ever to call
freeze() without implying a sync()?

> ---
>  src/main.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/main.c b/src/main.c
> index 99e277c..82c8ddb 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -169,6 +169,7 @@ _noreturn_ static void crash(int sig) {
>                  log_info("Successfully spawned crash shall as pid %lu.", 
> (unsigned long) pid);
>          }
>  
> +        sync();
>          log_info("Freezing execution.");
>          freeze();
>  }
> @@ -1297,8 +1298,10 @@ finish:
>                  log_error("Failed to execute shutdown binary, freezing: %m");
>          }
>  
> -        if (getpid() == 1)
> +        if (getpid() == 1) {
> +                sync();
>                  freeze();
> +     }
>  
>          return retval;
>  }


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to