diff mbox series

[bug#71402] services: Never throw when stopping mount-may-fail file systems.

Message ID 559a95a6e1df354eb1415fa78163a8d3f009c61a.1717709187.git.ludo@gnu.org
State New
Headers show
Series [bug#71402] services: Never throw when stopping mount-may-fail file systems. | expand

Commit Message

Ludovic Courtès June 6, 2024, 9:27 p.m. UTC
This is a followup to 7c27bd115b14afd142da7684cc349369965f9eab.

* gnu/services/base.scm (file-system-shepherd-service): Catch
'system-error from ‘umount’ call when FILE-SYSTEM is marked as
mount-may-fail.

Change-Id: I2234f8da320b43089f4ee058cad8608ce9c078f8
---
 gnu/services/base.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Hi!

File systems marked as mount-may-fail could throw when stopped
(when the file system hadn't actually been mount).  This was mostly
harmless, but it should be ignored as well.

Thoughts?

Ludo'.


base-commit: 40c6f708393885a2d28f847350e8f47beb11e745
diff mbox series

Patch

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 2d6b0f00e02..c7a14c7ed43 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -448,7 +448,11 @@  (define (file-system-shepherd-service file-system)
                       ;; Make sure PID 1 doesn't keep TARGET busy.
                       (chdir "/")
 
-                      (umount #$target)
+                      #$(if (file-system-mount-may-fail? file-system)
+                            #~(catch 'system-error
+                                (lambda () (umount #$target))
+                                (const #f))
+                            #~(umount #$target))
                       #f))
 
             ;; We need additional modules.