[PATCH] ctdb-scripts: Fix tcp_tw_recycle existence check
Martin Schwenke
martin at meltin.net
Mon Jun 3 14:40:59 UTC 2019
On Sun, 2 Jun 2019 23:44:15 -0300, Rafael David Tinoco via
samba-technical <samba-technical at lists.samba.org> wrote:
> net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 but, still,
> makes sense to check its existence. Unfortunately, current check does
> not test for the procfs file existence. This commit fixes the issue.
>
> Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
> ---
> ctdb/config/nfs-linux-kernel-callout | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout
> index def69a04649..71d8ecf8074 100755
> --- a/ctdb/config/nfs-linux-kernel-callout
> +++ b/ctdb/config/nfs-linux-kernel-callout
> @@ -281,8 +281,8 @@ nfs_startup ()
> basic_stop "nfs" || true
> basic_start "nfs"
> _f="${PROCFS_PATH}/sys/net/ipv4/tcp_tw_recycle"
> - if [ "$_f" ] ; then
> - echo 1 >"$_f"
> + if [ -f "$_f" ] ; then
> + echo 1 >"$_f"
> fi
> }
I actually prefer this version. The script already guarantees that
PROCFS_PATH is set, so let's not complicate this fix with an
unnecessary check.
Now that I'm old, I also prefer the explicit if-statement in this
version, instead of the && pipeline in the later version. The more
verbose if-statement is easier to read. :-)
Reviewed-by: Martin Schwenke <martin at meltin.net>
Can the 2nd reviewer please add:
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13984
to the commit message before pushing? We will backport this fix to
stable releases...
Thanks!
peace & happiness,
martin
More information about the samba-technical
mailing list