All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nfs-utils] modprobe: protect against sysctl errors
@ 2022-06-23  1:47 NeilBrown
  2022-06-27 14:34 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2022-06-23  1:47 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs


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>
---
 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
 
 # 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; }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nfs-utils] modprobe: protect against sysctl errors
  2022-06-23  1:47 [PATCH nfs-utils] modprobe: protect against sysctl errors NeilBrown
@ 2022-06-27 14:34 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2022-06-27 14:34 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-nfs



On 6/22/22 9:47 PM, NeilBrown wrote:
> 
> 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>
Committed... (tag: nfs-utils-2-6-2-rc8)

steved.
> ---
>   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
>   
>   # 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; }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-27 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23  1:47 [PATCH nfs-utils] modprobe: protect against sysctl errors NeilBrown
2022-06-27 14:34 ` Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.