Merge tag 'nfs-for-4.15-3' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client fixes from Anna Schumaker: "This has two stable bugfixes, one to fix a BUG_ON() when nfs_commit_inode() is called with no outstanding commit requests and another to fix a race in the SUNRPC receive codepath. Additionally, there are also fixes for an NFS client deadlock and an xprtrdma performance regression. Summary: Stable bugfixes: - NFS: Avoid a BUG_ON() in nfs_commit_inode() by not waiting for a commit in the case that there were no commit requests. - SUNRPC: Fix a race in the receive code path Other fixes: - NFS: Fix a deadlock in nfs client initialization - xprtrdma: Fix a performance regression for small IOs" * tag 'nfs-for-4.15-3' of git://git.linux-nfs.org/projects/anna/linux-nfs: SUNRPC: Fix a race in the receive code path nfs: don't wait on commit in nfs_commit_inode() if there were no commit requests xprtrdma: Spread reply processing over more CPUs nfs: fix a deadlock in nfs client initialization
This commit is contained in:
@@ -1001,6 +1001,7 @@ void xprt_transmit(struct rpc_task *task)
|
||||
{
|
||||
struct rpc_rqst *req = task->tk_rqstp;
|
||||
struct rpc_xprt *xprt = req->rq_xprt;
|
||||
unsigned int connect_cookie;
|
||||
int status, numreqs;
|
||||
|
||||
dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
|
||||
@@ -1024,6 +1025,7 @@ void xprt_transmit(struct rpc_task *task)
|
||||
} else if (!req->rq_bytes_sent)
|
||||
return;
|
||||
|
||||
connect_cookie = xprt->connect_cookie;
|
||||
req->rq_xtime = ktime_get();
|
||||
status = xprt->ops->send_request(task);
|
||||
trace_xprt_transmit(xprt, req->rq_xid, status);
|
||||
@@ -1047,20 +1049,28 @@ void xprt_transmit(struct rpc_task *task)
|
||||
xprt->stat.bklog_u += xprt->backlog.qlen;
|
||||
xprt->stat.sending_u += xprt->sending.qlen;
|
||||
xprt->stat.pending_u += xprt->pending.qlen;
|
||||
|
||||
/* Don't race with disconnect */
|
||||
if (!xprt_connected(xprt))
|
||||
task->tk_status = -ENOTCONN;
|
||||
else {
|
||||
/*
|
||||
* Sleep on the pending queue since
|
||||
* we're expecting a reply.
|
||||
*/
|
||||
if (!req->rq_reply_bytes_recvd && rpc_reply_expected(task))
|
||||
rpc_sleep_on(&xprt->pending, task, xprt_timer);
|
||||
req->rq_connect_cookie = xprt->connect_cookie;
|
||||
}
|
||||
spin_unlock_bh(&xprt->transport_lock);
|
||||
|
||||
req->rq_connect_cookie = connect_cookie;
|
||||
if (rpc_reply_expected(task) && !READ_ONCE(req->rq_reply_bytes_recvd)) {
|
||||
/*
|
||||
* Sleep on the pending queue if we're expecting a reply.
|
||||
* The spinlock ensures atomicity between the test of
|
||||
* req->rq_reply_bytes_recvd, and the call to rpc_sleep_on().
|
||||
*/
|
||||
spin_lock(&xprt->recv_lock);
|
||||
if (!req->rq_reply_bytes_recvd) {
|
||||
rpc_sleep_on(&xprt->pending, task, xprt_timer);
|
||||
/*
|
||||
* Send an extra queue wakeup call if the
|
||||
* connection was dropped in case the call to
|
||||
* rpc_sleep_on() raced.
|
||||
*/
|
||||
if (!xprt_connected(xprt))
|
||||
xprt_wake_pending_tasks(xprt, -ENOTCONN);
|
||||
}
|
||||
spin_unlock(&xprt->recv_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task)
|
||||
|
Reference in New Issue
Block a user