mirror of
https://github.com/systemd/systemd.git
synced 2026-08-10 17:14:31 +00:00
fstab-generator: honor x-systemd.validatefs from kernel cmdline too
This commit is contained in:
@@ -1167,7 +1167,7 @@ static bool validate_root_or_usr_mount_source(const char *what, const char *swit
|
||||
static int add_sysroot_mount(void) {
|
||||
_cleanup_free_ char *what = NULL;
|
||||
const char *extra_opts = NULL, *fstype = NULL;
|
||||
bool default_rw = true, makefs = false;
|
||||
bool default_rw = true;
|
||||
MountPointFlags flags;
|
||||
|
||||
if (!validate_root_or_usr_mount_source(arg_root_what, "root="))
|
||||
@@ -1218,8 +1218,9 @@ static int add_sysroot_mount(void) {
|
||||
|
||||
log_debug("Found entry what=%s where=/sysroot type=%s opts=%s", what, strna(arg_root_fstype), strempty(combined_options));
|
||||
|
||||
makefs = fstab_test_option(combined_options, "x-systemd.makefs\0");
|
||||
flags = makefs * MOUNT_MAKEFS;
|
||||
/* Only honor x-systemd.makefs and .validatefs here, others are not relevant in initrd/not used
|
||||
* at all (also see mandatory_mount_drop_unapplicable_options()) */
|
||||
flags = fstab_options_to_flags(combined_options, /* is_swap = */ false) & (MOUNT_MAKEFS|MOUNT_VALIDATEFS);
|
||||
|
||||
return add_mount("/proc/cmdline",
|
||||
arg_dest,
|
||||
@@ -1237,8 +1238,7 @@ static int add_sysroot_mount(void) {
|
||||
static int add_sysroot_usr_mount(void) {
|
||||
_cleanup_free_ char *what = NULL;
|
||||
const char *extra_opts = NULL;
|
||||
MountPointFlags flags;
|
||||
bool makefs;
|
||||
bool makefs, validatefs;
|
||||
int r;
|
||||
|
||||
/* Returns 0 if we didn't do anything, > 0 if we either generated a unit for the /usr/ mount, or we
|
||||
@@ -1308,8 +1308,10 @@ static int add_sysroot_usr_mount(void) {
|
||||
|
||||
log_debug("Found entry what=%s where=/sysusr/usr type=%s opts=%s", what, strna(arg_usr_fstype), strempty(combined_options));
|
||||
|
||||
/* Only honor x-systemd.makefs and .validatefs here, others are not relevant in initrd/not used
|
||||
* at all (also see mandatory_mount_drop_unapplicable_options()) */
|
||||
makefs = fstab_test_option(combined_options, "x-systemd.makefs\0");
|
||||
flags = makefs * MOUNT_MAKEFS;
|
||||
validatefs = fstab_test_option(combined_options, "x-systemd.validatefs\0");
|
||||
|
||||
r = add_mount("/proc/cmdline",
|
||||
arg_dest,
|
||||
@@ -1319,13 +1321,13 @@ static int add_sysroot_usr_mount(void) {
|
||||
arg_usr_fstype,
|
||||
combined_options,
|
||||
/* passno= */ is_device_path(what) ? 1 : 0,
|
||||
flags,
|
||||
makefs ? MOUNT_MAKEFS : 0,
|
||||
SPECIAL_INITRD_USR_FS_TARGET,
|
||||
"imports.target");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = add_sysusr_sysroot_usr_bind_mount("/proc/cmdline", /* validatefs = */ false);
|
||||
r = add_sysusr_sysroot_usr_bind_mount("/proc/cmdline", validatefs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user