[systemd-devel] [PATCH] fstab-generator: handle mount units with "x-rootfs.mount"

Lennart Poettering lennart at poettering.net
Fri Mar 22 19:05:17 PDT 2013


On Thu, 14.03.13 13:15, harald at redhat.com (harald at redhat.com) wrote:

> From: Harald Hoyer <harald at redhat.com>
> 
> Mount units with "x-rootfs.mount" are now ordered before root-fs.target.
> As we sometimes construct /sysroot mounts in /etc/fstab in the initrd,
> we want these to be mounted before the root-fs.target is active.

Hmm, I don't get this, what is this for? Where's the destinction to
"x-initrd.mount"? Why do we need both? Examples?

Apparently a patch like this got merged, but it uses
"x-initrd-rootfs.mount" as identifier, is that the same thing? If so,
the thing really should be called "x-initrd.foobar", i.e. "x-initrd" is
supposed to be the 'namespace' the setting is in.

Anyway, totally not grokking this, please enlighten me.

> ---
>  src/fstab-generator/fstab-generator.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
> index b4fb134..6905316 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -199,6 +199,13 @@ static bool mount_in_initrd(struct mntent *me) {
>                  streq(me->mnt_dir, "/usr");
>  }
>  
> +static bool mount_is_rootfs(struct mntent *me) {
> +        assert(me);
> +
> +        return
> +                hasmntopt(me, "x-rootfs.mount");
> +}
> +
>  static int add_mount(const char *what, const char *where, const char *type, const char *opts,
>                       int passno, bool noauto, bool nofail, bool automount, bool isbind,
>                       const char *pre, const char *post, const char *source) {
> @@ -434,6 +441,9 @@ static int parse_fstab(const char *prefix, bool initrd) {
>                          if (initrd) {
>                                  post = SPECIAL_INITRD_FS_TARGET;
>                                  pre = NULL;
> +                        } else if (mount_is_rootfs(me)) {
> +                                post = SPECIAL_ROOT_FS_TARGET;
> +                                pre = NULL;
>                          } else if (mount_is_network(me)) {
>                                  post = SPECIAL_REMOTE_FS_TARGET;
>                                  pre = SPECIAL_REMOTE_FS_PRE_TARGET;


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list