[systemd-devel] [PATCH] fstab-generator: fsck /sysroot before we mount it rw

Tom Gundersen teg at jklm.no
Wed Mar 13 01:53:49 PDT 2013


This looks good. However, how do you deal with btrfs? Instal a fake fsck?

On Mar 8, 2013 2:14 AM, <harald at redhat.com> wrote:
>
> From: Harald Hoyer <harald at redhat.com>
>
> ---
>  src/fstab-generator/fstab-generator.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/fstab-generator/fstab-generator.c
b/src/fstab-generator/fstab-generator.c
> index 910bbc1..b5fe0fa 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -449,6 +449,7 @@ static int parse_new_root_from_proc_cmdline(void) {
>          char *w, *state;
>          _cleanup_free_ char *what = NULL, *type = NULL, *opts = NULL,
*line = NULL;
>          int r;
> +        int fsck_passno = 0;
>          size_t l;
>
>          r = read_one_line_file("/proc/cmdline", &line);
> @@ -490,7 +491,16 @@ static int parse_new_root_from_proc_cmdline(void) {
>                          if (!opts)
>                                  return log_oom();
>
> -                } else if (streq(word, "ro") || streq(word, "rw")) {
> +                } else if (streq(word, "ro")) {
> +                        fsck_passno = 0;
> +                        tmp_word = opts;
> +                        opts = strjoin(opts, ",", word, NULL);
> +                        free(tmp_word);
> +                        if (!opts)
> +                                return log_oom();
> +
> +                } else if (streq(word, "rw")) {
> +                        fsck_passno = 1;
>                          tmp_word = opts;
>                          opts = strjoin(opts, ",", word, NULL);
>                          free(tmp_word);
> @@ -513,7 +523,7 @@ static int parse_new_root_from_proc_cmdline(void) {
>          }
>
>          log_debug("Found entry what=%s where=/sysroot type=%s", what,
type);
> -        r = add_mount(what, "/sysroot", type, opts, 0, false, false,
false,
> +        r = add_mount(what, "/sysroot", type, opts, fsck_passno, false,
false, false,
>                        false, false, "/proc/cmdline");
>
>          return (r < 0) ? r : 0;
> --
> 1.8.1
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130313/39e6f88b/attachment.html>


More information about the systemd-devel mailing list