Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Stanislav Kinsbursky and committed by
Trond Myklebust
6f513365 ef159e91

+13 -6
+13 -6
net/sunrpc/svc_xprt.c
··· 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 937 struct svc_pool *pool; 938 938 struct svc_xprt *xprt; 939 939 struct svc_xprt *tmp; 940 940 int i; 941 941 942 - svc_close_list(&serv->sv_tempsocks); 943 - svc_close_list(&serv->sv_permsocks); 944 - 945 942 for (i = 0; i < serv->sv_nrpools; i++) { 946 943 pool = &serv->sv_pools[i]; 947 944 948 945 spin_lock_bh(&pool->sp_lock); 949 - while (!list_empty(&pool->sp_sockets)) { 950 - xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready); 946 + list_for_each_entry_safe(xprt, tmp, &pool->sp_sockets, xpt_ready) { 951 947 list_del_init(&xprt->xpt_ready); 952 948 } 953 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 963 * At this point the sp_sockets lists will stay empty, since 957 964 * svc_enqueue will not add new entries without taking the