2012-10-16 16:30:55

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 01/25] SUNRPC: remove BUG_ON in __rpc_clnt_handle_event

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 <[email protected]>
---
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)



2012-10-18 18:48:57

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 05/25] SUNRPC: remove BUG_ON() from rpc_call_sync()

T24gVHVlLCAyMDEyLTEwLTE2IGF0IDEyOjMwIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJldHVybiAtRUlOVkFMIGluc3RlYWQgb2YgY2FsbGluZyBCVUdfT04oKSB3aGVu
IFJQQ19UQVNLX0FTWU5DIGZsYWcgaXMgcGFzc2VkDQo+IHRvIHJwY19jYWxsX3N5bmMoKS4NCj4g
DQo+IFNp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wLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg==

2012-10-16 16:31:03

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 08/25] SUNRPC: remove BUG_ON() from rpc_sleep_on*()

Replace BUG_ON() with WARN_ON_ONCE() and clean up by calling rpc_exit().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
net/sunrpc/sched.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

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


2012-10-16 16:31:11

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 15/25] SUNRPC: remove BUG_ON()s from *_reclassify_socket*

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 <[email protected]>
---
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)


2012-10-16 16:31:40

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 24/25] SUNRPC: remove BUG_ON() in svc_delete_xprt()

Replace BUG_ON() with WARN_ON_ONCE().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-16 16:31:13

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 17/25] SUNRPC: remove BUG_ON()s checking RPCSVC_MAXPAGES

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 <[email protected]>
---
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)


2012-10-16 16:31:06

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 11/25] SUNRPC: remove BUG_ON() from bc_send()

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 <[email protected]>
---
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)


2012-10-16 16:31:39

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 21/25] SUNRPC: remove BUG_ON() in svc_register()

Instead of calling BUG_ON() return -EINVAL.

Signed-off-by: Weston Andros Adamson <[email protected]>
---
net/sunrpc/svc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 3bf5a54..b5ac8b3 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -950,7 +950,8 @@ int svc_register(const struct svc_serv *serv, struct net *net,
unsigned int i;
int error = 0;

- BUG_ON(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)


2012-10-16 16:30:57

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 03/25] SUNRPC: remove BUG_ON() from rpc_run_bc_task

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 <[email protected]>
---
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)


2012-10-16 16:30:56

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 02/25] SUNRPC: remove BUG_ON from rpc_bind_new_program

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 <[email protected]>
---
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)


2012-10-18 19:09:40

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 07/25] SUNRPC: remove BUG_ON() from call_bc_transmit()

T24gVHVlLCAyMDEyLTEwLTE2IGF0IDEyOjMwIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJlcGxhY2UgQlVHX09OKCkgd2l0aCBXQVJOX09OX09OQ0UoKSBhbmQgaGFuZGxl
IGVycm9yIGNvbmRpdGlvbiBieQ0KPiBjYWxsaW5nIHJwY19leGl0KCkuDQo+IA0KPiBTaWduZWQt
b2ZmLWJ5OiBXZXN0b24gQW5kcm9zIEFkYW1zb24gPGRyb3NAbmV0YXBwLmNvbT4NCj4gLS0tDQo+
ICBuZXQvc3VucnBjL2NsbnQuYyB8ICAgIDcgKysrKysrLQ0KPiAgMSBmaWxlIGNoYW5nZWQsIDYg
aW5zZXJ0aW9ucygrKSwgMSBkZWxldGlvbigtKQ0KPiANCj4gZGlmZiAtLWdpdCBhL25ldC9zdW5y
cGMvY2xudC5jIGIvbmV0L3N1bnJwYy9jbG50LmMNCj4gaW5kZXggY2VkMGYzNi4uYmZmNjQzOCAx
MDA2NDQNCj4gLS0tIGEvbmV0L3N1bnJwYy9jbG50LmMNCj4gKysrIGIvbmV0L3N1bnJwYy9jbG50
LmMNCj4gQEAgLTE3NTAsNyArMTc1MCwxMiBAQCBjYWxsX2JjX3RyYW5zbWl0KHN0cnVjdCBycGNf
dGFzayAqdGFzaykNCj4gIHsNCj4gIAlzdHJ1Y3QgcnBjX3Jxc3QgKnJlcSA9IHRhc2stPnRrX3Jx
c3RwOw0KPiAgDQo+IC0JQlVHX09OKHRhc2stPnRrX3N0YXR1cyAhPSAwKTsNCj4gKwlXQVJOX09O
X09OQ0UodGFzay0+dGtfc3RhdHVzICE9IDApOw0KPiArCWlmICh0YXNrLT50a19zdGF0dXMgIT0g
MCkgew0KPiArCQlycGNfZXhpdCh0YXNrLCB0YXNrLT50a19zdGF0dXMpOw0KPiArCQlyZXR1cm47
DQo+ICsJfQ0KPiArDQoNCkxldCdzIGp1c3QgZ2V0IHJpZCBvZiB0aGlzLiBHaXZlbiB0aGUgY3Vy
cmVudCB1c2Ugb2YgY2FsbF9iY190cmFuc21pdCwNCml0IGxvb2tzIGNvbXBsZXRlbHkgcmVkdW5k
YW50Lg0KDQo+ICAJdGFzay0+dGtfc3RhdHVzID0geHBydF9wcmVwYXJlX3RyYW5zbWl0KHRhc2sp
Ow0KPiAgCWlmICh0YXNrLT50a19zdGF0dXMgPT0gLUVBR0FJTikgew0KPiAgCQkvKg0KDQotLSAN
ClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWludGFpbmVyDQoNCk5ldEFwcA0K
VHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAuY29tDQo=

