Commit 294d77d9 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] PATCH 10/16: NFSD: TCP: rationalise locking in RPC server routines

Tidy up SMP locking for svc_sock

sk_lock is not necessary and is now removed.
The only things that were happening under sk_lock but
not the more global sv_lock were testing and setting
some of the flags: sk_busy, sk_conn, sk_data etc.

These have been changed to bits in a flags word which are atomically
set and tested.

Also, by establishing some simple rules about that must
be done after setting these flags, the locking is not needed.

With this patch sk_conn and sk_data are now flags, not counts (sk_data
was already a flag for udp).  They are set if there might be
a connection or data, and only clear when we are sure there aren't
(or when we are about to check if there is).

svc_sock_accepted becomes identical to svc_sock_recieved and
so is discarded in favour of the latter.

sk_rqstp was never used and is now gone.
parent 2b063bda
...@@ -19,17 +19,18 @@ struct svc_sock { ...@@ -19,17 +19,18 @@ struct svc_sock {
struct list_head sk_list; /* list of all sockets */ struct list_head sk_list; /* list of all sockets */
struct socket * sk_sock; /* berkeley socket layer */ struct socket * sk_sock; /* berkeley socket layer */
struct sock * sk_sk; /* INET layer */ struct sock * sk_sk; /* INET layer */
spinlock_t sk_lock;
struct svc_serv * sk_server; /* service for this socket */ struct svc_serv * sk_server; /* service for this socket */
unsigned char sk_inuse; /* use count */ unsigned char sk_inuse; /* use count */
unsigned char sk_busy; /* enqueued/receiving */ unsigned int sk_flags;
unsigned char sk_conn; /* conn pending */ #define SK_BUSY 0 /* enqueued/receiving */
unsigned char sk_close; /* dead or dying */ #define SK_CONN 1 /* conn pending */
int sk_data; /* data pending */ #define SK_CLOSE 2 /* dead or dying */
unsigned int sk_temp : 1, /* temp socket */ #define SK_DATA 3 /* data pending */
sk_qued : 1, /* on serv->sk_sockets */ #define SK_TEMP 4 /* temp (TCP) socket */
sk_dead : 1; /* socket closed */ #define SK_QUED 5 /* on serv->sk_sockets */
#define SK_DEAD 6 /* socket closed */
int (*sk_recvfrom)(struct svc_rqst *rqstp); int (*sk_recvfrom)(struct svc_rqst *rqstp);
int (*sk_sendto)(struct svc_rqst *rqstp); int (*sk_sendto)(struct svc_rqst *rqstp);
...@@ -40,9 +41,6 @@ struct svc_sock { ...@@ -40,9 +41,6 @@ struct svc_sock {
/* private TCP part */ /* private TCP part */
int sk_reclen; /* length of record */ int sk_reclen; /* length of record */
int sk_tcplen; /* current read length */ int sk_tcplen; /* current read length */
/* Debugging */
struct svc_rqst * sk_rqstp;
}; };
/* /*
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment