From: Trond Myklebust Date: Fri, 25 Nov 2005 22:10:11 +0000 (-0500) Subject: SUNRPC: Funny looking code in __rpc_purge_upcall X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b3eb67a2ab4e14fc6cc035907400b86462d174db;p=openwrt%2Fstaging%2Fblogic.git SUNRPC: Funny looking code in __rpc_purge_upcall In __rpc_purge_upcall (net/sunrpc/rpc_pipe.c), the newer code to clean up the in_upcall list has a typo. Thanks to Vince Busam for spotting this! Signed-off-by: Trond Myklebust --- diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 81e00a6c19de..e3b242daf53c 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -39,23 +39,27 @@ static kmem_cache_t *rpc_inode_cachep __read_mostly; #define RPC_UPCALL_TIMEOUT (30*HZ) static void -__rpc_purge_upcall(struct inode *inode, int err) +__rpc_purge_list(struct rpc_inode *rpci, struct list_head *head, int err) { - struct rpc_inode *rpci = RPC_I(inode); struct rpc_pipe_msg *msg; + void (*destroy_msg)(struct rpc_pipe_msg *); - while (!list_empty(&rpci->pipe)) { - msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list); + destroy_msg = rpci->ops->destroy_msg; + while (!list_empty(head)) { + msg = list_entry(head->next, struct rpc_pipe_msg, list); list_del_init(&msg->list); msg->errno = err; - rpci->ops->destroy_msg(msg); - } - while (!list_empty(&rpci->in_upcall)) { - msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list); - list_del_init(&msg->list); - msg->errno = err; - rpci->ops->destroy_msg(msg); + destroy_msg(msg); } +} + +static void +__rpc_purge_upcall(struct inode *inode, int err) +{ + struct rpc_inode *rpci = RPC_I(inode); + + __rpc_purge_list(rpci, &rpci->pipe, err); + __rpc_purge_list(rpci, &rpci->in_upcall, err); rpci->pipelen = 0; wake_up(&rpci->waitq); }