Skip to content

Commit 93ccb39

Browse files
committed
Merge tag 'nfs-for-3.8-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfix from Trond Myklebust: - Fix a socket lock leak in net/sunrpc/xprt.c * tag 'nfs-for-3.8-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: SUNRPC: Ensure we release the socket write lock if the rpc_task exits early
2 parents 52b820d + 87ed500 commit 93ccb39

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

net/sunrpc/sched.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,7 @@ static void rpc_async_release(struct work_struct *work)
972972

973973
static void rpc_release_resources_task(struct rpc_task *task)
974974
{
975-
if (task->tk_rqstp)
976-
xprt_release(task);
975+
xprt_release(task);
977976
if (task->tk_msg.rpc_cred) {
978977
put_rpccred(task->tk_msg.rpc_cred);
979978
task->tk_msg.rpc_cred = NULL;

net/sunrpc/xprt.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,10 +1136,18 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
11361136
void xprt_release(struct rpc_task *task)
11371137
{
11381138
struct rpc_xprt *xprt;
1139-
struct rpc_rqst *req;
1139+
struct rpc_rqst *req = task->tk_rqstp;
11401140

1141-
if (!(req = task->tk_rqstp))
1141+
if (req == NULL) {
1142+
if (task->tk_client) {
1143+
rcu_read_lock();
1144+
xprt = rcu_dereference(task->tk_client->cl_xprt);
1145+
if (xprt->snd_task == task)
1146+
xprt_release_write(xprt, task);
1147+
rcu_read_unlock();
1148+
}
11421149
return;
1150+
}
11431151

11441152
xprt = req->rq_xprt;
11451153
if (task->tk_ops->rpc_count_stats != NULL)

0 commit comments

Comments
 (0)