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

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