Blame SOURCES/nfs-utils-1.3.0-rpcgssd-timeout.patch

4f2874
diff -up nfs-utils-1.3.0/utils/gssd/gssd.c.orig nfs-utils-1.3.0/utils/gssd/gssd.c
4f2874
--- nfs-utils-1.3.0/utils/gssd/gssd.c.orig	2014-09-17 13:00:22.702932025 -0400
4f2874
+++ nfs-utils-1.3.0/utils/gssd/gssd.c	2014-09-17 13:00:26.575004049 -0400
4f2874
@@ -64,6 +64,7 @@ char *ccachesearch[GSSD_MAX_CCACHE_SEARC
4f2874
 int  use_memcache = 0;
4f2874
 int  root_uses_machine_creds = 1;
4f2874
 unsigned int  context_timeout = 0;
4f2874
+unsigned int  rpc_timeout = 5;
4f2874
 char *preferred_realm = NULL;
4f2874
 int pipefds[2] = { -1, -1 };
4f2874
 
4f2874
@@ -105,7 +106,7 @@ main(int argc, char *argv[])
4f2874
 	char *progname;
4f2874
 
4f2874
 	memset(ccachesearch, 0, sizeof(ccachesearch));
4f2874
-	while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:R:")) != -1) {
4f2874
+	while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
4f2874
 		switch (opt) {
4f2874
 			case 'f':
4f2874
 				fg = 1;
4f2874
@@ -143,6 +144,9 @@ main(int argc, char *argv[])
4f2874
 			case 't':
4f2874
 				context_timeout = atoi(optarg);
4f2874
 				break;
4f2874
+			case 'T':
4f2874
+				rpc_timeout = atoi(optarg);
4f2874
+				break;
4f2874
 			case 'R':
4f2874
 				preferred_realm = strdup(optarg);
4f2874
 				break;
4f2874
diff -up nfs-utils-1.3.0/utils/gssd/gssd.h.orig nfs-utils-1.3.0/utils/gssd/gssd.h
4f2874
--- nfs-utils-1.3.0/utils/gssd/gssd.h.orig	2014-09-17 13:00:22.702932025 -0400
4f2874
+++ nfs-utils-1.3.0/utils/gssd/gssd.h	2014-09-17 13:00:26.575004049 -0400
4f2874
@@ -66,6 +66,7 @@ extern char			*ccachesearch[];
4f2874
 extern int			use_memcache;
4f2874
 extern int			root_uses_machine_creds;
4f2874
 extern unsigned int 		context_timeout;
4f2874
+extern unsigned int rpc_timeout;
4f2874
 extern char			*preferred_realm;
4f2874
 extern int			pipefds[2];
4f2874
 
4f2874
diff -up nfs-utils-1.3.0/utils/gssd/gssd.man.orig nfs-utils-1.3.0/utils/gssd/gssd.man
4f2874
--- nfs-utils-1.3.0/utils/gssd/gssd.man.orig	2014-09-17 13:00:22.702932025 -0400
4f2874
+++ nfs-utils-1.3.0/utils/gssd/gssd.man	2014-09-17 13:00:26.575004049 -0400
4f2874
@@ -289,6 +289,14 @@ new kernel contexts to be negotiated aft
4f2874
 seconds, which allows changing Kerberos tickets and identities frequently.
4f2874
 The default is no explicit timeout, which means the kernel context will live
4f2874
 the lifetime of the Kerberos service ticket used in its creation.
4f2874
+.TP
4f2874
+.B -T timeout
4f2874
+Timeout, in seconds, to create an RPC connection with a server while
4f2874
+establishing an authenticated gss context for a user.
4f2874
+The default timeout is set to 5 seconds.
4f2874
+If you get messages like "WARNING: can't create tcp rpc_clnt to server
4f2874
+%servername% for user with uid %uid%: RPC: Remote system error -
4f2874
+Connection timed out", you should consider an increase of this timeout.
4f2874
 .SH SEE ALSO
4f2874
 .BR rpc.svcgssd (8),
4f2874
 .BR kerberos (1),
4f2874
diff -up nfs-utils-1.3.0/utils/gssd/gssd_proc.c.orig nfs-utils-1.3.0/utils/gssd/gssd_proc.c
4f2874
--- nfs-utils-1.3.0/utils/gssd/gssd_proc.c.orig	2014-09-17 13:00:22.702932025 -0400
4f2874
+++ nfs-utils-1.3.0/utils/gssd/gssd_proc.c	2014-09-17 13:00:26.575004049 -0400
4f2874
@@ -842,7 +842,7 @@ create_auth_rpc_client(struct clnt_info
4f2874
 	OM_uint32		min_stat;
4f2874
 	char			rpc_errmsg[1024];
4f2874
 	int			protocol;
4f2874
-	struct timeval		timeout = {5, 0};
4f2874
+	struct timeval	timeout;
4f2874
 	struct sockaddr		*addr = (struct sockaddr *) &clp->addr;
4f2874
 	socklen_t		salen;
4f2874
 
4f2874
@@ -910,6 +910,10 @@ create_auth_rpc_client(struct clnt_info
4f2874
 	if (!populate_port(addr, salen, clp->prog, clp->vers, protocol))
4f2874
 		goto out_fail;
4f2874
 
4f2874
+	/* set the timeout according to the requested valued */
4f2874
+	timeout.tv_sec = (long) rpc_timeout;
4f2874
+	timeout.tv_usec = (long) 0;
4f2874
+
4f2874
 	rpc_clnt = nfs_get_rpcclient(addr, salen, protocol, clp->prog,
4f2874
 				     clp->vers, &timeout);
4f2874
 	if (!rpc_clnt) {