diff mbox

[05/25] SUNRPC: remove BUG_ON from rpc_call_sync

Message ID 1351003429-18887-6-git-send-email-dros@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Weston Andros Adamson Oct. 23, 2012, 2:43 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 |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Trond Myklebust Nov. 1, 2012, 3:56 p.m. UTC | #1
On Tue, 2012-10-23 at 10:43 -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 |    6 +++++-

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

> 

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

> index dd16e52..0c0035f 100644

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

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

> @@ -839,7 +839,11 @@ 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) {


This definitely needs a WARN_ON_ONCE: it's a programmer error, not an
application error...

> +		rpc_release_calldata(task_setup_data.callback_ops,

> +			task_setup_data.callback_data);

> +		return -EINVAL;

> +	}

>  

>  	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 dd16e52..0c0035f 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -839,7 +839,11 @@  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) {
+		rpc_release_calldata(task_setup_data.callback_ops,
+			task_setup_data.callback_data);
+		return -EINVAL;
+	}
 
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))