From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 2LYdA/jiKWayKwAAqHPOHw:P1 (envelope-from ) for ; Thu, 25 Apr 2024 06:58:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 2LYdA/jiKWayKwAAqHPOHw (envelope-from ) for ; Thu, 25 Apr 2024 06:58:32 +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=iNeKeskk; dmarc=none; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714021111; 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=vOPokPfPk8VpB87OVgfZvG+sPA5RYqb4xYKtITTM2GA=; b=tOPIRsXUB+vceZsjNabyCPTyo4xkBOgTQR7YA8yA9rdOKxXkSwGD01pGpcr5/zTR70k8Fx G6ajPNVFaEn0Tqn5mlSoiLrn+owV5DewqMHRO5yI4yeq9pu+OaCCNA8nOfU/JMVfCWBSn4 ElJkQ4XOnJEsBqg5D3Zv4mH1E1dZp06TzadaUIgvk5g9+dqebRg3MwqQTMz6CV/0/BB6qV 0mZ4oG6k39vsrs9iAb1kJCVaIQsXwktHxstxzBhJhbjPmiDnfVh+g4Wo0DhZVqkBEtBJMy AgrVlfDdMN4gKT5LgLn5LbCPSKN7QBmsMgsvU7kKMGhkZP90cDvHY0U2GHrRbQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=iNeKeskk; dmarc=none; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714021111; a=rsa-sha256; cv=none; b=O2SEvnLI1PpL+nB3VYoJnw5zU0El+BeICDZ1IReNgzszwlumMd3+0946+Wn6tNtcQRjmt9 qinXVNqNxOlJVXUxclLHoLIHbf/QzQpSsL7zGy/ZfcsiAJVMfIy/tfuhNVnPGLtnDdrgOg 0cvM+v3GYSGzGnd3XJ4Sz5VEQ24bB0rRb/gH0tUn8ekdYhjQ+M11PXtljy+b1HmpisFr5c 4yx9qyfsYGVTMR6pqejKqgrGhZvRncIt8ZWDUfhydpmqmADShoBhQ/mPj1Tx9cZyYg2rs2 SnsHqzBXJWP54JQhCO7yJEVDEjTlM5kZX3NEhF+iLqaNmA1GFEB9aYU/o8zmbQ== 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 8052067B9D for ; Thu, 25 Apr 2024 06:58:31 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzrBK-0007ly-B8; Thu, 25 Apr 2024 00:58:02 -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 1rzrB6-0007j5-Va for guix-patches@gnu.org; Thu, 25 Apr 2024 00:57:50 -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 1rzrB6-0004cl-Mz for guix-patches@gnu.org; Thu, 25 Apr 2024 00:57:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzrBN-0008Sn-Sj for guix-patches@gnu.org; Thu, 25 Apr 2024 00:58:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70542] [PATCH v2 1/3] services: base: Add optional delayed mount of file-systems References: In-Reply-To: Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Apr 2024 04:58:05 +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 Received: via spool by 70542-submit@debbugs.gnu.org id=B70542.171402108232510 (code B ref 70542); Thu, 25 Apr 2024 04:58:05 +0000 Received: (at 70542) by debbugs.gnu.org; 25 Apr 2024 04:58:02 +0000 Received: from localhost ([127.0.0.1]:60328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzrBE-0008RN-W1 for submit@debbugs.gnu.org; Thu, 25 Apr 2024 00:58:01 -0400 Received: from mail-108-mta59.mxroute.com ([136.175.108.59]:42921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzrB8-0008Q2-CM for 70542@debbugs.gnu.org; Thu, 25 Apr 2024 00:57:54 -0400 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta59.mxroute.com (ZoneMTA) with ESMTPSA id 18f139da3e90008ca2.001 for <70542@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 25 Apr 2024 04:57:29 +0000 X-Zone-Loop: fa98ce4f2a9aeb040a47bb2faeba62812971e77ca3e6 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: 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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vOPokPfPk8VpB87OVgfZvG+sPA5RYqb4xYKtITTM2GA=; b=iNeKeskk5xV5Va5EDP2FbPjXEM SD5JzTs6qn430GuNHiPxYykgYKTzLrTTh+TlL9ZnsHWEJqz6Jb51ZYWoZZkmwUVbVfofntDm1gqfk p5mVBidOl4yNv6NDiawUkkJeku9i5fSQ7ts9wDAZ0w+MHXj9rJcEVsUTecrys/lidlZkl631VIEa2 l7BV6z5uojXj3tR199y/AUM8Faouk3n9FErQ7PKm/Hqe0FOxKzYmG33Of1SuKkJl0IouaacvTTgmR M/TctQQI3AmW7aLcfZJd/mUX4/pGIRog7Wn2XJdhwATluNoxSV+vhSQbsrz+hsg8b3Y8/hO5FdTf6 hYMdtg9A==; From: Richard Sent Date: Thu, 25 Apr 2024 00:56:03 -0400 Message-ID: <784e7f59e64d7d8c29f7e0207f5d15727cdd8ba2.1714020965.git.richard@freakingpenguin.com> 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: -4.89 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -4.89 X-Migadu-Queue-Id: 8052067B9D X-TUID: 0Iw/lLd+vQ/p 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. * gnu/services/base.scm (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 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 requirements. Change-Id: If0392db03d48e8820aa53df1df482c12ec72e1a5 --- doc/guix.texi | 13 +++++++++++++ gnu/services/base.scm | 14 ++++++++++++-- gnu/system/file-systems.scm | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3ee9f54773..5c89e2110f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17750,6 +17750,19 @@ 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{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 requirements field +are mounted after Shepherd services have begun. Any Shepherd service +that depends on a file system with a non-empty 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 3f912225a0..4fd946c4aa 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -403,6 +403,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-requirements file-system)) (packages (file-system-packages (list file-system)))) (and (or mount? create?) (with-imported-modules (source-module-closure @@ -411,7 +412,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? @@ -460,12 +462,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-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 af0567bd3e..76a51a2b69 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-requirements file-system-location file-system-type-predicate @@ -185,6 +186,8 @@ (define-record-type* file-system (default #f)) (dependencies file-system-dependencies ; list of (default '())) ; or + (requirements file-system-requirements ; list of symbols + (default '())) (location file-system-location (default (current-source-location)) (innate))) base-commit: 91d9e145e15241c20729a4f1fa43f3d662f6b806 -- 2.41.0