All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/25] SUNRPC: remove BUG_ON() from rpc_run_bc_task
  2012-10-16 16:30 [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
@ 2012-10-16 16:30 ` Weston Andros Adamson
  0 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-16 16:30 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() - rpc_run_bc_task calls rpc_init_task()
then increments the tk_count, so this is a simple sanity check that
if hit once would hit every time this code path is executed.

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index eacdb15..fe8a133 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -915,7 +915,7 @@ struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
 
 	task->tk_action = call_bc_transmit;
 	atomic_inc(&task->tk_count);
-	BUG_ON(atomic_read(&task->tk_count) != 2);
+	WARN_ON_ONCE(atomic_read(&task->tk_count) != 2);
 	rpc_execute(task);
 
 out:
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 00/25] SUNRPC: remove many BUG_ONs
@ 2012-10-23 14:43 Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
                   ` (24 more replies)
  0 siblings, 25 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs

Applied Trond's comments.

-dros


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

* [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 02/25] SUNRPC: remove BUG_ON from rpc_bind_new_program Weston Andros Adamson
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Print a KERN_INFO message before rpc_d_lookup_sb returns NULL, like
other error paths in that function.

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index cdc7564..abb7f5e 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -132,8 +132,10 @@ static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb,
 	int error;
 
 	dir = rpc_d_lookup_sb(sb, dir_name);
-	if (dir == NULL)
+	if (dir == NULL) {
+		pr_info("RPC: pipefs directory doesn't exist: %s\n", dir_name);
 		return dir;
+	}
 	for (;;) {
 		q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++);
 		name[sizeof(name) - 1] = '\0';
@@ -192,7 +194,8 @@ static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event,
 	case RPC_PIPEFS_MOUNT:
 		dentry = rpc_setup_pipedir_sb(sb, clnt,
 					      clnt->cl_program->pipe_dir_name);
-		BUG_ON(dentry == NULL);
+		if (!dentry)
+			return -ENOENT;
 		if (IS_ERR(dentry))
 			return PTR_ERR(dentry);
 		clnt->cl_dentry = dentry;
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 02/25] SUNRPC: remove BUG_ON from rpc_bind_new_program
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 03/25] SUNRPC: remove BUG_ON from rpc_run_bc_task Weston Andros Adamson
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Instead of calling BUG_ON when rpc_bind_new_program gets an invalid
rpc program version, print a KERN_ERR message and return -EINVAL.

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 abb7f5e..eacdb15 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -700,7 +700,11 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
 	const struct rpc_version *version;
 	int err;
 
-	BUG_ON(vers >= program->nrvers || !program->version[vers]);
+	if (vers >= program->nrvers || !program->version[vers]) {
+		pr_err("RPC: invalid program version %u for program %s\n",
+			vers, program->name);
+		return ERR_PTR(-EINVAL);
+	}
 	version = program->version[vers];
 	clnt = rpc_clone_client(old);
 	if (IS_ERR(clnt))
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 03/25] SUNRPC: remove BUG_ON from rpc_run_bc_task
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 02/25] SUNRPC: remove BUG_ON from rpc_bind_new_program Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 04/25] SUNRPC: remove BUG_ON from call_transmit Weston Andros Adamson
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() - rpc_run_bc_task calls rpc_init_task()
then increments the tk_count, so this is a simple sanity check that
if hit once would hit every time this code path is executed.

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index eacdb15..fe8a133 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -915,7 +915,7 @@ struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
 
 	task->tk_action = call_bc_transmit;
 	atomic_inc(&task->tk_count);
