Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a182083 authored by Tom Tucker's avatar Tom Tucker Committed by J. Bruce Fields
Browse files

svc: Make close transport independent



Move sk_list and sk_ready to svc_xprt. This involves close because these
lists are walked by svcs when closing all their transports. So I combined
the moving of these lists to svc_xprt with making close transport independent.

The svc_force_sock_close has been changed to svc_close_all and takes a list
as an argument. This removes some svc internals knowledge from the svcs.

This code races with module removal and transport addition.

Thanks to Simon Holm Thøgersen for a compile fix.

Signed-off-by: default avatarTom Tucker <tom@opengridcomputing.com>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarGreg Banks <gnb@sgi.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Cc: Simon Holm Thøgersen <odie@cs.aau.dk>
parent bb5cf160
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -221,10 +221,10 @@ lockd(struct svc_rqst *rqstp)

static int find_xprt(struct svc_serv *serv, char *proto)
{
	struct svc_sock *svsk;
	struct svc_xprt *xprt;
	int found = 0;
	list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
		if (strcmp(svsk->sk_xprt.xpt_class->xcl_name, proto) == 0) {
	list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list)
		if (strcmp(xprt->xpt_class->xcl_name, proto) == 0) {
			found = 1;
			break;
		}
+2 −2
Original line number Diff line number Diff line
@@ -155,8 +155,8 @@ static int killsig; /* signal that was used to kill last nfsd */
static void nfsd_last_thread(struct svc_serv *serv)
{
	/* When last nfsd thread exits we need to do some clean-up */
	struct svc_sock *svsk;
	list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
	struct svc_xprt *xprt;
	list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list)
		lockd_down();
	nfsd_serv = NULL;
	nfsd_racache_shutdown();
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ struct svc_xprt {
	struct svc_xprt_class	*xpt_class;
	struct svc_xprt_ops	*xpt_ops;
	struct kref		xpt_ref;
	struct list_head	xpt_list;
	struct list_head	xpt_ready;
	unsigned long		xpt_flags;
#define	XPT_BUSY	0		/* enqueued/receiving */
#define	XPT_CONN	1		/* conn pending */
+1 −3
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
 */
struct svc_sock {
	struct svc_xprt		sk_xprt;
	struct list_head	sk_ready;	/* list of ready sockets */
	struct list_head	sk_list;	/* list of all sockets */
	struct socket *		sk_sock;	/* berkeley socket layer */
	struct sock *		sk_sk;		/* INET layer */

@@ -51,7 +49,7 @@ struct svc_sock {
/*
 * Function prototypes.
 */
void		svc_force_close_socket(struct svc_sock *);
void		svc_close_all(struct list_head *);
int		svc_recv(struct svc_rqst *, long);
int		svc_send(struct svc_rqst *);
void		svc_drop(struct svc_rqst *);
+2 −7
Original line number Diff line number Diff line
@@ -459,9 +459,6 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
void
svc_destroy(struct svc_serv *serv)
{
	struct svc_sock	*svsk;
	struct svc_sock *tmp;

	dprintk("svc: svc_destroy(%s, %d)\n",
				serv->sv_program->pg_name,
				serv->sv_nrthreads);
@@ -476,14 +473,12 @@ svc_destroy(struct svc_serv *serv)

	del_timer_sync(&serv->sv_temptimer);

	list_for_each_entry_safe(svsk, tmp, &serv->sv_tempsocks, sk_list)
		svc_force_close_socket(svsk);
	svc_close_all(&serv->sv_tempsocks);

	if (serv->sv_shutdown)
		serv->sv_shutdown(serv);

	list_for_each_entry_safe(svsk, tmp, &serv->sv_permsocks, sk_list)
		svc_force_close_socket(svsk);
	svc_close_all(&serv->sv_permsocks);

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