summaryrefslogtreecommitdiff
path: root/src/fsck/fsck.c
Commit message (Collapse)AuthorAgeFilesLines
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2015-07-031-1/+1
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering2015-06-101-2/+2
| | | | | | | | | | mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
* util: split out signal-util.[ch] from util.[ch]Lennart Poettering2015-05-291-0/+1
| | | | No functional changes.
* fsck: add enum with fsck exit codesThomas Hindoe Paaboel Andersen2015-05-121-4/+16
|
* fsck: remove fsckd again, but keep the door open for external replacementLennart Poettering2015-04-281-89/+165
| | | | | | | | | | | | | | | | | For a longer discussion see this: http://lists.freedesktop.org/archives/systemd-devel/2015-April/030175.html This introduces /run/systemd/fsck.progress as a simply AF_UNIX/SOCK_STREAM socket. If it exists and is connectable we'll connect fsck's -c switch with it. If external programs want to get progress data they should hence listen on this socket and will get all they need via that socket. To get information about the connecting fsck client they should use SO_PEERCRED. Unless /run/systemd/fsck.progress is around and connectable this change reverts back to v219 behaviour where we'd forward fsck output to /dev/console on our own.
* fsck: minor improvementsLennart Poettering2015-04-281-9/+16
| | | | | Among other smaller fixes, explicitly check if we are invoked on a block device before making use of st.st_rdev.
* fsck: parse kernel cmdline booleans the same ways as the restLennart Poettering2015-04-281-7/+13
|
* shared: add process-util.[ch]Ronny Chevalier2015-04-101-0/+1
|
* fsck: port from libudev to sd-deviceTom Gundersen2015-04-021-21/+14
|
* fsck: use %zu for size_tThomas Hindoe Paaboel Andersen2015-03-191-1/+1
| | | | | cur and max were changed to size_t in ac6e2f0dfc2e800f01c79ecea2b811914110a7b9 update the format accordingly.
* fsck: modernize error handlingLennart Poettering2015-03-091-26/+36
|
* fsck: use _cleanup_close_pair_ where appropriateLennart Poettering2015-03-091-4/+2
|
* fsck: remove unnecessary checkZbigniew Jędrzejewski-Szmek2015-03-031-10/+5
| | | | | | gcc was complaining that progress_rc might be used uninitalized. But it was actually always set, because the condition was always satisfied. Remove the condition.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-2/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* Connect to plymouth and support cancellation of in progress fsckDidier Roche2015-02-181-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | Try to connect and send to plymouth (if running) some checked report progress, using direct plymouth protocole. Update message is the following: fsckd:<num_devices>:<progress>:<string> * num_devices corresponds to the current number of devices being checked (int) * progress corresponds to the current minimum percentage of all devices being checked (float, from 0 to 100) * string is a translated message ready to be displayed by the plymouth theme displaying the information above. It can be overriden by plymouth themes supporting i18n. Grab in fsckd plymouth watch key Control+C, and propagate this cancel request to systemd-fsck which will terminate fsck. Send a message to signal to user what key we are grabbing for fsck cancel. Message is: fsckd-cancel-msg:<string> Where string is a translated string ready to be displayed by the plymouth theme indicating that Control+C can be used to cancel current checks. It can be overriden (matching only fsckd-cancel-msg prefix) for themes supporting i18n.
* systemd-fsck: always connect to systemd-fsckdDidier Roche2015-02-181-8/+4
| | | | | | Remove the plymouth running or show-status checks from systemd-fsck. Instead, always connect to systemd-fsckd socket, and let this one decide if we display progress or not.
* fsckd daemon for inter-fsckd communicationDidier Roche2015-02-181-57/+31
| | | | | | | | | | | | | Add systemd-fsckd multiplexer which accepts multiple systemd-fsck instances to connect to it and sends progress report. systemd-fsckd then computes and writes to /dev/console the number of devices currently being checked and the minimum fsck progress. This will be used for interactive progress report and cancelling in plymouth. systemd-fsckd stops on idle when no systemd-fsck is connected. Make the necessary changes to systemd-fsck to connect to the systemd-fsckd socket.
* Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek2015-02-011-3/+2
| | | | | | | | | | If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
* sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering2014-12-101-1/+1
| | | | | | src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-4/+4
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* util: simplify proc_cmdline() to reuse get_process_cmdline()Lennart Poettering2014-11-071-1/+4
| | | | Also, make all parsing of the kernel cmdline non-fatal.
* fsck: re-enable fsck -lKarel Zak2014-10-221-9/+4
| | | | | | | The -l (lock) has been temporary disabled due to conflict with udev (https://bugs.freedesktop.org/show_bug.cgi?id=79576) The problem is fixed since util-linux v2.25 (Jul 2014).
* bus: always explicitly close bus from main programsLennart Poettering2014-08-041-1/+1
| | | | | | | | | | | | | | Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
* fsck: consider a fsck implementation linked to /bin/true non-existantLennart Poettering2014-06-251-9/+5
|
* stop complaining about unknown kernel cmdline optionsLennart Poettering2014-06-191-4/+7
| | | | | Also stop warning about unknown kernel cmdline options in the various tools, not just in PID 1
* fsck: disable "-l" option for nowKay Sievers2014-06-041-1/+12
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5
* fsck: include device name in the message about missing fsckZbigniew Jędrzejewski-Szmek2014-05-301-2/+4
|
* fsck: Allow to specify the fsck repair option in the cmdlineHolger Hans Peter Freyther2014-05-161-1/+13
| | | | | | | | | | Some unattended systems do not have a console attached and entering the default rescue mode will not be too helpful. Allow to specify the "-y" option to attempt to fix all filesystem errors. Manually verified by downloading an image.gz of e2fsprogs, using losetup and running systemd-fsck on the loop device and varying the fsck.repair=preen|yes|no option.
* fsck: Search for fsck.type in PATHMike Gilbert2014-04-121-5/+5
| | | | | | Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
* util: replace close_pipe() with new safe_close_pair()Lennart Poettering2014-03-241-1/+1
| | | | | | safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-181-6/+3
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* util: move more intellegince into parse_proc_cmdline()Lennart Poettering2014-03-061-13/+18
| | | | | Already split variable assignments before invoking the callback. And drop "rd." settings if we are not in an initrd.
* Extract looping over /proc/cmdline into a shared functionZbigniew Jędrzejewski-Szmek2014-02-171-31/+17
| | | | | | | In cryptsetup-generator automatic cleanup had to be replaced with manual cleanup, and the code gets a bit longer. But existing code had the issue that it returned negative values from main(), which was wrong, so should be reworked anyway.
* everywhere: always use O_CLOEXEC where it makes senseLennart Poettering2014-02-131-1/+1
|
* systemctl: simplify start_unitZbigniew Jędrzejewski-Szmek2013-12-261-2/+2
|
* fsck,fstab-generator: be lenient about missing fsck.<type>Zbigniew Jędrzejewski-Szmek2013-11-151-8/+32
| | | | | | | | | | | | | If fstab contains 1 for passno, treat this as an error, but only warn briefly. If fstab doesn't contain this information, don't complain at all. Patch is complicated a bit by the fact that we might have the fstype specified in fstab or on /proc/cmdline, in which case we can check if we have the appropriate fsck tool, or not specified, or specified as auto, in which case we have to look and check the type of the filesystem ourselves. It cannot be done before the device appears, so it is too early in the generator phase, and it must be done directly in fsck service.
* fsck: modernizationZbigniew Jędrzejewski-Szmek2013-11-151-25/+18
|
* util: unify reading of /proc/cmdlineLennart Poettering2013-11-061-8/+4
| | | | | | Instead of individually checking for containers in each user do this once in a new call proc_cmdline() that read the file only if we are not in a container.
* general: various cleanupsLennart Poettering2013-10-301-9/+4
|
* bus: move ssh support into public API of libsystem-busLennart Poettering2013-10-301-1/+1
|
* fsck: port to sd-busTom Gundersen2013-10-181-47/+24
|
* Introduce udev object cleanup functionsZbigniew Jędrzejewski-Szmek2013-10-131-9/+4
|
* Do no isolate in case of emergency or severe problemsDr. Tilmann Bubeck2013-04-011-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes local-fs.target and systemd-fsck to not use "isolate" when going into emergency. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722 The motivation is, that when something wents wrong, we should keep everything as it is, to let the user fix the problem. When isolating we stop a lot of services and therefore change the system heavily so that it gets harder for the user to fix. An example is a crypted partition. When the fsck in a crypted partition fails, it previously used "emergency/start/isolate" which stops cryptsetup. Therefore if the user tries to fsck e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691 as printed by the failing fsck, then it will not find this device (because it got closed). So please apply this patch to let the user see the failing situation. Thanks! [zj: removed dead isolate param from start_target().] https://bugs.freedesktop.org/show_bug.cgi?id=49463 https://bugzilla.redhat.com/show_bug.cgi?id=810722
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-141-0/+1
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* fsck: remove distro specific hacks from fsck/quotacheckLennart Poettering2013-01-041-5/+14
| | | | Move forcefsck file checks under a HAVE_SYSV_COMPAT #ifdef, and warn if this is used.
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-261-1/+1
| | | | | | also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
* use "Out of memory." consistantly (or with "\n")Shawn Landden2012-07-251-1/+1
| | | | | | | | glibc/glib both use "out of memory" consistantly so maybe we should consider that instead of this. Eliminates one string out of a number of binaries. Also fixes extra newline in udev/scsi_id
* cryptsetup: allow configuration of LUKS disks via the kernel cmdlineLennart Poettering2012-06-221-3/+4
| | | | This generalizes a bit of the functionality already available in dracut.