-	BUG_ON(atomic_read(&task->tk_count) != 2);
+	WARN_ON_ONCE(atomic_read(&task->tk_count) != 2);
 	rpc_execute(task);
 
 out:
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 04/25] SUNRPC: remove BUG_ON from call_transmit
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (2 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 03/25] SUNRPC: remove BUG_ON from rpc_run_bc_task Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync Weston Andros Adamson
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Remove unneeded BUG_ON()

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index fe8a133..dd16e52 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1661,7 +1661,6 @@ call_transmit(struct rpc_task *task)
 	task->tk_action = call_transmit_status;
 	/* Encode here so that rpcsec_gss can use correct sequence number. */
 	if (rpc_task_need_encode(task)) {
-		BUG_ON(task->tk_rqstp->rq_bytes_sent != 0);
 		rpc_xdr_encode(task);
 		/* Did the encode result in an error condition? */
 		if (task->tk_status != 0) {
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (3 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 04/25] SUNRPC: remove BUG_ON from call_transmit Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-11-01 15:56   ` Myklebust, Trond
  2012-10-23 14:43 ` [PATCH 06/25] SUNRPC: remove BUG_ON from call_bc_transmit Weston Andros Adamson
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

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) {
+		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))
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 06/25] SUNRPC: remove BUG_ON from call_bc_transmit
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (4 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 07/25] " Weston Andros Adamson
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE().

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0c0035f..b65c285 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1795,7 +1795,7 @@ call_bc_transmit(struct rpc_task *task)
 		 * We were unable to reply and will have to drop the
 		 * request.  The server should reconnect and retransmit.
 		 */
