diff mbox

[05/25] SUNRPC: remove BUG_ON() from rpc_call_sync()

Message ID 1350405043-39316-5-git-send-email-dros@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Weston Andros Adamson Oct. 16, 2012, 4:30 p.m. UTC
Return -EINVAL instead of calling BUG_ON() when RPC_TASK_ASYNC flag is passed
to rpc_call_sync().

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
 net/sunrpc/clnt.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Trond Myklebust Oct. 18, 2012, 6:48 p.m. UTC | #1
On Tue, 2012-10-16 at 12:30 -0400, Weston Andros Adamson wrote:
> Return -EINVAL instead of calling BUG_ON() when RPC_TASK_ASYNC flag is passed

> to rpc_call_sync().

> 

> Signed-off-by: Weston Andros Adamson <dros@netapp.com>

> ---

>  net/sunrpc/clnt.c |    3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c

> index 76d1730..a8a6bcf 100644

> --- a/net/sunrpc/clnt.c

> +++ b/net/sunrpc/clnt.c

> @@ -839,7 +839,8 @@ int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg, int flag

>  	};

>  	int status;

>  

> -	BUG_ON(flags & RPC_TASK_ASYNC);

> +	if (flags & RPC_TASK_ASYNC)

> +		return -EINVAL;


Needs a WARN_ON_ONCE(). This isn't a condition that the user can fix, so
they need to know that it needs reporting.

>  

>  	task = rpc_run_task(&task_setup_data);

>  	if (IS_ERR(task))


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
Trond Myklebust Oct. 18, 2012, 7:06 p.m. UTC | #2
On Tue, 2012-10-16 at 12:30 -0400, Weston Andros Adamson wrote:
> Return -EINVAL instead of calling BUG_ON() when RPC_TASK_ASYNC flag is passed

> to rpc_call_sync().

> 

> Signed-off-by: Weston Andros Adamson <dros@netapp.com>

> ---

>  net/sunrpc/clnt.c |    3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c

> index 76d1730..a8a6bcf 100644

> --- a/net/sunrpc/clnt.c

> +++ b/net/sunrpc/clnt.c

> @@ -839,7 +839,8 @@ int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg, int flag

>  	};

>  	int status;

>  

> -	BUG_ON(flags & RPC_TASK_ASYNC);

> +	if (flags & RPC_TASK_ASYNC)

> +		return -EINVAL;


BTW: This needs to call rpc_release_calldata() before exiting.
>  

>  	task = rpc_run_task(&task_setup_data);

>  	if (IS_ERR(task))


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
diff mbox

Patch

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 76d1730..a8a6bcf 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -839,7 +839,8 @@  int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg, int flag
 	};
 	int status;
 
-	BUG_ON(flags & RPC_TASK_ASYNC);
+	if (flags & RPC_TASK_ASYNC)
+		return -EINVAL;
 
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))