Index: nfs-utils-2.6.2/utils/nfsidmap/nfsidmap.c
===================================================================
--- nfs-utils-2.6.2.orig/utils/nfsidmap/nfsidmap.c
+++ nfs-utils-2.6.2/utils/nfsidmap/nfsidmap.c
@@ -18,6 +18,7 @@
 #include "xcommon.h"
 
 int verbose = 0;
+int timeout = 600;
 #define USAGE "Usage: %s [-vh] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]"
 
 #define MAX_ID_LEN   11
@@ -211,6 +212,10 @@
 		return EXIT_FAILURE;
 	}
 
+	/* Set timeout to 10 (600 seconds) minutes */
+	if (rc == EXIT_SUCCESS)
+		keyctl_set_timeout(key, timeout);
+
 	rc = EXIT_SUCCESS;
 	if (keyctl_instantiate(key, id, strlen(id) + 1, 0)) {
 		switch (errno) {
@@ -269,6 +274,10 @@
 		return EXIT_FAILURE;
 	}
 
+	/* Set timeout to 10 (600 seconds) minutes */
+	if (rc == EXIT_SUCCESS)
+		keyctl_set_timeout(key, timeout);
+
 	rc = EXIT_SUCCESS;
 	if (keyctl_instantiate(key, &name, strlen(name), 0)) {
 		rc = EXIT_FAILURE;
@@ -359,7 +368,6 @@
 	char *value;
 	char *type;
 	int rc = 1, opt;
-	int timeout = 600;
 	key_serial_t key;
 	char *progname, *keystr = NULL;
 	int clearing = 0, keymask = 0, display = 0, list = 0;
@@ -469,10 +477,6 @@
 	else if (strcmp(type, "group") == 0)
 		rc = name_lookup(value, key, GROUP);
 
-	/* Set timeout to 10 (600 seconds) minutes */
-	if (rc == EXIT_SUCCESS)
-		keyctl_set_timeout(key, timeout);
-
 	free(arg);
 	return rc;
 }