提交 6f513365 编写于 作者: S Stanislav Kinsbursky 提交者: Trond Myklebust

SUNRPC: clear svc pools lists helper introduced

This patch moves removing of service transport from it's pools ready lists to
separated function. Also this clear is now done with list_for_each_entry_safe()
helper.
This is a precursor patch, which would be usefull with service shutdown in
network namespace context, introduced later in the series.
Signed-off-by: NStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 ef159e91
...@@ -932,26 +932,33 @@ static void svc_close_list(struct list_head *xprt_list) ...@@ -932,26 +932,33 @@ static void svc_close_list(struct list_head *xprt_list)
} }
} }
void svc_close_all(struct svc_serv *serv) static void svc_clear_pools(struct svc_serv *serv)
{ {
struct svc_pool *pool; struct svc_pool *pool;
struct svc_xprt *xprt; struct svc_xprt *xprt;
struct svc_xprt *tmp; struct svc_xprt *tmp;
int i; int i;
svc_close_list(&serv->sv_tempsocks);
svc_close_list(&serv->sv_permsocks);
for (i = 0; i < serv->sv_nrpools; i++) { for (i = 0; i < serv->sv_nrpools; i++) {
pool = &serv->sv_pools[i]; pool = &serv->sv_pools[i];
spin_lock_bh(&pool->sp_lock); spin_lock_bh(&pool->sp_lock);
while (!list_empty(&pool->sp_sockets)) { list_for_each_entry_safe(xprt, tmp, &pool->sp_sockets, xpt_ready) {
xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready);
list_del_init(&xprt->xpt_ready); list_del_init(&xprt->xpt_ready);
} }
spin_unlock_bh(&pool->sp_lock); spin_unlock_bh(&pool->sp_lock);
} }
}
void svc_close_all(struct svc_serv *serv)
{
struct svc_xprt *xprt;
struct svc_xprt *tmp;
svc_close_list(&serv->sv_tempsocks);
svc_close_list(&serv->sv_permsocks);
svc_clear_pools(serv);
/* /*
* At this point the sp_sockets lists will stay empty, since * At this point the sp_sockets lists will stay empty, since
* svc_enqueue will not add new entries without taking the * svc_enqueue will not add new entries without taking the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册