From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id IP1bJ46uW2YIIAAAA41jLg (envelope-from ) for ; Sun, 02 Jun 2024 01:28:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id MN7qH46uW2b6uwAA62LTzQ (envelope-from ) for ; Sun, 02 Jun 2024 01:28:14 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=feLAxADQ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717284494; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=OU0QWBAQSRCJR9iz4SlpjMP1fKEkEkWGsEZ2KIPGil0=; b=aYmds/KlGRtI4XJepGbtiYU0CONBKwz0nY0BhDuTOSFzOlQXYtvkYLL+UNIhChqPp0Ce+q RYzNVFMFMUN6kdC9tYpXqRn2x+YePOL7pyh51KMEdhWaQ3aZDoIWfylDUX7gD538bEObPz KunefmCau4KqGs1iirlGdyEMbcjjK022Bg7tjC7B8NxZ/+F/S2fkUkwOlASRoAGNPmCmjR pVfxJWOB7MStyQQ/m+BIncDTqB3/ku/Ugn0LfEdj60haXz1lKfj3VoXWOGsnyYVau87wFi iX8gs0YQukEP2ruV46pzDljYFaM0kcnBmpFoO6utUU5C3t7SrQSJkfww5ssGcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=feLAxADQ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717284494; a=rsa-sha256; cv=none; b=HnvkggfgshgmB8ea/AfuU2uHAtnXOhK7qk356taHa4UpN9m8voftPEIZCfWV8Faw/p0Qa7 ImVI0uaEZKX//TLPhFS3flRRQQ3sDT2gr7dxXsqAQsW7iQz94UMACPlokXT3aDtS2wWTAA z6qLWMipUAqouKxu3K5ABUj+6KYsaHftosK6uY/XjxLv5Ry7LeFp1usXLdizqQQOqtpXPm HkkczAV/m46PTL8UnsB/U74szAk99kBBlkUZ+S46DBgv5/K6HG6UFlyc2BrC2cvA2ozs+4 S25pG+cd1BvHw4S2krPRqloQ1Ic2D439JzITBmOgYfrIOtVgCpp4VvZsI/YNzQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3626C1424F for ; Sun, 2 Jun 2024 01:28:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sDY8j-00034R-6a; Sat, 01 Jun 2024 19:27:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sDY8f-000334-Oh for guix-patches@gnu.org; Sat, 01 Jun 2024 19:27:53 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sDY8f-00043u-0s; Sat, 01 Jun 2024 19:27:53 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sDY8o-0003uC-QC; Sat, 01 Jun 2024 19:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70542] [PATCH v3 1/3] services: base: Add optional delayed mount of file-systems Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 01 Jun 2024 23:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70542 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70542@debbugs.gnu.org Cc: Richard Sent , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 70542-submit@debbugs.gnu.org id=B70542.171728442714905 (code B ref 70542); Sat, 01 Jun 2024 23:28:02 +0000 Received: (at 70542) by debbugs.gnu.org; 1 Jun 2024 23:27:07 +0000 Received: from localhost ([127.0.0.1]:57526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDY7u-0003sK-GM for submit@debbugs.gnu.org; Sat, 01 Jun 2024 19:27:07 -0400 Received: from mail-108-mta28.mxroute.com ([136.175.108.28]:33213) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDY7t-0003sD-0C for 70542@debbugs.gnu.org; Sat, 01 Jun 2024 19:27:05 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta28.mxroute.com (ZoneMTA) with ESMTPSA id 18fd6209b42000e2b6.001 for <70542@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 01 Jun 2024 23:26:52 +0000 X-Zone-Loop: ceb20fc60aff35bc0dc15f5855f592538b213dadcf1c X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OU0QWBAQSRCJR9iz4SlpjMP1fKEkEkWGsEZ2KIPGil0=; b=feLAxADQVTnHiSgiWqBAu5RRUt jVzDB75mdmOOP7bd695VJticFc69QR7Y1L00mGjqkWmIbu2yoNXxgrUGcc1nK8E6UN/jPPjfM4l9o kvELeA0vevOuFXUfJUEr+GxMP80MuMsJQZSN5rQHxqbBxlbYGaH9Kj6duhUvtYyBAqLfb7t/sFcKK 8NyXYKEbHe09nTmQP2zh2BeXBB2GG450I26QchIZCjqa9BwexINmGkns4mDITaEI4pm/6GglW+OU/ H7w8E3MPJfgmXWiDIDHtCJC1PJgKelv4pFWfvH8BaCJrSTCQHeR/tWSDID+3gcTKtnFSdp2W0jN5D /z3cl9Og==; From: Richard Sent Date: Sat, 1 Jun 2024 19:26:16 -0400 Message-ID: <9ce75e011c2459e20902e7fe1d68b691531daa66.1717283896.git.richard@freakingpenguin.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.34 X-Spam-Score: -3.34 X-Migadu-Queue-Id: 3626C1424F X-Migadu-Scanner: mx13.migadu.com X-TUID: Fkc/7esm/IBO Add a mechanism to only require mounting a subset of file-system entries during early Shepherd initialization. Any file-system with additional Shepherd service requirements (e.g. networking) is not required to provision 'file-systems. * gnu/services/base.scm (file-system-shepherd-service): Splice file-system-requirements into the Shepherd service requirement list. (file-system-shepherd-services): Provision 'file-system only when file system services without additional Shepherd requirements are started. * gnu/system/file-systems.scm (file-system): Add shepherd-requirements field to the file-system record. This field is used for adding additional Shepherd requirements to a file-system Shepherd service. * doc/guix.texi: Add documentation for file-system shepherd-requirements. Change-Id: If0392db03d48e8820aa53df1df482c12ec72e1a5 --- doc/guix.texi | 14 +++++++++ gnu/services/base.scm | 14 +++++++-- gnu/system/file-systems.scm | 57 +++++++++++++++++++------------------ 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1224104038..158fd6c125 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17862,6 +17862,20 @@ File Systems Another example is a file system that depends on a mapped device, for example for an encrypted partition (@pxref{Mapped Devices}). + +@item @code{shepherd-requirements} (default: @code{'()}) +This is a list of symbols denoting Shepherd requirements that must be +met before mounting the file system. + +As an example, an NFS file system would typically have a requirement for +@code{networking}. + +Typically, file systems are mounted before most other Shepherd services +are started. However, file systems with a non-empty +shepherd-requirements field are mounted after Shepherd services have +begun. Any Shepherd service that depends on a file system with a +non-empty shepherd-requirements field must depend on it directly and not +on the generic symbol @code{file-systems}. @end table @end deftp diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 85160bd3ab..a552438753 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -404,6 +404,7 @@ (define (file-system-shepherd-service file-system) (create? (file-system-create-mount-point? file-system)) (mount? (file-system-mount? file-system)) (dependencies (file-system-dependencies file-system)) + (requirements (file-system-shepherd-requirements file-system)) (packages (file-system-packages (list file-system)))) (and (or mount? create?) (with-imported-modules (source-module-closure @@ -412,7 +413,8 @@ (define (file-system-shepherd-service file-system) (provision (list (file-system->shepherd-service-name file-system))) (requirement `(root-file-system udev - ,@(map dependency->shepherd-service-name dependencies))) + ,@(map dependency->shepherd-service-name dependencies) + ,@requirements)) (documentation "Check, mount, and unmount the given file system.") (start #~(lambda args #$(if create? @@ -461,12 +463,20 @@ (define (file-system-shepherd-services file-systems) (or (file-system-mount? x) (file-system-create-mount-point? x))) file-systems))) + (define sink (shepherd-service (provision '(file-systems)) (requirement (cons* 'root-file-system 'user-file-systems (map file-system->shepherd-service-name - file-systems))) + ;; Do not require file systems with Shepherd + ;; requirements to provision + ;; 'file-systems. Many Shepherd services + ;; require 'file-systems, so we would likely + ;; deadlock. + (filter (lambda (file-system) + (null? (file-system-shepherd-requirements file-system))) + file-systems)))) (documentation "Target for all the initially-mounted file systems") (start #~(const #t)) (stop #~(const #f)))) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index c791b24a9f..4ea8237c70 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -57,6 +57,7 @@ (define-module (gnu system file-systems) file-system-repair file-system-create-mount-point? file-system-dependencies + file-system-shepherd-requirements file-system-location file-system-type-predicate @@ -161,33 +162,35 @@ (define-syntax validate-file-system-flags (define-record-type* file-system make-file-system file-system? - (device file-system-device) ; string | | - (mount-point file-system-mount-point) ; string - (type file-system-type) ; string - (flags file-system-flags ; list of symbols - (default '()) - (sanitize validate-file-system-flags)) - (options file-system-options ; string or #f - (default #f)) - (mount? file-system-mount? ; Boolean - (default #t)) - (mount-may-fail? file-system-mount-may-fail? ; Boolean - (default #f)) - (needed-for-boot? %file-system-needed-for-boot? ; Boolean - (default #f)) - (check? file-system-check? ; Boolean - (default #t)) - (skip-check-if-clean? file-system-skip-check-if-clean? ; Boolean - (default #t)) - (repair file-system-repair ; symbol or #f - (default 'preen)) - (create-mount-point? file-system-create-mount-point? ; Boolean - (default #f)) - (dependencies file-system-dependencies ; list of - (default '())) ; or - (location file-system-location - (default (current-source-location)) - (innate))) + (device file-system-device) ; string | | + (mount-point file-system-mount-point) ; string + (type file-system-type) ; string + (flags file-system-flags ; list of symbols + (default '()) + (sanitize validate-file-system-flags)) + (options file-system-options ; string or #f + (default #f)) + (mount? file-system-mount? ; Boolean + (default #t)) + (mount-may-fail? file-system-mount-may-fail? ; Boolean + (default #f)) + (needed-for-boot? %file-system-needed-for-boot? ; Boolean + (default #f)) + (check? file-system-check? ; Boolean + (default #t)) + (skip-check-if-clean? file-system-skip-check-if-clean? ; Boolean + (default #t)) + (repair file-system-repair ; symbol or #f + (default 'preen)) + (create-mount-point? file-system-create-mount-point? ; Boolean + (default #f)) + (dependencies file-system-dependencies ; list of + (default '())) ; or + (shepherd-requirements file-system-shepherd-requirements ; list of symbols + (default '())) + (location file-system-location + (default (current-source-location)) + (innate))) ;; A file system label for use in the 'device' field. (define-record-type -- 2.41.0