From 4e9982038a66fadf574ba19e4731a31d1972e1d7 Mon Sep 17 00:00:00 2001 From: dfr Date: Sun, 3 Feb 2019 08:15:26 +0000 Subject: [PATCH] Reduce log spam from rpc.statd This only reports failed attempts to contact hosts on the first attempt. --- usr.sbin/rpc.statd/file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/rpc.statd/file.c b/usr.sbin/rpc.statd/file.c index c2207c73aebf..ed5d00cc808c 100644 --- a/usr.sbin/rpc.statd/file.c +++ b/usr.sbin/rpc.statd/file.c @@ -248,9 +248,12 @@ void init_file(const char *filename) /* Purpose: Perform SM_NOTIFY procedure at specified host Returns: TRUE if success, FALSE if failed. + Notes: Only report failure if verbose is non-zero. Caller will + only set verbose to non-zero for the first attempt to + contact the host. */ -static int notify_one_host(char *hostname) +static int notify_one_host(char *hostname, int verbose) { struct timeval timeout = { 20, 0 }; /* 20 secs timeout */ CLIENT *cli; @@ -277,7 +280,8 @@ static int notify_one_host(char *hostname) (xdrproc_t)xdr_void, &dummy, timeout) != RPC_SUCCESS) { - syslog(LOG_ERR, "Failed to contact rpc.statd at host %s", hostname); + if (verbose) + syslog(LOG_ERR, "Failed to contact rpc.statd at host %s", hostname); clnt_destroy(cli); return (FALSE); } @@ -346,7 +350,7 @@ void notify_hosts(void) { if (hp->notifyReqd) { - if (notify_one_host(hp->hostname)) + if (notify_one_host(hp->hostname, attempts == 0)) { hp->notifyReqd = FALSE; sync_file();