aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/svcauth_gss.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-05-24 09:47:49 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-05-28 16:46:51 -0400
commitb161c144404c18f6a9e20e46b63828ae3c2eb093 (patch)
tree5cad25054c2dfecfd83f8e2fbb2c6d1b52a44e04 /net/sunrpc/auth_gss/svcauth_gss.c
parent625cdd78d119d5848ac3c47d129bdf5f23f64120 (diff)
svcrpc: implement O_NONBLOCK behavior for use-gss-proxy
Somebody noticed LTP was complaining about O_NONBLOCK opens of /proc/net/rpc/use-gss-proxy succeeding and then a following read hanging. I'm not convinced LTP really has any business opening random proc files and expecting them to behave a certain way. Maybe this isn't really a bug. But in any case the O_NONBLOCK behavior could be useful for someone that wants to test whether gss-proxy is up without waiting. Reported-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/auth_gss/svcauth_gss.c')
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 2c6a1ece54bf..29b4ba93ab3c 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1317,10 +1317,12 @@ static inline bool gssp_ready(struct sunrpc_net *sn)
1317 return false; 1317 return false;
1318} 1318}
1319 1319
1320static int wait_for_gss_proxy(struct net *net) 1320static int wait_for_gss_proxy(struct net *net, struct file *file)
1321{ 1321{
1322 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 1322 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
1323 1323
1324 if (file->f_flags & O_NONBLOCK && !gssp_ready(sn))
1325 return -EAGAIN;
1324 return wait_event_interruptible(sn->gssp_wq, gssp_ready(sn)); 1326 return wait_event_interruptible(sn->gssp_wq, gssp_ready(sn));
1325} 1327}
1326 1328
@@ -1362,7 +1364,7 @@ static ssize_t read_gssp(struct file *file, char __user *buf,
1362 size_t len; 1364 size_t len;
1363 int ret; 1365 int ret;
1364 1366
1365 ret = wait_for_gss_proxy(net); 1367 ret = wait_for_gss_proxy(net, file);
1366 if (ret) 1368 if (ret)
1367 return ret; 1369 return ret;
1368 1370