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

SUNRPC: clear svc transports lists helper introduced

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>

authored by

Stanislav Kinsbursky and committed by
Trond Myklebust
3a22bf50 6f513365

+11 -8
+11 -8
net/sunrpc/svc_xprt.c
··· 950 950 } 951 951 } 952 952 953 - void svc_close_all(struct svc_serv *serv) 953 + static void svc_clear_list(struct list_head *xprt_list) 954 954 { 955 955 struct svc_xprt *xprt; 956 956 struct svc_xprt *tmp; 957 957 958 + list_for_each_entry_safe(xprt, tmp, xprt_list, xpt_list) { 959 + svc_delete_xprt(xprt); 960 + } 961 + BUG_ON(!list_empty(xprt_list)); 962 + } 963 + 964 + void svc_close_all(struct svc_serv *serv) 965 + { 958 966 svc_close_list(&serv->sv_tempsocks); 959 967 svc_close_list(&serv->sv_permsocks); 960 968 ··· 972 964 * svc_enqueue will not add new entries without taking the 973 965 * sp_lock and checking XPT_BUSY. 974 966 */ 975 - list_for_each_entry_safe(xprt, tmp, &serv->sv_tempsocks, xpt_list) 976 - svc_delete_xprt(xprt); 977 - list_for_each_entry_safe(xprt, tmp, &serv->sv_permsocks, xpt_list) 978 - svc_delete_xprt(xprt); 979 - 980 - BUG_ON(!list_empty(&serv->sv_permsocks)); 981 - BUG_ON(!list_empty(&serv->sv_tempsocks)); 967 + svc_clear_list(&serv->sv_tempsocks); 968 + svc_clear_list(&serv->sv_permsocks); 982 969 } 983 970 984 971 /*