diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-31 05:09:00 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-02-15 00:19:44 -0500 |
commit | 6f5133652eaab6fbd88bdb1b1fd2236fd82583cb (patch) | |
tree | c1cd295993d8d8f4808bed47bada155d9189a2ed /net/sunrpc | |
parent | ef159e9177cc5a09e6174796dde0b2d243ddf28b (diff) |
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: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index de1e1a8b526b..50bf7c1c731c 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -932,26 +932,33 @@ static void svc_close_list(struct list_head *xprt_list) | |||
932 | } | 932 | } |
933 | } | 933 | } |
934 | 934 | ||
935 | void svc_close_all(struct svc_serv *serv) | 935 | static void svc_clear_pools(struct svc_serv *serv) |
936 | { | 936 | { |
937 | struct svc_pool *pool; | 937 | struct svc_pool *pool; |
938 | struct svc_xprt *xprt; | 938 | struct svc_xprt *xprt; |
939 | struct svc_xprt *tmp; | 939 | struct svc_xprt *tmp; |
940 | int i; | 940 | int i; |
941 | 941 | ||
942 | svc_close_list(&serv->sv_tempsocks); | ||
943 | svc_close_list(&serv->sv_permsocks); | ||
944 | |||
945 | for (i = 0; i < serv->sv_nrpools; i++) { | 942 | for (i = 0; i < serv->sv_nrpools; i++) { |
946 | pool = &serv->sv_pools[i]; | 943 | pool = &serv->sv_pools[i]; |
947 | 944 | ||
948 | spin_lock_bh(&pool->sp_lock); | 945 | spin_lock_bh(&pool->sp_lock); |
949 | while (!list_empty(&pool->sp_sockets)) { | 946 | list_for_each_entry_safe(xprt, tmp, &pool->sp_sockets, xpt_ready) { |
950 | xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready); | ||
951 | list_del_init(&xprt->xpt_ready); | 947 | list_del_init(&xprt->xpt_ready); |
952 | } | 948 | } |
953 | spin_unlock_bh(&pool->sp_lock); | 949 | spin_unlock_bh(&pool->sp_lock); |
954 | } | 950 | } |
951 | } | ||
952 | |||
953 | void svc_close_all(struct svc_serv *serv) | ||
954 | { | ||
955 | struct svc_xprt *xprt; | ||
956 | struct svc_xprt *tmp; | ||
957 | |||
958 | svc_close_list(&serv->sv_tempsocks); | ||
959 | svc_close_list(&serv->sv_permsocks); | ||
960 | |||
961 | svc_clear_pools(serv); | ||
955 | /* | 962 | /* |
956 | * At this point the sp_sockets lists will stay empty, since | 963 | * At this point the sp_sockets lists will stay empty, since |
957 | * svc_enqueue will not add new entries without taking the | 964 | * svc_enqueue will not add new entries without taking the |