2012-10-16 16:31:38

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 20/25] SUNRPC: remove BUG_ON() from encode_rpcb_string()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-16 16:31:02

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 07/25] SUNRPC: remove BUG_ON() from call_bc_transmit()

Replace BUG_ON() with WARN_ON_ONCE() and handle error condition by
calling rpc_exit().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
net/sunrpc/clnt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index ced0f36..bff6438 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1750,7 +1750,12 @@ call_bc_transmit(struct rpc_task *task)
{
struct rpc_rqst *req = task->tk_rqstp;

- BUG_ON(task->tk_status != 0);
+ WARN_ON_ONCE(task->tk_status != 0);
+ if (task->tk_status != 0) {
+ rpc_exit(task, task->tk_status);
+ return;
+ }
+
task->tk_status = xprt_prepare_transmit(task);
if (task->tk_status == -EAGAIN) {
/*
--
1.7.9.6 (Apple Git-31.1)


2012-10-18 18:54:28

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 08/25] SUNRPC: remove BUG_ON() from rpc_sleep_on*()

T24gVHVlLCAyMDEyLTEwLTE2IGF0IDEyOjMwIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJlcGxhY2UgQlVHX09OKCkgd2l0aCBXQVJOX09OX09OQ0UoKSBhbmQgY2xlYW4g
dXAgYnkgY2FsbGluZyBycGNfZXhpd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sIGFuZA0KdGhlbiBjYWxsIHJwY19wdXRfdGFza19hc3luYygpLg0KDQo+ICsJ
CXJldHVybjsNCj4gKwl9DQo+ICANCj4gIAkvKg0KPiAgCSAqIFByb3RlY3QgdGhlIHF1ZXVlIG9w
ZXJhdGlvbnMuDQo+IEBAIC0zNTgsNyArMzYyLDExIEBAIHZvaWQgcnBjX3NsZWVwX29uX3ByaW9y
aXR5KHN0cnVjdCBycGNfd2FpdF9xdWV1ZSAqcSwgc3RydWN0IHJwY190YXNrICp0YXNrLA0KPiAg
CQlycGNfYWN0aW9uIGFjdGlvbiwgaW50IHByaW9yaXR5KQ0KPiAgew0KPiAgCS8qIFdlIHNob3Vs
ZG4ndCBldmVyIHB1dCBhbiBpbmFjdGl2ZSB0YXNrIHRvIHNsZWVwICovDQo+IC0JQlVHX09OKCFS
UENfSVNfQUNUSVZBVEVEKHRhc2spKTsNCj4gKwlXQVJOX09OX09OQ0UoIVJQQ19JU19BQ1RJVkFU
RUQodGFzaykpOw0KPiArCWlmICghUlBDX0lTX0FDVElWQVRFRCh0YXNrKSkgew0KPiArCQlycGNf
ZXhpdCh0YXNrLCAtRUlOVkFMKTsNCj4gKwkJcmV0dXJuOw0KPiArCX0NCj4gIA0KPiAgCS8qDQo+
ICAJICogUHJvdGVjdCB0aGUgcXVldWUgb3BlcmF0aW9ucy4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1
c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRyb25kLk15a2xlYnVz
dEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0K

2012-10-16 16:31:09

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 13/25] SUNRPC: remove BUG_ON() in rpc_put_sb_net()

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 <[email protected]>
---
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)


2012-10-16 16:31:10

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 14/25] SUNRPC: remove BUG_ON() from svc_pool_map_set_cpumask()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-16 16:31:39

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 23/25] SUNRPC: remove BUG_ON()s checking RPC_IS_QUEUED()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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 5dcc1ff..2d72af1 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);
@@ -705,7 +707,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)


2012-10-16 16:31:38

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 19/25] SUNRPC: remove BUG_ON() from bc_malloc()

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 <[email protected]>
---
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)


2012-10-16 16:31:01

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 06/25] SUNRPC: remove BUG_ON() from call_bc_transmit()

Replace BUG_ON() with WARN_ON_ONCE().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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 a8a6bcf..ced0f36 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1797,7 +1797,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)


2012-10-16 16:31:04

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 09/25] SUNRPC: remove two BUG_ON() asserts

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-16 16:31:28

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 18/25] SUNRPC: remove BUG_ON() in xdr_shrink_bufhead()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-16 16:31:40

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 25/25] SUNRPC: remove BUG_ON() in rpc_release_task()

Replace BUG_ON() with WARN_ON_ONCE().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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 2d72af1..d8b9921 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -993,7 +993,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)


2012-10-16 16:31:40

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 22/25] SUNRPC: remove BUG_ON() from __rpc_sleep_on_priority()

Replace BUG_ON() with WARN_ON_ONCE().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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 ec9513d..5dcc1ff 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)


2012-10-16 16:31:12

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 16/25] SUNRPC: remove BUG_ON() in svc_xprt_received()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-18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NrLT50a19y
cXN0cC0+cnFfYnl0ZXNfc2VudCAhPSAwKTsNCj4gKwkJV0FSTl9PTih0YXNrLT50a19ycXN0cC0+
cnFfYnl0ZXNfc2VudCAhPSAwKTsNCg0KV0FSTl9PTl9PTkNFKCk/DQoNCj4gKwkJaWYgKHRhc2st
PnRrX3Jxc3RwLT5ycV9ieXRlc19zZW50ICE9IDApIHsNCj4gKwkJCXJwY19leGl0KHRhc2ssIC1F
SU5WQUwpOw0KPiArCQkJcmV0dXJuOw0KPiArCQl9DQo+ICAJCXJwY194ZHJfZW5jb2RlKHRhc2sp
Ow0KPiAgCQkvKiBEaWQgdGhlIGVuY29kZSByZXN1bHQgaW4gYW4gZXJyb3IgY29uZGl0aW9uPyAq
Lw0KPiAgCQlpZiAodGFzay0+dGtfc3RhdHVzICE9IDApIHsNCg0KLS0gDQpUcm9uZCBNeWtsZWJ1
c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRyb25kLk15a2xlYnVz
dEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0K

2012-10-16 16:30:59

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 05/25] SUNRPC: remove BUG_ON() from rpc_call_sync()

Return -EINVAL instead of calling BUG_ON() when RPC_TASK_ASYNC flag is passed
to rpc_call_sync().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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;

task = rpc_run_task(&task_setup_data);
if (IS_ERR(task))
--
1.7.9.6 (Ap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SgpIHdvdWxkIGJlIHVzZWZ1bC4NCg0K
PiAgCWZvciAocHJvZ3AgPSBzZXJ2LT5zdl9wcm9ncmFtOyBwcm9ncDsgcHJvZ3AgPSBwcm9ncC0+
cGdfbmV4dCkgew0KPiAgCQlmb3IgKGkgPSAwOyBpIDwgcHJvZ3AtPnBnX252ZXJzOyBpKyspIHsN
Cg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpO
ZXRBcHANClRyb25kLk15a2xlYnVzdEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0K

2012-10-16 16:31:06

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 10/25] SUNRPC: remove BUG_ON() from xprt_destroy_backchannel

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)


2012-10-18 19:10:30

by Myklebust, Trond

[permal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Ynl0ZXNfc2VudCAhPSAwKTsNCj4gKwkJV0FSTl9PTih0YXNrLT50a19ycXN0cC0+
cnFfYnl0ZXNfc2VudCAhPSAwKTsNCj4gKwkJaWYgKHRhc2stPnRrX3Jxc3RwLT5ycV9ieXRlc19z
ZW50ICE9IDApIHsNCj4gKwkJCXJwY19leGl0KHRhc2ssIC1FSU5WQUwpOw0KPiArCQkJcmV0dXJu
Ow0KPiArCQl9DQoNCkFjdHVhbGx5LCBsZXQncyBqdXN0IGdldCByaWQgb2YgdGhpcyBvbmUgdG9v
Li4uDQoNCj4gIAkJcnBjX3hkcl9lbmNvZGUodGFzayk7DQo+ICAJCS8qIERpZCB0aGUgZW5jb2Rl
IHJlc3VsdCBpbiBhbiBlcnJvciBjb25kaXRpb24/ICovDQo+ICAJCWlmICh0YXNrLT50a19zdGF0
dXMgIT0gMCkgew0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWlu
dGFpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAu
Y29tDQo=

2012-10-16 16:30:58

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 04/25] SUNRPC: remove BUG_ON() from call_transmit()

Replace BUG_ON() with WARN_ON_ONCE() and if the error condition is true
attempt to gracefully recover by calling rpc_exit().

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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 fe8a133..76d1730 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1661,7 +1661,11 @@ 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);
+ WARN_ON(task->tk_rqstp->rq_bytes_sent != 0);
+ if (task->tk_rqstp->rq_bytes_sent != 0) {
+ rpc_exit(task, -EINVAL);
+ return;
+ }
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)


2012-10-18 19:06:59

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 05/25] SUNRPC: remove BUG_ON() from rpc_call_sync()

T24gVHVlLCAyMDEyLTEwLTE2IGF0IDEyOjMwIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IFJldHVybiAtRUlOVkFMIGluc3RlYWQgb2YgY2FsbGluZyBCVUdfT04oKSB3aGVu
IFJQQ19UQVNLX0FTWU5DIGZsYWcgaXMgcGFzc2VkDQo+IHRvIHJwY19jYWxsX3N5bmMoKS4NCj4g
DQo+IFNpZ25lZC1vZmYtYnk6IFdlc3RvbiBBbmRyb3MgQWRhbXNvbiA8ZHJvc0BuZXRhcHAuY29t
Pg0KPiAtLS0NCj4gIG5ldC9zdW5ycGMvY2xudC5jIHwgICAgMyArKy0NCj4gIDEgZmlsZSBjaGFu
Z2VkLCAyIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkNCj4gDQo+IGRpZmYgLS1naXQgYS9u
ZXQvc3VucnBjL2NsbnQuYyBiL25ldC9zdW5ycGMvY2xudC5jDQo+IGluZGV4IDc2ZDE3MzAuLmE4
YTZiY2YgMTAwNjQ0DQo+IC0tLSBhL25ldC9zdW5ycGMvY2xudC5jDQo+ICsrKyBiL25ldC9zdW5y
cGMvY2xudC5jDQo+IEBAIC04MzksNyArODM5LDggQEAgaW50IHJwY19jYWxsX3N5bmMoc3RydWN0
IHJwY19jbG50ICpjbG50LCBjb25zdCBzdHJ1Y3QgcnBjX21lc3NhZ2UgKm1zZywgaW50IGZsYWcN
Cj4gIAl9Ow0KPiAgCWludCBzdGF0dXM7DQo+ICANCj4gLQlCVUdfT04oZmxhZ3MgJiBSUENfVEFT
S19BU1lOQyk7DQo+ICsJaWYgKGZsYWdzICYgUlBDX1RBU0tfQVNZTkMpDQo+ICsJCXJldHVybiAt
RUlOVkFMOw0KDQpCVFc6IFRoaXMgbmVlZHMgdG8gY2FsbCBycGNfcmVsZWFzZV9jYWxsZGF0YSgp
IGJlZm9yZSBleGl0aW5nLg0KPiAgDQo+ICAJdGFzayA9IHJwY19ydW5fdGFzaygmdGFza19zZXR1
cF9kYXRhKTsNCj4gIAlpZiAoSVNfRVJSKHRhc2spKQ0KDQotLSANClRyb25kIE15a2xlYnVzdA0K
TGludXggTkZTIGNsaWVudCBtYWludGFpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5l
dGFwcC5jb20NCnd3dy5uZXRhcHAuY29tDQo=

2012-10-16 16:31:08

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH 12/25] SUNRPC: remove BUG_ON() calls from cache_read()

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

Signed-off-by: Weston Andros Adamson <[email protected]>
---
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)