-		BUG_ON(task->tk_status == -EAGAIN);
+		WARN_ON_ONCE(task->tk_status == -EAGAIN);
 		printk(KERN_NOTICE "RPC: Could not send backchannel reply "
 			"error: %d\n", task->tk_status);
 		break;
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 07/25] SUNRPC: remove BUG_ON from call_bc_transmit
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (5 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 06/25] SUNRPC: remove BUG_ON from call_bc_transmit Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 08/25] SUNRPC: remove BUG_ON from rpc_sleep_on* Weston Andros Adamson
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Remove redundant BUG_ON().

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index b65c285..b48bfcf 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1748,7 +1748,6 @@ call_bc_transmit(struct rpc_task *task)
 {
 	struct rpc_rqst *req = task->tk_rqstp;
 
-	BUG_ON(task->tk_status != 0);
 	task->tk_status = xprt_prepare_transmit(task);
 	if (task->tk_status == -EAGAIN) {
 		/*
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 08/25] SUNRPC: remove BUG_ON from rpc_sleep_on*
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (6 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 07/25] " Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 09/25] SUNRPC: remove two BUG_ON asserts Weston Andros Adamson
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() and clean up after inactive task.

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

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 6357fcb..f494b35 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -343,7 +343,12 @@ void rpc_sleep_on(struct rpc_wait_queue *q, struct rpc_task *task,
 				rpc_action action)
 {
 	/* We shouldn't ever put an inactive task to sleep */
-	BUG_ON(!RPC_IS_ACTIVATED(task));
+	WARN_ON_ONCE(!RPC_IS_ACTIVATED(task));
+	if (!RPC_IS_ACTIVATED(task)) {
+		task->tk_status = -EIO;
+		rpc_put_task_async(task);
+		return;
+	}
 
 	/*
 	 * Protect the queue operations.
@@ -358,7 +363,12 @@ void rpc_sleep_on_priority(struct rpc_wait_queue *q, struct rpc_task *task,
 		rpc_action action, int priority)
 {
 	/* We shouldn't ever put an inactive task to sleep */
-	BUG_ON(!RPC_IS_ACTIVATED(task));
+	WARN_ON_ONCE(!RPC_IS_ACTIVATED(task));
+	if (!RPC_IS_ACTIVATED(task)) {
+		task->tk_status = -EIO;
+		rpc_put_task_async(task);
+		return;
+	}
 
 	/*
 	 * Protect the queue operations.
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 09/25] SUNRPC: remove two BUG_ON asserts
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (7 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 08/25] SUNRPC: remove BUG_ON from rpc_sleep_on* Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 10/25] SUNRPC: remove BUG_ON from xprt_destroy_backchannel Weston Andros Adamson
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace two BUG_ON() calls checking the RPC_BC_PA_IN_USE flag with
WARN_ON_ONCE().

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

diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 5a3d675..7567bcd 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -59,7 +59,7 @@ static void xprt_free_allocation(struct rpc_rqst *req)
 	struct xdr_buf *xbufp;
 
 	dprintk("RPC:        free allocations for req= %p\n", req);
-	BUG_ON(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
+	WARN_ON_ONCE(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
 	xbufp = &req->rq_private_buf;
 	free_page((unsigned long)xbufp->head[0].iov_base);
 	xbufp = &req->rq_snd_buf;
@@ -255,7 +255,7 @@ void xprt_free_bc_request(struct rpc_rqst *req)
 	dprintk("RPC:       free backchannel req=%p\n", req);
 
 	smp_mb__before_clear_bit();
-	BUG_ON(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
+	WARN_ON_ONCE(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
 	clear_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
 	smp_mb__after_clear_bit();
 
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 10/25] SUNRPC: remove BUG_ON from xprt_destroy_backchannel
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (8 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 09/25] SUNRPC: remove two BUG_ON asserts Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 11/25] SUNRPC: remove BUG_ON from bc_send Weston Andros Adamson
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

If max_reqs is 0, do nothing besides the usual dprintks.

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

diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 7567bcd..f0fb0dd 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -191,7 +191,9 @@ void xprt_destroy_backchannel(struct rpc_xprt *xprt, unsigned int max_reqs)
 
 	dprintk("RPC:        destroy backchannel transport\n");
 
-	BUG_ON(max_reqs == 0);
+	if (max_reqs == 0)
+		goto out;
+
 	spin_lock_bh(&xprt->bc_pa_lock);
 	xprt_dec_alloc_count(xprt, max_reqs);
 	list_for_each_entry_safe(req, tmp, &xprt->bc_pa_list, rq_bc_pa_list) {
@@ -202,6 +204,7 @@ void xprt_destroy_backchannel(struct rpc_xprt *xprt, unsigned int max_reqs)
 	}
 	spin_unlock_bh(&xprt->bc_pa_lock);
 
+out:
 	dprintk("RPC:        backchannel list empty= %s\n",
 		list_empty(&xprt->bc_pa_list) ? "true" : "false");
 }
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 11/25] SUNRPC: remove BUG_ON from bc_send
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (9 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 10/25] SUNRPC: remove BUG_ON from xprt_destroy_backchannel Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 12/25] SUNRPC: remove BUG_ON calls from cache_read Weston Andros Adamson
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE(). The error condition is a simple
ref counting sanity check and the following code will not free anything
until final put.

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

diff --git a/net/sunrpc/bc_svc.c b/net/sunrpc/bc_svc.c
index 0b2eb38..15c7a8a 100644
--- a/net/sunrpc/bc_svc.c
+++ b/net/sunrpc/bc_svc.c
@@ -53,7 +53,7 @@ int bc_send(struct rpc_rqst *req)
 	if (IS_ERR(task))
 		ret = PTR_ERR(task);
 	else {
-		BUG_ON(atomic_read(&task->tk_count) != 1);
+		WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
 		ret = task->tk_status;
 		rpc_put_task(task);
 	}
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 12/25] SUNRPC: remove BUG_ON calls from cache_read
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (10 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 11/25] SUNRPC: remove BUG_ON from bc_send Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 13/25] SUNRPC: remove BUG_ON in rpc_put_sb_net Weston Andros Adamson
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() in two parts of cache_read().

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

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 2a68bb3..d051451 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -775,11 +775,11 @@ static ssize_t cache_read(struct file *filp, char __user *buf, size_t count,
 	if (rp->q.list.next == &cd->queue) {
 		spin_unlock(&queue_lock);
 		mutex_unlock(&inode->i_mutex);
-		BUG_ON(rp->offset);
+		WARN_ON_ONCE(rp->offset);
 		return 0;
 	}
 	rq = container_of(rp->q.list.next, struct cache_request, q.list);
-	BUG_ON(rq->q.reader);
+	WARN_ON_ONCE(rq->q.reader);
 	if (rp->offset == 0)
 		rq->readers++;
 	spin_unlock(&queue_lock);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 13/25] SUNRPC: remove BUG_ON in rpc_put_sb_net
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (11 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 12/25] SUNRPC: remove BUG_ON calls from cache_read Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 14/25] SUNRPC: remove BUG_ON from svc_pool_map_set_cpumask Weston Andros Adamson
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON() - the condition is definitely a misuse
of the API, but shouldn't cause a crash.

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

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 80f5dd2..3128a15 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1093,7 +1093,7 @@ void rpc_put_sb_net(const struct net *net)
 {
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
-	BUG_ON(sn->pipefs_sb == NULL);
+	WARN_ON(sn->pipefs_sb == NULL);
 	mutex_unlock(&sn->pipefs_sb_lock);
 }
 EXPORT_SYMBOL_GPL(rpc_put_sb_net);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 14/25] SUNRPC: remove BUG_ON from svc_pool_map_set_cpumask
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (12 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 13/25] SUNRPC: remove BUG_ON in rpc_put_sb_net Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 15/25] SUNRPC: remove BUG_ONs from *_reclassify_socket* Weston Andros Adamson
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with a WARN() and early return.

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

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 3ee7461..664979b 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -324,7 +324,9 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
 	 * The caller checks for sv_nrpools > 1, which
 	 * implies that we've been initialized.
 	 */
-	BUG_ON(m->count == 0);
+	WARN_ON_ONCE(m->count == 0);
+	if (m->count == 0)
+		return;
 
 	switch (m->mode) {
 	case SVC_POOL_PERCPU:
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 15/25] SUNRPC: remove BUG_ONs from *_reclassify_socket*
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (13 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 14/25] SUNRPC: remove BUG_ON from svc_pool_map_set_cpumask Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 16/25] SUNRPC: remove BUG_ON in svc_xprt_received Weston Andros Adamson
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace multiple BUG_ON() calls with WARN_ON_ONCE() and early return when
sanity checking socket ownership (lock). The bind call will fail if the
socket was unsuccessfully reclassified.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
 net/sunrpc/svcsock.c  |    6 +++++-
 net/sunrpc/xprtsock.c |    7 ++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 03827ce..cc3020d 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -84,7 +84,11 @@ static struct lock_class_key svc_slock_key[2];
 static void svc_reclassify_socket(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
-	BUG_ON(sock_owned_by_user(sk));
+
+	WARN_ON_ONCE(sock_owned_by_user(sk));
+	if (sock_owned_by_user(sk))
+		return;
+
 	switch (sk->sk_family) {
 	case AF_INET:
 		sock_lock_init_class_and_name(sk, "slock-AF_INET-NFSD",
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index aaaadfb..4e76d38 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1762,7 +1762,6 @@ static inline void xs_reclassify_socketu(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
 
-	BUG_ON(sock_owned_by_user(sk));
 	sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC",
 		&xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]);
 }
@@ -1771,7 +1770,6 @@ static inline void xs_reclassify_socket4(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
 
-	BUG_ON(sock_owned_by_user(sk));
 	sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC",
 		&xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]);
 }
