SUNRPC: remove many BUG_ONs
Subsystems (3)
PATCH 9/25 SUNRPC: remove two BUG_ON asserts
In reply to Weston Andros AdamsonReplace two BUG_ON() calls checking the RPC_BC_PA_IN_USE flag with WARN_ON_ONCE().
--- net/sunrpc/backchannel_rqst.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/backchannel_rqst.c +2 -2
@@ -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 ();
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 8/25 SUNRPC: remove BUG_ON from rpc_sleep_on*
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE() and clean up after inactive task.
--- net/sunrpc/sched.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/sunrpc/sched.c +12 -2
@@ -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.
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 13/25 SUNRPC: remove BUG_ON in rpc_put_sb_net
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON() - the condition is definitely a misuse of the API, but shouldn't cause a crash.
--- net/sunrpc/rpc_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/rpc_pipe.c +1 -1
@@ -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);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 11/25 SUNRPC: remove BUG_ON from bc_send
In reply to Weston Andros AdamsonReplace 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.
--- net/sunrpc/bc_svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/bc_svc.c +1 -1
@@ -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); }
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 12/25 SUNRPC: remove BUG_ON calls from cache_read
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE() in two parts of cache_read().
--- net/sunrpc/cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/cache.c +2 -2
@@ -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);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 14/25 SUNRPC: remove BUG_ON from svc_pool_map_set_cpumask
In reply to Weston Andros AdamsonReplace BUG_ON() with a WARN() and early return.
--- net/sunrpc/svc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/svc.c +3 -1
@@ -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 :
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 20/25 SUNRPC: remove BUG_ON from encode_rpcb_string
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE() and truncate the encoded string if len > max.
--- net/sunrpc/rpcb_clnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sunrpc/rpcb_clnt.c +4 -1
@@ -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); }
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 6/25 SUNRPC: remove BUG_ON from call_bc_transmit
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE().
--- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 16/25 SUNRPC: remove BUG_ON in svc_xprt_received
In reply to Weston Andros AdamsonReplace BUG_ON() with a WARN_ON_ONCE() and early return.
--- net/sunrpc/svc_xprt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +3 -1
@@ -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: */
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 4/25 SUNRPC: remove BUG_ON from call_transmit
In reply to Weston Andros AdamsonRemove unneeded BUG_ON()
--- net/sunrpc/clnt.c | 1 - 1 file changed, 1 deletion(-)
net/sunrpc/clnt.c +0 -1
@@ -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 ) {
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 7/25 SUNRPC: remove BUG_ON from call_bc_transmit
In reply to Weston Andros AdamsonRemove redundant BUG_ON().
--- net/sunrpc/clnt.c | 1 - 1 file changed, 1 deletion(-)
net/sunrpc/clnt.c +0 -1
@@ -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 ) {/*
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 22/25 SUNRPC: remove BUG_ON from __rpc_sleep_on_priority
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE().
--- net/sunrpc/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/sched.c +1 -1
@@ -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); }
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 10/25 SUNRPC: remove BUG_ON from xprt_destroy_backchannel
In reply to Weston Andros AdamsonIf max_reqs is 0, do nothing besides the usual dprintks.
--- net/sunrpc/backchannel_rqst.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sunrpc/backchannel_rqst.c +4 -1
@@ -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" ); }
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 17/25 SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES
In reply to Weston Andros AdamsonReplace two bounds checking BUG_ON() calls with WARN_ON_ONCE() and resetting the requested size to RPCSVC_MAXPAGES.
--- net/sunrpc/svc.c | 4 +++- net/sunrpc/svc_xprt.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
net/sunrpc/svc.c +3 -1
@@ -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)
net/sunrpc/svc_xprt.c +4 -1
@@ -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 );
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 21/25 SUNRPC: remove BUG_ON in svc_register
In reply to Weston Andros AdamsonInstead of calling BUG_ON(), do a WARN_ON_ONCE() and return -EINVAL.
--- net/sunrpc/svc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/svc.c +3 -1
@@ -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++) {
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 23/25 SUNRPC: remove BUG_ONs checking RPC_IS_QUEUED
In reply to Weston Andros AdamsonReplace two BUG_ON() calls with WARN_ON_ONCE() and early returns.
--- net/sunrpc/sched.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sunrpc/sched.c +6 -2
@@ -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 *);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 5/25 SUNRPC: remove BUG_ON from rpc_call_sync
In reply to Weston Andros AdamsonReturn -EINVAL instead of calling BUG_ON() when RPC_TASK_ASYNC flag is passed to rpc_call_sync().
--- net/sunrpc/clnt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sunrpc/clnt.c +5 -1
@@ -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))
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 15/25 SUNRPC: remove BUG_ONs from *_reclassify_socket*
In reply to Weston Andros AdamsonReplace 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.
--- net/sunrpc/svcsock.c | 6 +++++- net/sunrpc/xprtsock.c | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
net/sunrpc/svcsock.c +5 -1
@@ -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",
net/sunrpc/xprtsock.c +4 -3
@@ -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);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 25/25 SUNRPC: remove BUG_ON in rpc_release_task
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE().
--- net/sunrpc/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/sched.c +1 -1
@@ -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);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 19/25 SUNRPC: remove BUG_ON from bc_malloc
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE() and NULL return - the caller will handle this like a memory allocation failure.
--- net/sunrpc/xprtsock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtsock.c +4 -2
@@ -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 ;
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 3/25 SUNRPC: remove BUG_ON from rpc_run_bc_task
In reply to Weston Andros AdamsonReplace 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.
--- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
@@ -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:
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 18/25 SUNRPC: remove BUG_ON in xdr_shrink_bufhead
In reply to Weston Andros AdamsonReplace bounds checking BUG_ON() with a WARN_ON_ONCE() and resetting the requested len to the max.
--- net/sunrpc/xdr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sunrpc/xdr.c +4 -1
@@ -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 ) {
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 24/25 SUNRPC: remove BUG_ON in svc_delete_xprt
In reply to Weston Andros AdamsonReplace BUG_ON() with WARN_ON_ONCE().
--- net/sunrpc/svc_xprt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +1 -1
@@ -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);
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 2/25 SUNRPC: remove BUG_ON from rpc_bind_new_program
In reply to Weston Andros AdamsonInstead of calling BUG_ON when rpc_bind_new_program gets an invalid rpc program version, print a KERN_ERR message and return -EINVAL.
--- net/sunrpc/clnt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sunrpc/clnt.c +5 -1
@@ -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))
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
PATCH 1/25 SUNRPC: remove BUG_ON in __rpc_clnt_handle_event
In reply to Weston Andros AdamsonPrint a KERN_INFO message before rpc_d_lookup_sb returns NULL, like other error paths in that function.
--- net/sunrpc/clnt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +5 -2
@@ -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;
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
cover SUNRPC: remove many BUG_ONs
Applied Trond's comments.
-dros
Re: [PATCH 05/25] SUNRPC: remove BUG_ON from rpc_call_sync
In reply to Weston Andros AdamsonT24gVHVlLCAyMDEyLTEwLTIzIGF0IDEwOjQzIC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g 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==