[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: mapped-devices: Cope with delayed appearance of LUKS source.
From: |
Mark H. Weaver |
Subject: |
01/01: mapped-devices: Cope with delayed appearance of LUKS source. |
Date: |
Wed, 7 Jun 2017 19:04:25 -0400 (EDT) |
mhw pushed a commit to branch master
in repository guix.
commit f45878a80d412dd79c95e9274c3ee5dd24e1cec9
Author: Mark H Weaver <address@hidden>
Date: Tue Mar 28 05:52:28 2017 -0400
mapped-devices: Cope with delayed appearance of LUKS source.
Fixes <https://bugs.gnu.org/27242>.
* gnu/system/mapped-devices.scm (open-luks-device): If
'find-partition-by-luks-uuid' fails, try again once per second, up to ten
times.
---
gnu/system/mapped-devices.scm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 2959802..18b9f5b 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
;;; Copyright © 2016 Andreas Enge <address@hidden>
+;;; Copyright © 2017 Mark H Weaver <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -114,7 +115,16 @@
;; udev-populated /dev/disk/by-id directory but udev
may
;; be unavailable at the time we run this.
(if (bytevector? source)
- (or (find-partition-by-luks-uuid source)
+ (or (let loop ((tries-left 10))
+ (and (positive? tries-left)
+ (or (find-partition-by-luks-uuid source)
+ ;; If the underlying partition is
+ ;; not found, try again after
+ ;; waiting a second, up to ten
+ ;; times. FIXME: This should be
+ ;; dealt with in a more robust way.
+ (begin (sleep 1)
+ (loop (- tries-left 1))))))
(error "LUKS partition not found" source))
source)