diff mbox series

[bug#38462] linux-boot: Don't ignore flags when mounting root file system.

Message ID 20191202205734.7018-1-glv@posteo.net
State Accepted
Headers show
Series [bug#38462] linux-boot: Don't ignore flags when mounting root file system. | expand

Commit Message

Guillaume Le Vaillant Dec. 2, 2019, 8:57 p.m. UTC
* gnu/build/linux-boot.scm (mount-root-file-system): Add the 'flags' keyword
  argument and use it when mounting the root file system.
  (boot-system): Pass the root file system flags to 'mount-root-file-system'.
---
 gnu/build/linux-boot.scm | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Comments

Ludovic Courtès Dec. 9, 2019, 2:53 p.m. UTC | #1
Guillaume Le Vaillant <glv@posteo.net> skribis:

> * gnu/build/linux-boot.scm (mount-root-file-system): Add the 'flags' keyword
>   argument and use it when mounting the root file system.
>   (boot-system): Pass the root file system flags to 'mount-root-file-system'.

This was pushed as 900ef20b1da66ad71145082c883dc12f31fafa54, closing!

Ludo’.
Guillaume Le Vaillant Dec. 9, 2019, 3:22 p.m. UTC | #2
Ludovic Courtès skribis:

> Guillaume Le Vaillant <glv@posteo.net> skribis:
>
>> * gnu/build/linux-boot.scm (mount-root-file-system): Add the 'flags' keyword
>>   argument and use it when mounting the root file system.
>>   (boot-system): Pass the root file system flags to 'mount-root-file-system'.
>
> This was pushed as 900ef20b1da66ad71145082c883dc12f31fafa54, closing!
>
> Ludo’.

These are in fact two similar but different patches. Patch
900ef20b1da66ad71145082c883dc12f31fafa54 added support for the 'options'
field of a file-system definition, whereas this patch adds support for
the 'flags' field.
Ludovic Courtès Dec. 10, 2019, 7:10 p.m. UTC | #3
Hi,

Guillaume Le Vaillant <glv@posteo.net> skribis:

> Ludovic Courtès skribis:
>
>> Guillaume Le Vaillant <glv@posteo.net> skribis:
>>
>>> * gnu/build/linux-boot.scm (mount-root-file-system): Add the 'flags' keyword
>>>   argument and use it when mounting the root file system.
>>>   (boot-system): Pass the root file system flags to 'mount-root-file-system'.
>>
>> This was pushed as 900ef20b1da66ad71145082c883dc12f31fafa54, closing!
>>
>> Ludo’.
>
> These are in fact two similar but different patches. Patch
> 900ef20b1da66ad71145082c883dc12f31fafa54 added support for the 'options'
> field of a file-system definition, whereas this patch adds support for
> the 'flags' field.

Oops, my bad.  Applied, thanks!

Ludo’.
Ludovic Courtès Dec. 10, 2019, 7:49 p.m. UTC | #4
Ludovic Courtès <ludo@gnu.org> skribis:

> Guillaume Le Vaillant <glv@posteo.net> skribis:
>
>> Ludovic Courtès skribis:
>>
>>> Guillaume Le Vaillant <glv@posteo.net> skribis:
>>>
>>>> * gnu/build/linux-boot.scm (mount-root-file-system): Add the 'flags' keyword
>>>>   argument and use it when mounting the root file system.
>>>>   (boot-system): Pass the root file system flags to 'mount-root-file-system'.
>>>
>>> This was pushed as 900ef20b1da66ad71145082c883dc12f31fafa54, closing!
>>>
>>> Ludo’.
>>
>> These are in fact two similar but different patches. Patch
>> 900ef20b1da66ad71145082c883dc12f31fafa54 added support for the 'options'
>> field of a file-system definition, whereas this patch adds support for
>> the 'flags' field.
>
> Oops, my bad.  Applied, thanks!

Actually no: “make check-system TESTS=basic” fails after that.
Could you take a look?

Thanks in advance,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 950a3507f2..fcec751f45 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -358,10 +358,10 @@  the last argument of `mknod'."
           (filter-map string->number (scandir "/proc")))))
 
 (define* (mount-root-file-system root type
-                                 #:key volatile-root? options)
-  "Mount the root file system of type TYPE at device ROOT.  If VOLATILE-ROOT?
-is true, mount ROOT read-only and make it an overlay with a writable tmpfs
-using the kernel built-in overlayfs.  OPTIONS indicates the options to use
+                                 #:key volatile-root? (flags 0) options)
+  "Mount the root file system of type TYPE at device ROOT. If VOLATILE-ROOT? is
+true, mount ROOT read-only and make it an overlay with a writable tmpfs using
+the kernel built-in overlayfs. FLAGS and OPTIONS indicates the options to use
 to mount ROOT."
 
   (if volatile-root?
@@ -384,7 +384,7 @@  to mount ROOT."
                "lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work"))
       (begin
         (check-file-system root type)
-        (mount root "/root" type 0 options)))
+        (mount root "/root" type flags options)))
 
   ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
   (false-if-exception
@@ -474,6 +474,13 @@  upon error."
              mounts)
         "ext4"))
 
+  (define root-fs-flags
+    (mount-flags->bit-mask (or (any (lambda (fs)
+                                      (and (root-mount-point? fs)
+                                           (file-system-flags fs)))
+                                    mounts)
+                               0)))
+
   (define root-fs-options
     (any (lambda (fs)
            (and (root-mount-point? fs)
@@ -533,6 +540,7 @@  upon error."
               (mount-root-file-system (canonicalize-device-spec root)
                                       root-fs-type
                                       #:volatile-root? volatile-root?
+                                      #:flags root-fs-flags
                                       #:options root-fs-options))
             (mount "none" "/root" "tmpfs"))