mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
services: file-systems: Include 'user-file-systems' service.
Previously the KNOWN-FS value used in 'essential-services' would be incomplete: it would lack all the file systems provided by services that extend 'file-system-service-type' (/sys/fs/cgroup, /proc/sys/fs/binfmt_misc, etc.) Consequently, upon shutdown, 'user-processes' would unmount these file systems before their corresponding service had been stopped; when their corresponding (e.g., 'file-system-/proc/sys/fs/binfmt_misc') was stopped, its 'umount' call would fail. This was harmless in practice, but this patch makes sure things work as intended and file systems are unmounted in the right order. * gnu/services/base.scm (file-system-shepherd-services): Instantiate 'user-file-systems' Shepherd service from here. (user-unmount-service-type, user-unmount-service): Remove. * gnu/system.scm (essential-services): Remove call to 'user-unmount-service'. * gnu/system/install.scm (cow-store-service-type): Adjust comment.
This commit is contained in:
parent
366ddc1ac5
commit
6c4458172d
3 changed files with 32 additions and 37 deletions
|
@ -55,7 +55,6 @@ (define-module (gnu services base)
|
|||
#:export (fstab-service-type
|
||||
root-file-system-service
|
||||
file-system-service-type
|
||||
user-unmount-service
|
||||
swap-service
|
||||
user-processes-service-type
|
||||
host-name-service
|
||||
|
@ -464,29 +463,10 @@ (define sink
|
|||
(start #~(const #t))
|
||||
(stop #~(const #f))))
|
||||
|
||||
(cons sink (map file-system-shepherd-service file-systems))))
|
||||
(define known-mount-points
|
||||
(map file-system-mount-point file-systems))
|
||||
|
||||
(define file-system-service-type
|
||||
(service-type (name 'file-systems)
|
||||
(extensions
|
||||
(list (service-extension shepherd-root-service-type
|
||||
file-system-shepherd-services)
|
||||
(service-extension fstab-service-type
|
||||
identity)
|
||||
|
||||
;; Have 'user-processes' depend on 'file-systems'.
|
||||
(service-extension user-processes-service-type
|
||||
(const '(file-systems)))))
|
||||
(compose concatenate)
|
||||
(extend append)
|
||||
(description
|
||||
"Provide Shepherd services to mount and unmount the given
|
||||
file systems, as well as corresponding @file{/etc/fstab} entries.")))
|
||||
|
||||
(define user-unmount-service-type
|
||||
(shepherd-service-type
|
||||
'user-file-systems
|
||||
(lambda (known-mount-points)
|
||||
(define user-unmount
|
||||
(shepherd-service
|
||||
(documentation "Unmount manually-mounted file systems.")
|
||||
(provision '(user-file-systems))
|
||||
|
@ -509,12 +489,28 @@ (define (known? mount-point)
|
|||
(format #t "failed to unmount '~a': ~a~%"
|
||||
mount-point (strerror errno))))))
|
||||
(filter (negate known?) (mount-points)))
|
||||
#f))))))
|
||||
#f))))
|
||||
|
||||
(cons* sink user-unmount
|
||||
(map file-system-shepherd-service file-systems))))
|
||||
|
||||
(define file-system-service-type
|
||||
(service-type (name 'file-systems)
|
||||
(extensions
|
||||
(list (service-extension shepherd-root-service-type
|
||||
file-system-shepherd-services)
|
||||
(service-extension fstab-service-type
|
||||
identity)
|
||||
|
||||
;; Have 'user-processes' depend on 'file-systems'.
|
||||
(service-extension user-processes-service-type
|
||||
(const '(file-systems)))))
|
||||
(compose concatenate)
|
||||
(extend append)
|
||||
(description
|
||||
"Provide Shepherd services to mount and unmount the given
|
||||
file systems, as well as corresponding @file{/etc/fstab} entries.")))
|
||||
|
||||
(define (user-unmount-service known-mount-points)
|
||||
"Return a service whose sole purpose is to unmount file systems not listed
|
||||
in KNOWN-MOUNT-POINTS when it is stopped."
|
||||
(service user-unmount-service-type known-mount-points))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
|
@ -453,7 +453,6 @@ (define known-fs
|
|||
(let* ((mappings (device-mapping-services os))
|
||||
(root-fs (root-file-system-service))
|
||||
(other-fs (non-boot-file-system-service os))
|
||||
(unmount (user-unmount-service known-fs))
|
||||
(swaps (swap-services os))
|
||||
(procs (service user-processes-service-type))
|
||||
(host-name (host-name-service (operating-system-host-name os)))
|
||||
|
@ -478,7 +477,7 @@ (define known-fs
|
|||
(service fstab-service-type '())
|
||||
(session-environment-service
|
||||
(operating-system-environment-variables os))
|
||||
host-name procs root-fs unmount
|
||||
host-name procs root-fs
|
||||
(service setuid-program-service-type
|
||||
(operating-system-setuid-programs os))
|
||||
(service profile-service-type
|
||||
|
|
|
@ -133,7 +133,7 @@ (define cow-store-service-type
|
|||
(stop #~(lambda (target)
|
||||
;; Delete the temporary directory, but leave everything
|
||||
;; mounted as there may still be processes using it since
|
||||
;; 'user-processes' doesn't depend on us. The 'user-unmount'
|
||||
;; 'user-processes' doesn't depend on us. The 'user-file-systems'
|
||||
;; service will unmount TARGET eventually.
|
||||
(delete-file-recursively
|
||||
(string-append target #$%backing-directory))))))))
|
||||
|
|
Loading…
Reference in a new issue