@@ -1780,13 +1778,16 @@ static inline void xs_reclassify_socket6(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
 
-	BUG_ON(sock_owned_by_user(sk));
 	sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC",
 		&xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]);
 }
 
 static inline void xs_reclassify_socket(int family, struct socket *sock)
 {
+	WARN_ON_ONCE(sock_owned_by_user(sock->sk));
+	if (sock_owned_by_user(sock->sk))
+		return;
+
 	switch (family) {
 	case AF_LOCAL:
 		xs_reclassify_socketu(sock);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 16/25] SUNRPC: remove BUG_ON in svc_xprt_received
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (14 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 15/25] SUNRPC: remove BUG_ONs from *_reclassify_socket* Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 17/25] SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES Weston Andros Adamson
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with a WARN_ON_ONCE() and early return.

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

diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 194d865..be89bb6 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -218,7 +218,9 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
  */
 static void svc_xprt_received(struct svc_xprt *xprt)
 {
-	BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags));
+	WARN_ON_ONCE(!test_bit(XPT_BUSY, &xprt->xpt_flags));
+	if (!test_bit(XPT_BUSY, &xprt->xpt_flags))
+		return;
 	/* As soon as we clear busy, the xprt could be closed and
 	 * 'put', so we need a reference to call svc_xprt_enqueue with:
 	 */
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 17/25] SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (15 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 16/25] SUNRPC: remove BUG_ON in svc_xprt_received Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 18/25] SUNRPC: remove BUG_ON in xdr_shrink_bufhead Weston Andros Adamson
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace two bounds checking BUG_ON() calls with WARN_ON_ONCE() and resetting
the requested size to RPCSVC_MAXPAGES.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
 net/sunrpc/svc.c      |    4 +++-
 net/sunrpc/svc_xprt.c |    5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 664979b..3bf5a54 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -587,7 +587,9 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
 				       * We assume one is at most one page
 				       */
 	arghi = 0;
