Skip to content

Commit

Permalink
SUNRPC: clear svc transports lists helper introduced
Browse files Browse the repository at this point in the history
This patch moves service transports deletion from service sockets lists to
separated function.
This is a precursor patch, which would be usefull with service shutdown in
network namespace context, introduced later in the series.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Feb 15, 2012
1 parent 6f51336 commit 3a22bf5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions net/sunrpc/svc_xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,19 @@ static void svc_clear_pools(struct svc_serv *serv)
}
}

void svc_close_all(struct svc_serv *serv)
static void svc_clear_list(struct list_head *xprt_list)
{
struct svc_xprt *xprt;
struct svc_xprt *tmp;

list_for_each_entry_safe(xprt, tmp, xprt_list, xpt_list) {
svc_delete_xprt(xprt);
}
BUG_ON(!list_empty(xprt_list));
}

void svc_close_all(struct svc_serv *serv)
{
svc_close_list(&serv->sv_tempsocks);
svc_close_list(&serv->sv_permsocks);

Expand All @@ -964,13 +972,8 @@ void svc_close_all(struct svc_serv *serv)
* svc_enqueue will not add new entries without taking the
* sp_lock and checking XPT_BUSY.
*/
list_for_each_entry_safe(xprt, tmp, &serv->sv_tempsocks, xpt_list)
svc_delete_xprt(xprt);
list_for_each_entry_safe(xprt, tmp, &serv->sv_permsocks, xpt_list)
svc_delete_xprt(xprt);

BUG_ON(!list_empty(&serv->sv_permsocks));
BUG_ON(!list_empty(&serv->sv_tempsocks));
svc_clear_list(&serv->sv_tempsocks);
svc_clear_list(&serv->sv_permsocks);
}

/*
Expand Down

0 comments on commit 3a22bf5

Please sign in to comment.