diff mbox

[08/25] SUNRPC: remove BUG_ON() from rpc_sleep_on*()

Message ID 1350405043-39316-8-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
Replace BUG_ON() with WARN_ON_ONCE() and clean up by calling rpc_exit().

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

Comments

Trond Myklebust Oct. 18, 2012, 6:54 p.m. UTC | #1
T24gVHVlLCAyMDEyLTEwLTE2IGF0IDEyOjMwIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJlcGxhY2UgQlVHX09OKCkgd2l0aCBXQVJOX09OX09OQ0UoKSBhbmQgY2xlYW4g
dXAgYnkgY2FsbGluZyBycGNfZXhpdCgpLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogV2VzdG9uIEFu
ZHJvcyBBZGFtc29uIDxkcm9zQG5ldGFwcC5jb20+DQo+IC0tLQ0KPiAgbmV0L3N1bnJwYy9zY2hl
ZC5jIHwgICAxMiArKysrKysrKysrLS0NCj4gIDEgZmlsZSBjaGFuZ2VkLCAxMCBpbnNlcnRpb25z
KCspLCAyIGRlbGV0aW9ucygtKQ0KPiANCj4gZGlmZiAtLWdpdCBhL25ldC9zdW5ycGMvc2NoZWQu
YyBiL25ldC9zdW5ycGMvc2NoZWQuYw0KPiBpbmRleCA2MzU3ZmNiLi5lYzk1MTNkIDEwMDY0NA0K
PiAtLS0gYS9uZXQvc3VucnBjL3NjaGVkLmMNCj4gKysrIGIvbmV0L3N1bnJwYy9zY2hlZC5jDQo+
IEBAIC0zNDMsNyArMzQzLDExIEBAIHZvaWQgcnBjX3NsZWVwX29uKHN0cnVjdCBycGNfd2FpdF9x
dWV1ZSAqcSwgc3RydWN0IHJwY190YXNrICp0YXNrLA0KPiAgCQkJCXJwY19hY3Rpb24gYW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PiArCQlycGNf
ZXhpdCh0YXNrLCAtRUlOVkFMKTsNCj4gKwkJcmV0dXJuOw0KPiArCX0NCj4gIA0KPiAgCS8qDQo+
ICAJICogUHJvdGVjdCB0aGUgcXVldWUgb3BlcmF0aW9ucy4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1
c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRyb25kLk15a2xlYnVz
dEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 6357fcb..ec9513d 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -343,7 +343,11 @@  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)) {
+		rpc_exit(task, -EINVAL);
+		return;
+	}
 
 	/*
 	 * Protect the queue operations.
@@ -358,7 +362,11 @@  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)) {
+		rpc_exit(task, -EINVAL);
+		return;
+	}
 
 	/*
 	 * Protect the queue operations.