From: Jeff Layton <jlayton@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: simo@redhat.com, bfields@fieldses.org, neilb@suse.de
Subject: [RFC PATCH 2/5] sunrpc: don't hang indefinitely in wait_for_gss_proxy
Date: Wed, 1 Jan 2014 07:28:31 -0500 [thread overview]
Message-ID: <1388579314-15255-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1388579314-15255-1-git-send-email-jlayton@redhat.com>
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@redhat.com>
---
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
next prev parent reply other threads:[~2014-01-01 12:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-01 12:28 [RFC PATCH 0/5] sunrpc: change handling of use-gss-proxy file Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 1/5] sunrpc: don't wait for write before allowing reads from " Jeff Layton
2014-01-02 21:21 ` J. Bruce Fields
2014-01-02 22:26 ` Jeff Layton
2014-01-02 22:40 ` J. Bruce Fields
2014-01-02 23:27 ` Jeff Layton
2014-01-03 8:14 ` Simo Sorce
2014-01-03 16:23 ` J. Bruce Fields
2014-01-03 22:06 ` Simo Sorce
2014-01-03 22:34 ` J. Bruce Fields
2014-01-04 15:28 ` Simo Sorce
2014-01-04 16:10 ` J. Bruce Fields
2014-01-04 14:18 ` Jeff Layton
2014-01-05 22:37 ` NeilBrown
2014-01-05 22:54 ` J. Bruce Fields
2014-01-05 23:30 ` NeilBrown
2014-01-05 23:38 ` Chuck Lever
2014-01-06 1:45 ` Jeff Layton
2014-01-06 6:36 ` Simo Sorce
2014-01-06 15:04 ` J. Bruce Fields
2014-01-06 15:23 ` Simo Sorce
2014-01-01 12:28 ` Jeff Layton [this message]
2014-01-01 12:28 ` [RFC PATCH 3/5] sunrpc: wait for gssproxy to start on initial upcall attempt before falling back to legacy upcall Jeff Layton
2014-01-02 21:35 ` J. Bruce Fields
2014-01-02 23:10 ` Jeff Layton
2014-01-03 16:33 ` J. Bruce Fields
2014-01-03 17:03 ` Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 4/5] sunrpc: fix potential race between setting use_gss_proxy and the upcall rpc_clnt Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 5/5] sunrpc: allow gssproxy to be explicitly disabled from userland Jeff Layton
2014-01-01 19:53 ` [RFC PATCH 0/5] sunrpc: change handling of use-gss-proxy file Simo Sorce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388579314-15255-3-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=simo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).