Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10624443rwb; Fri, 25 Nov 2022 06:22:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5qpOOyZBHh3XlaS9l4brtYSd/rSahUp7q+0UG23YHBOlh/XYbMbvv1t8QtovjzTLxC7NdP X-Received: by 2002:a05:6402:512:b0:46a:6e7f:5f10 with SMTP id m18-20020a056402051200b0046a6e7f5f10mr9462283edv.152.1669386144706; Fri, 25 Nov 2022 06:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669386144; cv=none; d=google.com; s=arc-20160816; b=tyMqZA7JTZigimnCh+ohyNu/eTRHP7JP6Zuj37beAXXyHbrwrIK2KBQ2s14sjZve3O 95lGNNLDJSfgKeV9TztxVTpqiyfH5gTB48/R66fkaWOw/NiB6xM0NaKS6WgwgwFG/ZPa rnQspC0Aohp4m1HaAZUIibPr95rcHRLYG/8CM8ekXPCyHHfoWH/d6F57vD5SANRIBTPV HVj9H/bfXGvPqWPWp/cAwDoHmnydjU57ZXH2qve1FINLIscZUNODaQs550FppXOu/MDz STbNNTds613tZ5oXojXqbCCDF0m1fiDi9HuJZo3gXbgfP6YiU8at5HhxV+cxy9dgjEs+ O5dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=GTsWQvlEqqVwiOjKpOvkoA8zjB47gy5ea89jv3NKayE=; b=08SK3XAaDeQNnG/hmGbKP+SIepLkqNhRYeD4fDNIxttMgn/SPVKtnG/RL+NIlCFe9M klUf6sdB8Ev4AYpeVxtnLsMTJ8POEZipNZnKCi2Kb+sfa7rsR+w3oAvDlIDB4Tqs7mS5 xOgsuy95b6Y+fONcEax9Qe9CjqfaXOVAupjzf31mX/azS0wjGzAtxLVzEiV3URat8GDJ i3HOAo0ElwdDmoTd2NtdtRowBl579JN+D/GNfMn+6SmATUpLeHbDqT6/p0Bz79L/A911 pGvay7WCJ6JBBCnigXMlWnNk3aAIYmA8a+HmO9uEoqBlXp+CciD8kml7mAyzHg26+UNg s5aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=C9zUZE63; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne4-20020a1709077b8400b007ade01e723bsi3116843ejc.30.2022.11.25.06.21.50; Fri, 25 Nov 2022 06:22:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=C9zUZE63; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229694AbiKYOHM (ORCPT + 99 others); Fri, 25 Nov 2022 09:07:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiKYOHL (ORCPT ); Fri, 25 Nov 2022 09:07:11 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B816A1EAFA for ; Fri, 25 Nov 2022 06:07:10 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id z63so6555716ede.1 for ; Fri, 25 Nov 2022 06:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=GTsWQvlEqqVwiOjKpOvkoA8zjB47gy5ea89jv3NKayE=; b=C9zUZE63kwLkbT3VfWqXZJtSdShajv4A/h5IJq2uoyjI1Y6FTbkRsyzq0ffE/zGR/J TSl4zCvBM3MS7ZCB3zrpLrUQg69ySrgQy2xsfzCIJzTIYMyoWdoXYV2Ce78FOuwxdeU+ ywAIMOQskaNqsO9u44t5mnldQJY7BePcdJf7YXi1pFQmanLbDSE2uuJqTnbksVv7w1+Q E+FAaakZCUu3JTraaugTIrsPr4hKUW979bN531LGKbPWBg1CWgV8ctMhuy9n6SdRyf9g 9hd7TTOzhfoxPXPYZzva0LXOJWndblSIU2uEIi5qo634LgONa2YUMB82A2LJ8s50eNdI qLlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GTsWQvlEqqVwiOjKpOvkoA8zjB47gy5ea89jv3NKayE=; b=OEmcxRvdTaaMl3dQub3pK3ZjcWaW6o2uqQR7NAw6apcnEph3JQvrwYN5JWg1q6fAr0 NyokNRsgtSCRVm6HnwWZgFQv2Kc8Zh17+fQ+yH4Ywtpj4n4JE8NUXM+TsRUBcjQ7Ah+0 hDasLna73zhuODt7BDeXVLGtFc8rZ5IEbP/sFJw/cr3eLzD12u7MxitvxxEBGgczxMlk N8LF8t8Ph90B9woE5ODxmdTmljpaoZKvAjcexfOLwnBX/5xiOdrMmZIFcqBBtB9Y7zKo YsHEQEylHXY48lXRlsskXfNTG4VWziDGTl+VLF3fB0I8p2k28ITZXdcrGDlTitc0rrG8 SGww== X-Gm-Message-State: ANoB5pmcefUsGeaR/CVs9p0ric5G4oXzp/7wOhyjjweoqcZHs/zjssYD NIrjp0lCElYZfj4aqFLvay4= X-Received: by 2002:a05:6402:360a:b0:469:f59f:352e with SMTP id el10-20020a056402360a00b00469f59f352emr15541686edb.241.1669385229198; Fri, 25 Nov 2022 06:07:09 -0800 (PST) Received: from eldamar.lan (c-82-192-242-114.customer.ggaweb.ch. [82.192.242.114]) by smtp.gmail.com with ESMTPSA id b7-20020a17090630c700b0077a11b79b9bsm1575728ejb.133.2022.11.25.06.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 06:07:08 -0800 (PST) Sender: Salvatore Bonaccorso Received: by eldamar.lan (Postfix, from userid 1000) id 1EE22BE2EE7; Fri, 25 Nov 2022 15:07:08 +0100 (CET) From: Salvatore Bonaccorso To: NeilBrown , Steve Dickson , linux-nfs@vger.kernel.org Cc: Andras Korn , Marco d'Itri , Michael Prokop , Salvatore Bonaccorso Subject: [PATCH v2 4/4] systemd: Apply all sysctl settings through udev rule when NFS-related modules are loaded Date: Fri, 25 Nov 2022 15:06:56 +0100 Message-Id: <20221125140656.1985137-5-carnil@debian.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125140656.1985137-1-carnil@debian.org> References: <20221125140656.1985137-1-carnil@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org sysctl settings (e.g. /etc/sysctl.conf and others) are normally loaded once at boot. If the module that implements some settings is no yet loaded, those settings don't get applied. Various NFS modules support various sysctl settings. If they are loaded after boot, they miss out. Add a new udev rule configuration to udev/rules.d/60-nfs.rules to apply the relevant settings when the modules are loaded. Placing it in the systemd directory similarly as the choice for the original commit afc7132dfb21 ("systemd: Apply all sysctl settings when NFS-related modules are loaded"). Link: https://lore.kernel.org/linux-nfs/Y1KoKwu88PulcokW@eldamar.lan/ Link: https://bugs.debian.org/1022172 Link: https://bugs.debian.org/1024082 Suggested-by: Marco d'Itri Signed-off-by: Salvatore Bonaccorso --- systemd/60-nfs.rules | 21 +++++++++++++++++++++ systemd/Makefile.am | 9 +++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 systemd/60-nfs.rules diff --git a/systemd/60-nfs.rules b/systemd/60-nfs.rules new file mode 100644 index 000000000000..188423c1d2e3 --- /dev/null +++ b/systemd/60-nfs.rules @@ -0,0 +1,21 @@ +# Ensure all NFS systctl settings get applied when modules load + +# sunrpc module supports "sunrpc.*" sysctls +ACTION=="add", SUBSYSTEM=="module", KERNEL=="sunrpc", \ + RUN+="/sbin/sysctl -q --pattern ^sunrpc --system" + +# rpcrdma module supports sunrpc.svc_rdma.* +ACTION=="add", SUBSYSTEM=="module", KERNEL=="rpcrdma", \ + RUN+="/sbin/sysctl -q --pattern ^sunrpc.svc_rdma --system" + +# lockd module supports "fs.nfs.nlm*" and "fs.nfs.nsm*" sysctls +ACTION=="add", SUBSYSTEM=="module", KERNEL=="lockd", \ + RUN+="/sbin/sysctl -q --pattern ^fs.nfs.n[sl]m --system" + +# nfsv4 module supports "fs.nfs.*" sysctls (nfs_callback_tcpport and idmap_cache_timeout) +ACTION=="add", SUBSYSTEM=="module", KERNEL=="nfsv4", \ + RUN+="/sbin/sysctl -q --pattern ^fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout) --system" + +# nfs module supports "fs.nfs.*" sysctls +ACTION=="add", SUBSYSTEM=="module", KERNEL=="nfs", \ + RUN+="/sbin/sysctl -q --pattern ^fs.nfs --system" diff --git a/systemd/Makefile.am b/systemd/Makefile.am index e7f5d818a913..577c6a2286c0 100644 --- a/systemd/Makefile.am +++ b/systemd/Makefile.am @@ -2,6 +2,9 @@ MAINTAINERCLEANFILES = Makefile.in +udev_rulesdir = /usr/lib/udev/rules.d/ +udev_files = 60-nfs.rules + unit_files = \ nfs-client.target \ rpc_pipefs.target \ @@ -51,7 +54,7 @@ endif man5_MANS = nfs.conf.man man7_MANS = nfs.systemd.man -EXTRA_DIST = $(unit_files) $(man5_MANS) $(man7_MANS) +EXTRA_DIST = $(unit_files) $(udev_files) $(man5_MANS) $(man7_MANS) generator_dir = $(unitdir)/../system-generators @@ -73,8 +76,10 @@ rpc_pipefs_generator_LDADD = ../support/nfs/libnfs.la if INSTALL_SYSTEMD genexec_PROGRAMS = nfs-server-generator rpc-pipefs-generator -install-data-hook: $(unit_files) +install-data-hook: $(unit_files) $(udev_files) mkdir -p $(DESTDIR)/$(unitdir) cp $(unit_files) $(DESTDIR)/$(unitdir) cp $(rpc_pipefs_mount_file) $(DESTDIR)/$(unitdir)/$(rpc_pipefsmount) + mkdir -p $(DESTDIR)/$(udev_rulesdir) + cp $(udev_files) $(DESTDIR)/$(udev_rulesdir) endif -- 2.38.1