-	BUG_ON(pages > RPCSVC_MAXPAGES);
+	WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
+	if (pages > RPCSVC_MAXPAGES)
+		pages = RPCSVC_MAXPAGES;
 	while (pages) {
 		struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
 		if (!p)
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index be89bb6..35fa74b 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -579,7 +579,10 @@ int svc_alloc_arg(struct svc_rqst *rqstp)
 
 	/* now allocate needed pages.  If we get a failure, sleep briefly */
 	pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE;
-	BUG_ON(pages >= RPCSVC_MAXPAGES);
+	WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
+	if (pages >= RPCSVC_MAXPAGES)
+		/* use as many pages as possible */
+		pages = RPCSVC_MAXPAGES - 1;
 	for (i = 0; i < pages ; i++)
 		while (rqstp->rq_pages[i] == NULL) {
 			struct page *p = alloc_page(GFP_KERNEL);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 18/25] SUNRPC: remove BUG_ON in xdr_shrink_bufhead
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (16 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 17/25] SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 19/25] SUNRPC: remove BUG_ON from bc_malloc Weston Andros Adamson
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace bounds checking BUG_ON() with a WARN_ON_ONCE() and resetting
the requested len to the max.

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

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 08f50af..5605563 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -318,7 +318,10 @@ xdr_shrink_bufhead(struct xdr_buf *buf, size_t len)
 
 	tail = buf->tail;
 	head = buf->head;
-	BUG_ON (len > head->iov_len);
+
+	WARN_ON_ONCE(len > head->iov_len);
+	if (len > head->iov_len)
+		len = head->iov_len;
 
 	/* Shift the tail first */
 	if (tail->iov_len != 0) {
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 19/25] SUNRPC: remove BUG_ON from bc_malloc
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (17 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 18/25] SUNRPC: remove BUG_ON in xdr_shrink_bufhead Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 20/25] SUNRPC: remove BUG_ON from encode_rpcb_string Weston Andros Adamson
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() and NULL return - the caller will handle
this like a memory allocation failure.

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

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 4e76d38..84cf236 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2351,9 +2351,11 @@ static void *bc_malloc(struct rpc_task *task, size_t size)
 	struct page *page;
 	struct rpc_buffer *buf;
 
-	BUG_ON(size > PAGE_SIZE - sizeof(struct rpc_buffer));
-	page = alloc_page(GFP_KERNEL);
+	WARN_ON_ONCE(size > PAGE_SIZE - sizeof(struct rpc_buffer));
+	if (size > PAGE_SIZE - sizeof(struct rpc_buffer))
+		return NULL;
 
