svn commit: r346768 - in stable/11: sys/kgssapi usr.sbin/gssd

Alexander Motin mav at FreeBSD.org
Fri Apr 26 21:34:10 UTC 2019


Author: mav
Date: Fri Apr 26 21:34:08 2019
New Revision: 346768
URL: https://svnweb.freebsd.org/changeset/base/346768

Log:
  MFC r344402 (by sef):
  
  * Handle SIGPIPE in gssd
  We've got some cases where the other end of gssd's AF_LOCAL socket gets
  closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
  Closing without cleaning up means the next time nfsd starts up, it hangs,
  unkillably; this allows gssd to handle that particular error.
  
  * Limit the retry cound in gssd_syscall to 5.
  The default is INT_MAX, which effectively means forever.  And it's an
  uninterruptable RPC call, so it will never stop.
  
  The two changes mitigate the problem.

Modified:
  stable/11/sys/kgssapi/gss_impl.c
  stable/11/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kgssapi/gss_impl.c
==============================================================================
--- stable/11/sys/kgssapi/gss_impl.c	Fri Apr 26 21:21:55 2019	(r346767)
+++ stable/11/sys/kgssapi/gss_impl.c	Fri Apr 26 21:34:08 2019	(r346768)
@@ -116,6 +116,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal
 		cl = clnt_reconnect_create(nconf,
 		    (struct sockaddr *) &sun, GSSD, GSSDVERS,
 		    RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+		/*
+		 * The number of retries defaults to INT_MAX, which effectively
+		 * means an infinite, uninterruptable loop.  Limiting it to
+		 * five retries keeps it from running forever.
+		 */
+		if (cl != NULL) {
+			int retry_count = 5;
+			CLNT_CONTROL(cl, CLSET_RETRIES, &retry_count);
+		}
 	} else
 		cl = NULL;
 

Modified: stable/11/usr.sbin/gssd/gssd.c
==============================================================================
--- stable/11/usr.sbin/gssd/gssd.c	Fri Apr 26 21:21:55 2019	(r346767)
+++ stable/11/usr.sbin/gssd/gssd.c	Fri Apr 26 21:34:08 2019	(r346768)
@@ -202,6 +202,7 @@ main(int argc, char **argv)
 		signal(SIGHUP, SIG_IGN);
 	}
 	signal(SIGTERM, gssd_terminate);
+	signal(SIGPIPE, gssd_terminate);
 
 	memset(&sun, 0, sizeof sun);
 	sun.sun_family = AF_LOCAL;


More information about the svn-src-stable-11 mailing list