Author: sef
Date: Thu Feb 21 01:30:37 2019
New Revision: 344402
URL: https://svnweb.freebsd.org/changeset/base/344402

Log:
  * 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.
  
  Reviewed by:  macklem
  MFC after:    2 weeks
  Sponsored by: iXsystems Inc.
  Differential Revision:        https://reviews.freebsd.org/D19153

Modified:
  head/sys/kgssapi/gss_impl.c
  head/usr.sbin/gssd/gssd.c

Modified: head/sys/kgssapi/gss_impl.c
==============================================================================
--- head/sys/kgssapi/gss_impl.c Thu Feb 21 00:44:26 2019        (r344401)
+++ head/sys/kgssapi/gss_impl.c Thu Feb 21 01:30:37 2019        (r344402)
@@ -112,6 +112,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: head/usr.sbin/gssd/gssd.c
==============================================================================
--- head/usr.sbin/gssd/gssd.c   Thu Feb 21 00:44:26 2019        (r344401)
+++ head/usr.sbin/gssd/gssd.c   Thu Feb 21 01:30:37 2019        (r344402)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to