+	page = alloc_page(GFP_KERNEL);
 	if (!page)
 		return NULL;
 
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 20/25] SUNRPC: remove BUG_ON from encode_rpcb_string
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (18 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 19/25] SUNRPC: remove BUG_ON from bc_malloc Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 21/25] SUNRPC: remove BUG_ON in svc_register Weston Andros Adamson
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE() and truncate the encoded string if
len > max.

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

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index a70acae..411f332 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -884,7 +884,10 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string,
 	u32 len;
 
 	len = strlen(string);
-	BUG_ON(len > maxstrlen);
+	WARN_ON_ONCE(len > maxstrlen);
+	if (len > maxstrlen)
+		/* truncate and hope for the best */
+		len = maxstrlen;
 	p = xdr_reserve_space(xdr, 4 + len);
 	xdr_encode_opaque(p, string, len);
 }
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 21/25] SUNRPC: remove BUG_ON in svc_register
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (19 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 20/25] SUNRPC: remove BUG_ON from encode_rpcb_string Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 22/25] SUNRPC: remove BUG_ON from __rpc_sleep_on_priority Weston Andros Adamson
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Instead of calling BUG_ON(), do a WARN_ON_ONCE() and return -EINVAL.

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

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 3bf5a54..dfa4ba6 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -950,7 +950,9 @@ int svc_register(const struct svc_serv *serv, struct net *net,
 	unsigned int		i;
 	int			error = 0;
 
-	BUG_ON(proto == 0 && port == 0);
+	WARN_ON_ONCE(proto == 0 && port == 0);
+	if (proto == 0 && port == 0)
+		return -EINVAL;
 
 	for (progp = serv->sv_program; progp; progp = progp->pg_next) {
 		for (i = 0; i < progp->pg_nvers; i++) {
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 22/25] SUNRPC: remove BUG_ON from __rpc_sleep_on_priority
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (20 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 21/25] SUNRPC: remove BUG_ON in svc_register Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 23/25] SUNRPC: remove BUG_ONs checking RPC_IS_QUEUED Weston Andros Adamson
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE().

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

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f494b35..e6db496 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -334,7 +334,7 @@ static void __rpc_sleep_on_priority(struct rpc_wait_queue *q,
 
 	__rpc_add_wait_queue(q, task, queue_priority);
 
-	BUG_ON(task->tk_callback != NULL);
+	WARN_ON_ONCE(task->tk_callback != NULL);
 	task->tk_callback = action;
 	__rpc_add_timer(q, task);
 }
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 23/25] SUNRPC: remove BUG_ONs checking RPC_IS_QUEUED
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (21 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 22/25] SUNRPC: remove BUG_ON from __rpc_sleep_on_priority Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 24/25] SUNRPC: remove BUG_ON in svc_delete_xprt Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 25/25] SUNRPC: remove BUG_ON in rpc_release_task Weston Andros Adamson
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace two BUG_ON() calls with WARN_ON_ONCE() and early returns.

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

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index e6db496..6904917 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -133,7 +133,9 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue,
 		struct rpc_task *task,
 		unsigned char queue_priority)
 {
-	BUG_ON (RPC_IS_QUEUED(task));
+	WARN_ON_ONCE(RPC_IS_QUEUED(task));
+	if (RPC_IS_QUEUED(task))
+		return;
 
 	if (RPC_IS_PRIORITY(queue))
 		__rpc_add_wait_queue_priority(queue, task, queue_priority);
@@ -707,7 +709,9 @@ static void __rpc_execute(struct rpc_task *task)
 	dprintk("RPC: %5u __rpc_execute flags=0x%x\n",
 			task->tk_pid, task->tk_flags);
 
-	BUG_ON(RPC_IS_QUEUED(task));
+	WARN_ON_ONCE(RPC_IS_QUEUED(task));
+	if (RPC_IS_QUEUED(task))
+		return;
 
 	for (;;) {
 		void (*do_action)(struct rpc_task *);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 24/25] SUNRPC: remove BUG_ON in svc_delete_xprt
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (22 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 23/25] SUNRPC: remove BUG_ONs checking RPC_IS_QUEUED Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  2012-10-23 14:43 ` [PATCH 25/25] SUNRPC: remove BUG_ON in rpc_release_task Weston Andros Adamson
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE().

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

diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 35fa74b..b8e47fa 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -931,7 +931,7 @@ static void svc_delete_xprt(struct svc_xprt *xprt)
 	spin_lock_bh(&serv->sv_lock);
 	if (!test_and_set_bit(XPT_DETACHED, &xprt->xpt_flags))
 		list_del_init(&xprt->xpt_list);
-	BUG_ON(!list_empty(&xprt->xpt_ready));
+	WARN_ON_ONCE(!list_empty(&xprt->xpt_ready));
 	if (test_bit(XPT_TEMP, &xprt->xpt_flags))
 		serv->sv_tmpcnt--;
 	spin_unlock_bh(&serv->sv_lock);
-- 
1.7.9.6 (Apple Git-31.1)


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

* [PATCH 25/25] SUNRPC: remove BUG_ON in rpc_release_task
  2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
                   ` (23 preceding siblings ...)
  2012-10-23 14:43 ` [PATCH 24/25] SUNRPC: remove BUG_ON in svc_delete_xprt Weston Andros Adamson
@ 2012-10-23 14:43 ` Weston Andros Adamson
  24 siblings, 0 replies; 28+ messages in thread
From: Weston Andros Adamson @ 2012-10-23 14:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Replace BUG_ON() with WARN_ON_ONCE().

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

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 6904917..8529026 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -995,7 +995,7 @@ static void rpc_release_task(struct rpc_task *task)
 {
 	dprintk("RPC: %5u release task\n", task->tk_pid);
 
-	BUG_ON (RPC_IS_QUEUED(task));
+	WARN_ON_ONCE(RPC_IS_QUEUED(task));
 
 	rpc_release_resources_task(task);
 
-- 
1.7.9.6 (Apple Git-31.1)


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

* Re: [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync
  2012-10-23 14:43 ` [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync Weston Andros Adamson
@ 2012-11-01 15:56   ` Myklebust, Trond
  0 siblings, 0 replies; 28+ messages in thread
From: Myklebust, Trond @ 2012-11-01 15:56 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: linux-nfs@vger.kernel.org

T24gVHVlLCAyMDEyLTEwLTIzIGF0IDEwOjQzIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJldHVybiAtRUlOVkFMIGluc3RlYWQgb2YgY2FsbGluZyBCVUdfT04oKSB3aGVu
IFJQQ19UQVNLX0FTWU5DIGZsYWcgaXMgcGFzc2VkDQo+IHRvIHJwY19jYWxsX3N5bmMoKS4NCj4g
DQo+IFNpZ25lZC1vZmYtYnk6IFdlc3RvbiBBbmRyb3MgQWRhbXNvbiA8ZHJvc0BuZXRhcHAuY29t
Pg0KPiAtLS0NCj4gIG5ldC9zdW5ycGMvY2xudC5jIHwgICAgNiArKysrKy0NCj4gIDEgZmlsZSBj
aGFuZ2VkLCA1IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkNCj4gDQo+IGRpZmYgLS1naXQg
YS9uZXQvc3VucnBjL2NsbnQuYyBiL25ldC9zdW5ycGMvY2xudC5jDQo+IGluZGV4IGRkMTZlNTIu
LjBjMDAzNWYgMTAwNjQ0DQo+IC0tLSBhL25ldC9zdW5ycGMvY2xudC5jDQo+ICsrKyBiL25ldC9z
dW5ycGMvY2xudC5jDQo+IEBAIC04MzksNyArODM5LDExIEBAIGludCBycGNfY2FsbF9zeW5jKHN0
cnVjdCBycGNfY2xudCAqY2xudCwgY29uc3Qgc3RydWN0IHJwY19tZXNzYWdlICptc2csIGludCBm
bGFnDQo+ICAJfTsNCj4gIAlpbnQgc3RhdHVzOw0KPiAgDQo+IC0JQlVHX09OKGZsYWdzICYgUlBD
X1RBU0tfQVNZTkMpOw0KPiArCWlmIChmbGFncyAmIFJQQ19UQVNLX0FTWU5DKSB7DQoNClRoaXMg
ZGVmaW5pdGVseSBuZWVkcyBhIFdBUk5fT05fT05DRTogaXQncyBhIHByb2dyYW1tZXIgZXJyb3Is
IG5vdCBhbg0KYXBwbGljYXRpb24gZXJyb3IuLi4NCg0KPiArCQlycGNfcmVsZWFzZV9jYWxsZGF0
YSh0YXNrX3NldHVwX2RhdGEuY2FsbGJhY2tfb3BzLA0KPiArCQkJdGFza19zZXR1cF9kYXRhLmNh
bGxiYWNrX2RhdGEpOw0KPiArCQlyZXR1cm4gLUVJTlZBTDsNCj4gKwl9DQo+ICANCj4gIAl0YXNr
ID0gcnBjX3J1bl90YXNrKCZ0YXNrX3NldHVwX2RhdGEpOw0KPiAgCWlmIChJU19FUlIodGFzaykp
DQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0K
TmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg==

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

end of thread, other threads:[~2012-11-01 15:56 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 14:43 [PATCH 00/25] SUNRPC: remove many BUG_ONs Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 02/25] SUNRPC: remove BUG_ON from rpc_bind_new_program Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 03/25] SUNRPC: remove BUG_ON from rpc_run_bc_task Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 04/25] SUNRPC: remove BUG_ON from call_transmit Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync Weston Andros Adamson
2012-11-01 15:56   ` Myklebust, Trond
2012-10-23 14:43 ` [PATCH 06/25] SUNRPC: remove BUG_ON from call_bc_transmit Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 07/25] " Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 08/25] SUNRPC: remove BUG_ON from rpc_sleep_on* Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 09/25] SUNRPC: remove two BUG_ON asserts Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 10/25] SUNRPC: remove BUG_ON from xprt_destroy_backchannel Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 11/25] SUNRPC: remove BUG_ON from bc_send Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 12/25] SUNRPC: remove BUG_ON calls from cache_read Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 13/25] SUNRPC: remove BUG_ON in rpc_put_sb_net Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 14/25] SUNRPC: remove BUG_ON from svc_pool_map_set_cpumask Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 15/25] SUNRPC: remove BUG_ONs from *_reclassify_socket* Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 16/25] SUNRPC: remove BUG_ON in svc_xprt_received Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 17/25] SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 18/25] SUNRPC: remove BUG_ON in xdr_shrink_bufhead Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 19/25] SUNRPC: remove BUG_ON from bc_malloc Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 20/25] SUNRPC: remove BUG_ON from encode_rpcb_string Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 21/25] SUNRPC: remove BUG_ON in svc_register Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 22/25] SUNRPC: remove BUG_ON from __rpc_sleep_on_priority Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 23/25] SUNRPC: remove BUG_ONs checking RPC_IS_QUEUED Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 24/25] SUNRPC: remove BUG_ON in svc_delete_xprt Weston Andros Adamson
2012-10-23 14:43 ` [PATCH 25/25] SUNRPC: remove BUG_ON in rpc_release_task Weston Andros Adamson
  -- strict thread matches above, loose matches on Subject: below --
2012-10-16 16:30 [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event Weston Andros Adamson
2012-10-16 16:30 ` [PATCH 03/25] SUNRPC: remove BUG_ON() from rpc_run_bc_task Weston Andros Adamson

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.