guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/17: gnu: Don't abuse check-btrfs-file-system to scan.


From: guix-commits
Subject: 04/17: gnu: Don't abuse check-btrfs-file-system to scan.
Date: Thu, 23 Sep 2021 12:20:53 -0400 (EDT)

nckx pushed a commit to branch master
in repository guix.

commit 68b219b9f482f09e7c55aaee4b64222d8c86172a
Author: Tobias Geerinckx-Rice <me@tobias.gr>
AuthorDate: Sat Jun 12 21:36:08 2021 +0200

    gnu: Don't abuse check-btrfs-file-system to scan.
    
    It was never guaranteed to be run for non-root file systems.  It was for
    root file systems only due to a bug now fixed.
    
    * gnu/build/file-systems.scm (check-btrfs-file-system): Don't invoke
    ‘btrfs device scan’ here.
    * gnu/system/linux-initrd.scm (raw-initrd): Do so here if any btrfs file
    systems are present.
---
 gnu/build/file-systems.scm  |  2 --
 gnu/system/linux-initrd.scm | 13 ++++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index a54127e..251ca51 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -328,8 +328,6 @@ When FORCE? is true, do perform a real check.  This is not 
recommended!  See
 @uref{https://bugzilla.redhat.com/show_bug.cgi?id=625967#c8}.  If REPAIR is
 false, do not write to DEVICE.  If it's #t, fix any errors found.  Otherwise,
 fix only those considered safe to repair automatically."
-  ;; XXX Why make this conditional on (check? #t) at all?
-  (system* "btrfs" "device" "scan")     ; ignore errors
   (if force?
       (match (status:exit-val
               (apply system* `("btrfs" "check" "--progress"
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 8c245b8..7f7740d 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -210,6 +210,16 @@ upon error."
              (open source targets)))
          mapped-devices))
 
+  (define file-system-scan-commands
+    ;; File systems like btrfs need help to assemble multi-device file systems
+    ;; but do not use manually-specified <mapped-devices>.
+    (let ((file-system-types (map file-system-type file-systems)))
+      (if (member "btrfs" file-system-types)
+          ;; Ignore errors: if the system manages to boot anyway, the better.
+          #~((system* (string-append #$btrfs-progs/static "/bin/btrfs")
+                      "device" "scan"))
+          #~())))
+
   (define kodir
     (flat-linux-module-directory linux linux-modules))
 
@@ -245,7 +255,8 @@ upon error."
                         (map spec->file-system
                              '#$(map file-system->spec file-systems))
                         #:pre-mount (lambda ()
-                                      (and #$@device-mapping-commands))
+                                      (and #$@device-mapping-commands
+                                           #$@file-system-scan-commands))
                         #:linux-modules '#$linux-modules
                         #:linux-module-directory '#$kodir
                         #:keymap-file #+(and=> keyboard-layout



reply via email to

[Prev in Thread] Current Thread [Next in Thread]