[RFC PATCH 2/5] sunrpc: don't hang indefinitely in wait_for_gss_proxy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A later patch will make upcalls delay for a bit if gssproxy isn't
up yet. Make wait_for_gss_proxy just delay for a little while before
giving up and disabling it. The 5s here is definitely negotiable.

Also, since there are no callers now, we can get rid of the file
pointer here and eliminate the O_NONBLOCK goop.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 net/sunrpc/auth_gss/svcauth_gss.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 5e9323e..64c025e 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1313,13 +1313,23 @@ static inline bool gssp_ready(struct sunrpc_net *sn)
 	return false;
 }
 
-static int wait_for_gss_proxy(struct net *net, struct file *file)
+/*
+ * The initial upcall to gssproxy will wait 5s for the use_gss_proxy
+ * var to change to something besides -1.
+ */
+#define GSSP_INITIAL_UPCALL_TIMEOUT	(5 * HZ)
+
+static int wait_for_gss_proxy(struct net *net)
 {
+	int ret;
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
-	if (file->f_flags & O_NONBLOCK && !gssp_ready(sn))
-		return -EAGAIN;
-	return wait_event_interruptible(sn->gssp_wq, gssp_ready(sn));
+	ret = wait_event_interruptible_timeout(sn->gssp_wq, gssp_ready(sn),
+					       GSSP_INITIAL_UPCALL_TIMEOUT);
+	/* If we timed out, disable gssp */
+	if (ret == 0)
+		set_gss_proxy(net, 0);
+	return ret < 0 ? ret : 0;
 }
 
 
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux