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
nexedi
linux
Commits
a92694eb
Commit
a92694eb
authored
May 07, 2003
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a TCP race: check whether or not the socket has been disconnected
before we allow an RPC request to wait on a reply.
parent
1a961d01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
net/sunrpc/xprt.c
net/sunrpc/xprt.c
+12
-4
No files found.
net/sunrpc/xprt.c
View file @
a92694eb
...
...
@@ -397,8 +397,10 @@ static void
xprt_disconnect
(
struct
rpc_xprt
*
xprt
)
{
dprintk
(
"RPC: disconnected transport %p
\n
"
,
xprt
);
spin_lock_bh
(
&
xprt
->
sock_lock
);
xprt_clear_connected
(
xprt
);
rpc_wake_up_status
(
&
xprt
->
pending
,
-
ENOTCONN
);
spin_unlock_bh
(
&
xprt
->
sock_lock
);
}
/*
...
...
@@ -986,10 +988,10 @@ tcp_state_change(struct sock *sk)
xprt
->
tcp_copied
=
0
;
xprt
->
tcp_flags
=
XPRT_COPY_RECM
|
XPRT_COPY_XID
;
spin_lock
(
&
xprt
->
sock_lock
);
spin_lock
_bh
(
&
xprt
->
sock_lock
);
if
(
xprt
->
snd_task
&&
xprt
->
snd_task
->
tk_rpcwait
==
&
xprt
->
pending
)
rpc_wake_up_task
(
xprt
->
snd_task
);
spin_unlock
(
&
xprt
->
sock_lock
);
spin_unlock
_bh
(
&
xprt
->
sock_lock
);
break
;
case
TCP_SYN_SENT
:
case
TCP_SYN_RECV
:
...
...
@@ -1192,7 +1194,10 @@ xprt_transmit(struct rpc_task *task)
if
(
test_bit
(
SOCK_ASYNC_NOSPACE
,
&
xprt
->
sock
->
flags
))
{
/* Protect against races with xprt_write_space */
spin_lock_bh
(
&
xprt
->
sock_lock
);
if
(
test_bit
(
SOCK_NOSPACE
,
&
xprt
->
sock
->
flags
))
{
/* Don't race with disconnect */
if
(
!
xprt_connected
(
xprt
))
task
->
tk_status
=
-
ENOTCONN
;
else
if
(
test_bit
(
SOCK_NOSPACE
,
&
xprt
->
sock
->
flags
))
{
task
->
tk_timeout
=
req
->
rq_timeout
.
to_current
;
rpc_sleep_on
(
&
xprt
->
pending
,
task
,
NULL
,
NULL
);
}
...
...
@@ -1230,7 +1235,10 @@ xprt_transmit(struct rpc_task *task)
}
else
task
->
tk_timeout
=
req
->
rq_timeout
.
to_current
;
spin_lock_bh
(
&
xprt
->
sock_lock
);
if
(
!
req
->
rq_received
)
/* Don't race with disconnect */
if
(
!
xprt_connected
(
xprt
))
task
->
tk_status
=
-
ENOTCONN
;
else
if
(
!
req
->
rq_received
)
rpc_sleep_on
(
&
xprt
->
pending
,
task
,
NULL
,
xprt_timer
);
__xprt_release_write
(
xprt
,
task
);
spin_unlock_bh
(
&
xprt
->
sock_lock
);
...
...
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