All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] svcrpc: implement O_NONBLOCK behavior for use-gss-proxy
@ 2013-05-24 22:12 J. Bruce Fields
  2013-05-26 15:07 ` Simo Sorce
  0 siblings, 1 reply; 2+ messages in thread
From: J. Bruce Fields @ 2013-05-24 22:12 UTC (permalink / raw)
  To: linux-nfs; +Cc: Jan Stancek, simo

From: "J. Bruce Fields" <bfields@redhat.com>

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.  And I don't really know if
this is really a bug.

But in any case perhaps 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>
---
 net/sunrpc/auth_gss/svcauth_gss.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Considering for 3.10.

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 9f0f017..618ccf5 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1313,10 +1313,12 @@ static inline bool gssp_ready(struct sunrpc_net *sn)
 	return false;
 }
 
-static int wait_for_gss_proxy(struct net *net)
+static int wait_for_gss_proxy(struct net *net, struct file *file)
 {
 	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));
 }
 
@@ -1358,7 +1360,7 @@ static ssize_t read_gssp(struct file *file, char __user *buf,
 	size_t len;
 	int ret;
 
-	ret = wait_for_gss_proxy(net);
+	ret = wait_for_gss_proxy(net, file);
 	if (ret)
 		return ret;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] svcrpc: implement O_NONBLOCK behavior for use-gss-proxy
  2013-05-24 22:12 [PATCH] svcrpc: implement O_NONBLOCK behavior for use-gss-proxy J. Bruce Fields
@ 2013-05-26 15:07 ` Simo Sorce
  0 siblings, 0 replies; 2+ messages in thread
From: Simo Sorce @ 2013-05-26 15:07 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, Jan Stancek

On Fri, 2013-05-24 at 18:12 -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> 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.  And I don't really know if
> this is really a bug.
> 
> But in any case perhaps 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>

Ack by me.

Simo.


> ---
>  net/sunrpc/auth_gss/svcauth_gss.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Considering for 3.10.
> 
> diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
> index 9f0f017..618ccf5 100644
> --- a/net/sunrpc/auth_gss/svcauth_gss.c
> +++ b/net/sunrpc/auth_gss/svcauth_gss.c
> @@ -1313,10 +1313,12 @@ static inline bool gssp_ready(struct sunrpc_net *sn)
>  	return false;
>  }
>  
> -static int wait_for_gss_proxy(struct net *net)
> +static int wait_for_gss_proxy(struct net *net, struct file *file)
>  {
>  	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));
>  }
>  
> @@ -1358,7 +1360,7 @@ static ssize_t read_gssp(struct file *file, char __user *buf,
>  	size_t len;
>  	int ret;
>  
> -	ret = wait_for_gss_proxy(net);
> +	ret = wait_for_gss_proxy(net, file);
>  	if (ret)
>  		return ret;
>  


-- 
Simo Sorce * Red Hat, Inc * New York


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-26 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 22:12 [PATCH] svcrpc: implement O_NONBLOCK behavior for use-gss-proxy J. Bruce Fields
2013-05-26 15:07 ` Simo Sorce

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.