Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5377221iog; Wed, 22 Jun 2022 18:52:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u5qHq5TnpwJIjnLVyW5D9LXHj2BY6SXp1aJW/FAiUZ+kBEiF4qBRAuN1Ye9rhReTbZqkyA X-Received: by 2002:aa7:d685:0:b0:435:7910:f110 with SMTP id d5-20020aa7d685000000b004357910f110mr7507897edr.247.1655949139404; Wed, 22 Jun 2022 18:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655949139; cv=none; d=google.com; s=arc-20160816; b=dfVdMbNv6eGQm/rTm+p5u+CTG8thd7Kz8ejqQr2xq9QaZMkZ1fbCx3C8EpClLbyygq tdRtHKaMPTgHsiS8x1jciifsqRDT8ICtCVpL7AQVMnbdzshj1MdwskJBUpo2pFGUwg+L ubEtBGJH2k+V2CIh3M3bEgav2tyeizzCBq9cqudHG8bzxP5UttN3pBmw8CABg5HAyRiB EuPmFwWtI0icK6/J8fGY3e0dubccd9CXvqUcdHUoBHxP8o6W6uW4Tl0i4AE8GVepEyJ2 tOn/LYzA5//S+OQv7uF9L0cE8oNNIBbxlMpLzy5h3JfqQBtuKveeVRlvjEJtpw+ThhsI H71w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=I1DqH5K0Sn0dM/JTC6+NRFvJvl9VHcLAqI0Igel49c4=; b=irTAP1qydgrq+AXjYWWqe3kAVpOcPdPTnmNvQgTriAM9QjvwqwCb/bvb8W0iHTVCPa QmGHiTkEZHuvivlJsmyOdiBCSkHlMd5m0XnJYCj3hq5kFMR3BYktIjjUOby4jaMR+J66 wnWVkvNelYZLoSDfXQ4Lfuau7aHd4ZGhefr3QXScFzDApm041igXo4upSqX2CQQa7ywc sUZ7hKmA48oBUSKMnc5HzeFTDpuLa+vCl3vZk5L1jhtNsQelL1Sz7Br+OwcoPdPIG1Ra C89pGrzz3k+5TD84JfreCuSiQ3MnNhF4htPyPPk1Sdb0W1KWkXgYPGuLHdn0ujWsDGnv 3u7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KToxm9f+; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs37-20020a1709072d2500b0070758cf771fsi9793946ejc.463.2022.06.22.18.51.54; Wed, 22 Jun 2022 18:52:19 -0700 (PDT) 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=@suse.de header.s=susede2_rsa header.b=KToxm9f+; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377187AbiFWBrq (ORCPT + 99 others); Wed, 22 Jun 2022 21:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359719AbiFWBrp (ORCPT ); Wed, 22 Jun 2022 21:47:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1F8443ACC for ; Wed, 22 Jun 2022 18:47:44 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 64BD221C66; Thu, 23 Jun 2022 01:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655948863; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I1DqH5K0Sn0dM/JTC6+NRFvJvl9VHcLAqI0Igel49c4=; b=KToxm9f+9QjR9kcVVnaCTP0yY5wrtTF/ONWFYMT59VVI+Ge+xTYdc8mK57B+Wyn6UdVlMs 6B61kyqUXVBmWFk9MqajwEGJ4FN9dGJYiBjfJ0xUKNwx30D5H3imGOnahuijlKhQRp1oyi ujP8ZBp39Dlus581CD1LCKs1Aiiy6M0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655948863; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I1DqH5K0Sn0dM/JTC6+NRFvJvl9VHcLAqI0Igel49c4=; b=1S3NU9/PHMjmR8EwNiPgn6pn9I7Za/774x9kIW1QxdpZX0d3NHijPG2CUF86w2DJWJqHAQ 3lhdJApzChU6sRBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8827013461; Thu, 23 Jun 2022 01:47:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Sg+2ED7Gs2KwWwAAMHmgww (envelope-from ); Thu, 23 Jun 2022 01:47:42 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: Steve Dickson Cc: linux-nfs Subject: [PATCH nfs-utils] modprobe: protect against sysctl errors Date: Thu, 23 Jun 2022 11:47:39 +1000 Message-id: <165594885936.4786.14207888490098319610@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 If there is an error running sysctl, a modprobe of these modules will fail. We probably don't want that - missing a sysctl is unlikely to be fatal. A real possibility is that /sbin/sysctl might not exist at all, such as in a initramfs. In that case we definitely don't want modprobe to fail. So make the scriptlets safe. Signed-off-by: NeilBrown --- systemd/50-nfs.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/systemd/50-nfs.conf b/systemd/50-nfs.conf index b56b2d765969..19e8ee734c8e 100644 --- a/systemd/50-nfs.conf +++ b/systemd/50-nfs.conf @@ -1,16 +1,16 @@ # Ensure all NFS systctl settings get applied when modules load =20 # sunrpc module supports "sunrpc.*" sysctls -install sunrpc /sbin/modprobe --ignore-install sunrpc $CMDLINE_OPTS && /sbin= /sysctl -q --pattern sunrpc --system +install sunrpc /sbin/modprobe --ignore-install sunrpc $CMDLINE_OPTS && { /sb= in/sysctl -q --pattern sunrpc --system; exit 0; } =20 # rpcrdma module supports sunrpc.svc_rdma.* -install rpcrdma /sbin/modprobe --ignore-install rpcrdma $CMDLINE_OPTS && /sb= in/sysctl -q --pattern sunrpc.svc_rdma --system +install rpcrdma /sbin/modprobe --ignore-install rpcrdma $CMDLINE_OPTS && { /= sbin/sysctl -q --pattern sunrpc.svc_rdma --system; exit 0; } =20 # lockd module supports "fs.nfs.nlm*" and "fs.nfs.nsm*" sysctls -install lockd /sbin/modprobe --ignore-install lockd $CMDLINE_OPTS && /sbin/s= ysctl -q --pattern fs.nfs.n[sl]m --system +install lockd /sbin/modprobe --ignore-install lockd $CMDLINE_OPTS && { /sbin= /sysctl -q --pattern fs.nfs.n[sl]m --system; exit 0; } =20 # nfsv4 module supports "fs.nfs.*" sysctls (nfs_callback_tcpport and idmap_c= ache_timeout) -install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && /sbin/s= ysctl -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --syst= em +install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && { /sbin= /sysctl -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --sy= stem; exit 0; } =20 # nfs module supports "fs.nfs.*" sysctls -install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && /sbin/sysct= l -q --pattern fs.nfs --system +install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && { /sbin/sys= ctl -q --pattern fs.nfs --system; exit 0; } --=20 2.36.1