Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4a50d68c
Commit
4a50d68c
authored
Mar 13, 2004
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RPC: Make XIDs unique on a per-transport basis rather than globally unique. Gets rid
of an unnecessary global spinlock.
parent
bf78ace2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprt.h
+5
-1
net/sunrpc/xprt.c
net/sunrpc/xprt.c
+11
-16
No files found.
include/linux/sunrpc/xprt.h
View file @
4a50d68c
...
...
@@ -102,7 +102,6 @@ struct rpc_rqst {
struct
xdr_buf
rq_private_buf
;
/* The receive buffer
* used in the softirq.
*/
/*
* For authentication (e.g. auth_des)
*/
...
...
@@ -154,6 +153,11 @@ struct rpc_xprt {
resvport
:
1
,
/* use a reserved port */
stream
:
1
;
/* TCP */
/*
* XID
*/
__u32
xid
;
/* Next XID value to use */
/*
* State of TCP reply receive stuff
*/
...
...
net/sunrpc/xprt.c
View file @
4a50d68c
...
...
@@ -57,6 +57,7 @@
#include <linux/sunrpc/clnt.h>
#include <linux/file.h>
#include <linux/workqueue.h>
#include <linux/random.h>
#include <net/sock.h>
#include <net/checksum.h>
...
...
@@ -1330,22 +1331,14 @@ do_xprt_reserve(struct rpc_task *task)
/*
* Allocate a 'unique' XID
*/
static
u32
xprt_alloc_xid
(
void
)
static
inline
u32
xprt_alloc_xid
(
struct
rpc_xprt
*
xprt
)
{
static
spinlock_t
xid_lock
=
SPIN_LOCK_UNLOCKED
;
static
int
need_init
=
1
;
static
u32
xid
;
u32
ret
;
spin_lock
(
&
xid_lock
);
if
(
unlikely
(
need_init
))
{
xid
=
get_seconds
()
<<
12
;
need_init
=
0
;
}
ret
=
xid
++
;
spin_unlock
(
&
xid_lock
);
return
ret
;
return
xprt
->
xid
++
;
}
static
inline
void
xprt_init_xid
(
struct
rpc_xprt
*
xprt
)
{
get_random_bytes
(
&
xprt
->
xid
,
sizeof
(
xprt
->
xid
));
}
/*
...
...
@@ -1359,7 +1352,7 @@ xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
req
->
rq_timeout
=
xprt
->
timeout
;
req
->
rq_task
=
task
;
req
->
rq_xprt
=
xprt
;
req
->
rq_xid
=
xprt_alloc_xid
();
req
->
rq_xid
=
xprt_alloc_xid
(
xprt
);
INIT_LIST_HEAD
(
&
req
->
rq_list
);
dprintk
(
"RPC: %4d reserved req %p xid %08x
\n
"
,
task
->
tk_pid
,
req
,
req
->
rq_xid
);
...
...
@@ -1478,6 +1471,8 @@ xprt_setup(int proto, struct sockaddr_in *ap, struct rpc_timeout *to)
req
->
rq_next
=
NULL
;
xprt
->
free
=
xprt
->
slot
;
xprt_init_xid
(
xprt
);
/* Check whether we want to use a reserved port */
xprt
->
resvport
=
capable
(
CAP_NET_BIND_SERVICE
)
?
1
:
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment