mirror of
https://github.com/systemd/systemd.git
synced 2025-02-03 17:47:28 +03:00
fstab-generator: drop nofail and noauto options for critical mounts
Setting nofail for /usr mount doesn't make sense because without /usr we can't really boot. However, having the flag set might cause races in initrd where we could try to switchroot into rootfs before /usr is actually mounted. Let's just ignore it so that we always have proper mount unit ordering for /sysroot/usr mount.
This commit is contained in:
parent
dc8db30db9
commit
1e9b2e4fdd
@ -853,7 +853,7 @@ static int parse_fstab_one(
|
||||
bool accept_root, /* This takes an effect only when prefix_sysroot is true. */
|
||||
bool use_swap_enabled) {
|
||||
|
||||
_cleanup_free_ char *what = NULL, *where = NULL;
|
||||
_cleanup_free_ char *what = NULL, *where = NULL, *opts = NULL;
|
||||
MountPointFlags flags;
|
||||
bool is_swap, where_changed;
|
||||
int r;
|
||||
@ -936,6 +936,17 @@ static int parse_fstab_one(
|
||||
mount_is_network(fstype, options) ? SPECIAL_REMOTE_FS_TARGET :
|
||||
SPECIAL_LOCAL_FS_TARGET;
|
||||
|
||||
/* nofail or noauto don't make sense for critical filesystems we must mount in initrd. */
|
||||
if ((is_sysroot || is_sysroot_usr) && ((flags & (MOUNT_NOFAIL|MOUNT_NOAUTO)) != 0)) {
|
||||
flags &= ~(MOUNT_NOFAIL|MOUNT_NOAUTO);
|
||||
r = fstab_filter_options(options, "noauto\0nofail\0", NULL, NULL, NULL, &opts);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
log_debug("'noauto' and 'nofail' options are ignored for /sysroot/ and /sysroot/usr/ mounts.");
|
||||
options = opts;
|
||||
}
|
||||
|
||||
r = add_mount(source,
|
||||
arg_dest,
|
||||
what,
|
||||
|
Loading…
x
Reference in New Issue
Block a user