- 0004-modprobe-protect-against-sysctl-errors.patch

0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch
 Suppress any errors from /sbin/sysctl, if for example, it isn't
 installed
 (bsc#1200710)

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=261
This commit is contained in:
Neil Brown 2022-07-11 03:33:10 +00:00 committed by Git OBS Bridge
parent 4a61694a00
commit 437032b1d2
4 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,45 @@
From 5e60e38aa4ba251ef66610514be5f45c41519e0f Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 27 Jun 2022 10:27:06 -0400
Subject: [PATCH] modprobe: protect against sysctl errors
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 <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
systemd/50-nfs.conf | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/systemd/50-nfs.conf
+++ b/systemd/50-nfs.conf
@@ -1,16 +1,16 @@
# Ensure all NFS systctl settings get applied when modules load
# 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 && { /sbin/sysctl -q --pattern sunrpc --system; exit 0; }
# rpcrdma module supports sunrpc.svc_rdma.*
-install rpcrdma /sbin/modprobe --ignore-install rpcrdma $CMDLINE_OPTS && /sbin/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; }
# lockd module supports "fs.nfs.nlm*" and "fs.nfs.nsm*" sysctls
-install lockd /sbin/modprobe --ignore-install lockd $CMDLINE_OPTS && /sbin/sysctl -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; }
# nfsv4 module supports "fs.nfs.*" sysctls (nfs_callback_tcpport and idmap_cache_timeout)
-install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && /sbin/sysctl -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --system
+install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && { /sbin/sysctl -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --system; exit 0; }
# nfs module supports "fs.nfs.*" sysctls
-install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && /sbin/sysctl -q --pattern fs.nfs --system
+install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && { /sbin/sysctl -q --pattern fs.nfs --system; exit 0; }

View File

@ -0,0 +1,40 @@
From 040fc30d6d7684526c1556f20bc6bfec6b1c82ed Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 11 Jul 2022 13:25:38 +1000
Subject: [PATCH] modprobe: avoid error messages if /sbin/sysctl fail
If /sbin/sysctl fails, for example if it is not installed, then the
install line does not fail but we can still get an error message in the
logs, which could be annoying.
So hide any such error message - send it to /dev/null
Signed-off-by: NeilBrown <neilb@suse.de>
---
systemd/50-nfs.conf | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/systemd/50-nfs.conf
+++ b/systemd/50-nfs.conf
@@ -1,16 +1,16 @@
# Ensure all NFS systctl settings get applied when modules load
# sunrpc module supports "sunrpc.*" sysctls
-install sunrpc /sbin/modprobe --ignore-install sunrpc $CMDLINE_OPTS && { /sbin/sysctl -q --pattern sunrpc --system; exit 0; }
+install sunrpc /sbin/modprobe --ignore-install sunrpc $CMDLINE_OPTS && { /sbin/sysctl 2> /dev/null -q --pattern sunrpc --system; exit 0; }
# rpcrdma module supports sunrpc.svc_rdma.*
-install rpcrdma /sbin/modprobe --ignore-install rpcrdma $CMDLINE_OPTS && { /sbin/sysctl -q --pattern sunrpc.svc_rdma --system; exit 0; }
+install rpcrdma /sbin/modprobe --ignore-install rpcrdma $CMDLINE_OPTS && { /sbin/sysctl 2> /dev/null -q --pattern sunrpc.svc_rdma --system; exit 0; }
# lockd module supports "fs.nfs.nlm*" and "fs.nfs.nsm*" sysctls
-install lockd /sbin/modprobe --ignore-install lockd $CMDLINE_OPTS && { /sbin/sysctl -q --pattern fs.nfs.n[sl]m --system; exit 0; }
+install lockd /sbin/modprobe --ignore-install lockd $CMDLINE_OPTS && { /sbin/sysctl 2> /dev/null -q --pattern fs.nfs.n[sl]m --system; exit 0; }
# nfsv4 module supports "fs.nfs.*" sysctls (nfs_callback_tcpport and idmap_cache_timeout)
-install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && { /sbin/sysctl -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --system; exit 0; }
+install nfsv4 /sbin/modprobe --ignore-install nfsv4 $CMDLINE_OPTS && { /sbin/sysctl 2> /dev/null -q --pattern 'fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout)' --system; exit 0; }
# nfs module supports "fs.nfs.*" sysctls
-install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && { /sbin/sysctl -q --pattern fs.nfs --system; exit 0; }
+install nfs /sbin/modprobe --ignore-install nfs $CMDLINE_OPTS && { /sbin/sysctl 2> /dev/null -q --pattern fs.nfs --system; exit 0; }

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jul 11 03:31:08 UTC 2022 - Neil Brown <nfbrown@suse.com>
- 0004-modprobe-protect-against-sysctl-errors.patch
0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch
Suppress any errors from /sbin/sysctl, if for example, it isn't
installed
(bsc#1200710)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jun 9 06:49:11 UTC 2022 - Neil Brown <nfbrown@suse.com> Thu Jun 9 06:49:11 UTC 2022 - Neil Brown <nfbrown@suse.com>

View File

@ -46,6 +46,8 @@ Patch1: gcc12-fix.patch
Patch2: 0001-systemd-Apply-all-sysctl-settings-when-NFS-related-m.patch Patch2: 0001-systemd-Apply-all-sysctl-settings-when-NFS-related-m.patch
Patch3: 0002-Update-autoconfig-files-to-work-with-v2.71.patch Patch3: 0002-Update-autoconfig-files-to-work-with-v2.71.patch
Patch4: 0003-autoconf-change-tirpc-to-check-for-a-file-not-for-an.patch Patch4: 0003-autoconf-change-tirpc-to-check-for-a-file-not-for-an.patch
Patch5: 0004-modprobe-protect-against-sysctl-errors.patch
Patch6: 0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch
BuildRequires: e2fsprogs-devel BuildRequires: e2fsprogs-devel
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: libtool BuildRequires: libtool