X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ffsck%2Ffsck.c;h=0b572e59f5ab387a11cfb8e6746a093fae7abd8c;hb=8501384436b410cb9f5929ef6873c59fac6254be;hp=5ed837dffbeb58a545e926afba4485b2c6963bef;hpb=eb66db55fc4b342e4253065886e0cc0419c45a07;p=elogind.git diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index 5ed837dff..0b572e59f 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -4,6 +4,7 @@ This file is part of systemd. Copyright 2010 Lennart Poettering + Copyright 2014 Holger Hans Peter Freyther systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -42,6 +43,7 @@ static bool arg_skip = false; static bool arg_force = false; static bool arg_show_progress = false; +static const char *arg_repair = "-a"; static void start_target(const char *target) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; @@ -84,13 +86,25 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { else if (streq(value, "skip")) arg_skip = true; else - log_warning("Invalid fsck.mode= parameter. Ignoring."); - } else if (startswith(key, "fsck.")) - log_warning("Invalid fsck parameter. Ignoring."); + log_warning("Invalid fsck.mode= parameter '%s'. Ignoring.", value); + + } else if (streq(key, "fsck.repair") && value) { + + if (streq(value, "preen")) + arg_repair = "-a"; + else if (streq(value, "yes")) + arg_repair = "-y"; + else if (streq(value, "no")) + arg_repair = "-n"; + else + log_warning("Invalid fsck.repair= parameter '%s'. Ignoring.", value); + } + #ifdef HAVE_SYSV_COMPAT else if (streq(key, "fastboot") && !value) { log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line."); arg_skip = true; + } else if (streq(key, "forcefsck") && !value) { log_warning("Please pass 'fsck.mode=force' rather than 'forcefsck' on the kernel command line."); arg_force = true; @@ -101,6 +115,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { } static void test_files(void) { + #ifdef HAVE_SYSV_COMPAT if (access("/fastboot", F_OK) >= 0) { log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system."); @@ -289,10 +304,12 @@ int main(int argc, char *argv[]) { r = fsck_exists(type); if (r < 0) { if (r == -ENOENT) { - log_info("fsck.%s doesn't exist, not checking file system.", type); + log_info("fsck.%s doesn't exist, not checking file system on %s", + type, device); return EXIT_SUCCESS; } else - log_warning("fsck.%s cannot be used: %s", type, strerror(-r)); + log_warning("fsck.%s cannot be used for %s: %s", + type, device, strerror(-r)); } } @@ -303,9 +320,20 @@ int main(int argc, char *argv[]) { } cmdline[i++] = "/sbin/fsck"; - cmdline[i++] = "-a"; + cmdline[i++] = arg_repair; cmdline[i++] = "-T"; - cmdline[i++] = "-l"; + + /* + * Disable locking which conflict with udev's event + * ownershipi, until util-linux moves the flock + * synchronization file which prevents multiple fsck running + * on the same rotationg media, from the disk device + * node to a privately owned regular file. + * + * https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5 + * + * cmdline[i++] = "-l"; + */ if (!root_directory) cmdline[i++] = "-M";