From 437032b1d28a976f31404ecd1a7f06b1bf61cf1747b342ce780430020756dee8 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 11 Jul 2022 03:33:10 +0000 Subject: [PATCH] - 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 --- ...dprobe-protect-against-sysctl-errors.patch | 45 +++++++++++++++++++ ...d-error-messages-if-sbin-sysctl-fail.patch | 40 +++++++++++++++++ nfs-utils.changes | 9 ++++ nfs-utils.spec | 2 + 4 files changed, 96 insertions(+) create mode 100644 0004-modprobe-protect-against-sysctl-errors.patch create mode 100644 0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch diff --git a/0004-modprobe-protect-against-sysctl-errors.patch b/0004-modprobe-protect-against-sysctl-errors.patch new file mode 100644 index 0000000..f17cbbe --- /dev/null +++ b/0004-modprobe-protect-against-sysctl-errors.patch @@ -0,0 +1,45 @@ +From 5e60e38aa4ba251ef66610514be5f45c41519e0f Mon Sep 17 00:00:00 2001 +From: NeilBrown +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 +Signed-off-by: Steve Dickson +--- + 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; } diff --git a/0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch b/0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch new file mode 100644 index 0000000..9eb5722 --- /dev/null +++ b/0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch @@ -0,0 +1,40 @@ +From 040fc30d6d7684526c1556f20bc6bfec6b1c82ed Mon Sep 17 00:00:00 2001 +From: NeilBrown +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 +--- + 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; } diff --git a/nfs-utils.changes b/nfs-utils.changes index f3a0ed9..84325a5 100644 --- a/nfs-utils.changes +++ b/nfs-utils.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jul 11 03:31:08 UTC 2022 - Neil Brown + +- 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 diff --git a/nfs-utils.spec b/nfs-utils.spec index 5995991..802faa2 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -46,6 +46,8 @@ Patch1: gcc12-fix.patch Patch2: 0001-systemd-Apply-all-sysctl-settings-when-NFS-related-m.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 +Patch5: 0004-modprobe-protect-against-sysctl-errors.patch +Patch6: 0005-modprobe-avoid-error-messages-if-sbin-sysctl-fail.patch BuildRequires: e2fsprogs-devel BuildRequires: gcc-c++ BuildRequires: libtool