[systemd-devel] [PATCH] fstab-generator: Allow mount.usr without mount.usrflags, honor rw/ro

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Dec 7 16:51:25 PST 2014


On Sat, Dec 06, 2014 at 02:47:51PM -0800, Michael Marineau wrote:
> There is no need to require mount.usrflags. The original implementation
> assumed that a btrfs subvolume would always be needed but that is not
> applicable to systems that do not use btrfs for /usr.
> 
> Similar to using rootflags= for the default of mount.usrflags=, append
> the classic 'ro' and 'rw' flags to the mount options.
> ---
>  src/fstab-generator/fstab-generator.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
> index e8a21f7..236fb37 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -476,7 +476,7 @@ static int add_usr_mount(void) {
>                          return log_oom();
>          }
>  
> -        if (!arg_usr_what || !arg_usr_options)
> +        if (!arg_usr_what)
>                  return 0;
>  
>          what = fstab_node_to_udev_node(arg_usr_what);
> @@ -485,7 +485,14 @@ static int add_usr_mount(void) {
>                  return -1;
>          }
>  
> -        opts = arg_usr_options;
> +        if (!arg_usr_options)
> +                opts = arg_root_rw > 0 ? "rw" : "ro";
> +        else if (arg_root_rw >= 0 ||
> +                 (!mount_test_option(arg_usr_options, "ro") &&
> +                  !mount_test_option(arg_usr_options, "rw")))
This condition looks wrong. "rw" or "ro" will be always appended when
arg_root_rw is set. Is the intent to override arg_usr_options?

Zbyszek

> +                opts = strappenda(arg_usr_options, ",", arg_root_rw > 0 ? "rw" : "ro");
> +        else
> +                opts = arg_usr_options;
>  
>          log_debug("Found entry what=%s where=/sysroot/usr type=%s", what, strna(arg_usr_fstype));
>          return add_mount(what,
> -- 
> 2.0.4
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list