summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* NFSv4.1: Fix the r/wsize checkingTrond Myklebust2018-09-301-7/+9
| | | | | | | | | | | | | | | | | | | The intention of nfs4_session_set_rwsize() was to cap the r/wsize to the buffer sizes negotiated by the CREATE_SESSION. The initial code had a bug whereby we would not check the values negotiated by nfs_probe_fsinfo() (the assumption being that CREATE_SESSION will always negotiate buffer values that are sane w.r.t. the server's preferred r/wsizes) but would only check values set by the user in the 'mount' command. The code was changed in 4.11 to _always_ set the r/wsize, meaning that we now never use the server preferred r/wsizes. This is the regression that this patch fixes. Also rename the function to nfs4_session_limit_rwsize() in order to avoid future confusion. Fixes: 033853325fe3 (NFSv4.1 respect server's max size in CREATE_SESSION") Cc: stable@vger.kernel.org # v4.11+ Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* NFSv4: Convert struct nfs4_state to use refcount_tTrond Myklebust2018-09-303-9/+9
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* NFSv4: Convert open state lookup to use RCUTrond Myklebust2018-09-302-6/+7
| | | | | | Further reduce contention on the inode->i_lock. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* NFS: Convert lookups of the open context to RCUTrond Myklebust2018-09-306-38/+56
| | | | | | | Reduce contention on the inode->i_lock by ensuring that we use RCU when looking up the NFS open context. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* NFS: Simplify internal check for whether file is open for writeTrond Myklebust2018-09-301-9/+1
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* NFS: Convert lookups of the lock context to RCUTrond Myklebust2018-09-302-13/+13
| | | | | | | Speed up lookups of an existing lock context by avoiding the inode->i_lock, and using RCU instead. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* pNFS: Don't allocate more pages than we need to fit a layoutget responseTrond Myklebust2018-09-304-0/+10
| | | | | | | | For the 'files' and 'flexfiles' layout types, we do not expect the reply to be any larger than 4k. The block and scsi layout types are a little more greedy, so we keep allocating the maximum response size for now. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* pNFS: Don't zero out the array in nfs4_alloc_pages()Trond Myklebust2018-09-301-2/+2
| | | | | | We don't need a zeroed out array, since it is immediately being filled. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Unexport xdr_partial_copy_from_skb()Trond Myklebust2018-09-302-4/+2
| | | | | | It is no longer used outside of net/sunrpc/socklib.c Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Clean up xs_udp_data_receive()Trond Myklebust2018-09-301-12/+5
| | | | | | Simplify the retry logic. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Allow AF_LOCAL sockets to use the generic stream receiveTrond Myklebust2018-09-303-124/+18
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Clean up - rename xs_tcp_data_receive() to xs_stream_data_receive()Trond Myklebust2018-09-302-49/+38
| | | | | | In preparation for sharing with AF_LOCAL. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Simplify TCP receive code by switching to using iteratorsTrond Myklebust2018-09-303-393/+338
| | | | | | Most of this code should also be reusable with other socket types. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Add a bvec array to struct xdr_buf for use with iovec_iter()Trond Myklebust2018-09-305-1/+63
| | | | | | | Add a bvec array to struct xdr_buf, and have the client allocate it when we need to receive data into pages. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Add a label for RPC calls that require allocation on receiveTrond Myklebust2018-09-304-2/+6
| | | | | | | | | | If the RPC call relies on the receive call allocating pages as buffers, then let's label it so that we a) Don't leak memory by allocating pages for requests that do not expect this behaviour b) Can optimise for the common case where calls do not require allocation. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Convert the xprt->sending queue back to an ordinary wait queueTrond Myklebust2018-09-301-17/+3
| | | | | | | | | | We no longer need priority semantics on the xprt->sending queue, because the order in which tasks are sent is now dictated by their position in the send queue. Note that the backlog queue remains a priority queue, meaning that slot resources are still managed in order of task priority. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Fix priority queue fairnessTrond Myklebust2018-09-302-57/+54
| | | | | | | | | | | Fix up the priority queue to not batch by owner, but by queue, so that we allow '1 << priority' elements to be dequeued before switching to the next priority queue. The owner field is still used to wake up requests in round robin order by owner to avoid single processes hogging the RPC layer by loading the queues. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Convert xprt receive queue to use an rbtreeTrond Myklebust2018-09-302-13/+84
| | | | | | | | | If the server is slow, we can find ourselves with quite a lot of entries on the receive queue. Converting the search from an O(n) to O(log(n)) can make a significant difference, particularly since we have to hold a number of locks while searching. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Don't take transport->lock unnecessarily when taking XPRT_LOCKTrond Myklebust2018-09-301-2/+5
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Cleanup: remove the unused 'task' argument from the request_send()Trond Myklebust2018-09-305-12/+9
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Clean up transport write space handlingTrond Myklebust2018-09-308-82/+73
| | | | | | | | Treat socket write space handling in the same way we now treat transport congestion: by denying the XPRT_LOCK until the transport signals that it has free buffer space. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Turn off throttling of RPC slots for TCP socketsTrond Myklebust2018-09-303-16/+1
| | | | | | | | The theory was that we would need to grab the socket lock anyway, so we might as well use it to gate the allocation of RPC slots for a TCP socket. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Allow soft RPC calls to time out when waiting for the XPRT_LOCKTrond Myklebust2018-09-301-2/+2
| | | | | | This no longer causes them to lose their place in the transmission queue. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Allow calls to xprt_transmit() to drain the entire transmit queueTrond Myklebust2018-09-301-11/+60
| | | | | | | | Rather than forcing each and every RPC task to grab the socket write lock in order to send itself, we allow whichever task is holding the write lock to attempt to drain the entire transmit queue. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Enqueue swapper tagged RPCs at the head of the transmit queueTrond Myklebust2018-09-301-0/+11
| | | | | | | Avoid memory starvation by giving RPCs that are tagged with the RPC_TASK_SWAPPER flag the highest priority. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Support for congestion control when queuing is enabledTrond Myklebust2018-09-306-36/+109
| | | | | | | | | | | | Both RDMA and UDP transports require the request to get a "congestion control" credit before they can be transmitted. Right now, this is done when the request locks the socket. We'd like it to happen when a request attempts to be transmitted for the first time. In order to support retransmission of requests that already hold such credits, we also want to ensure that they get queued first, so that we don't deadlock with requests that have yet to obtain a credit. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Improve latency for interactive tasksTrond Myklebust2018-09-302-3/+25
| | | | | | | | | | | One of the intentions with the priority queues was to ensure that no single process can hog the transport. The field task->tk_owner therefore identifies the RPC call's origin, and is intended to allow the RPC layer to organise queues for fairness. This commit therefore modifies the transmit queue to group requests by task->tk_owner, and ensures that we round robin among those groups. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Move RPC retransmission stat counter to xprt_transmit()Trond Myklebust2018-09-302-13/+12
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Simplify xprt_prepare_transmit()Trond Myklebust2018-09-301-16/+7
| | | | | | | | Remove the checks for whether or not we need to transmit, and whether or not a reply has been received. Those are already handled in call_transmit() itself. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Don't reset the request 'bytes_sent' counter when releasing XPRT_LOCKTrond Myklebust2018-09-302-18/+0
| | | | | | If the request is still on the queue, this will be incorrect behaviour. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Treat the task and request as separate in the xprt_ops->send_request()Trond Myklebust2018-09-305-21/+18
| | | | | | | When we shift to using the transmit queue, then the task that holds the write lock will not necessarily be the same as the one being transmitted. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Fix up the back channel transmitTrond Myklebust2018-09-303-15/+32
| | | | | | | | Fix up the back channel code to recognise that it has already been transmitted, so does not need to be called again. Also ensure that we set req->rq_task. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Refactor RPC call encodingTrond Myklebust2018-09-303-41/+63
| | | | | | | Move the call encoding so that it occurs before the transport connection etc. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Add a transmission queue for RPC requestsTrond Myklebust2018-09-303-13/+83
| | | | | | Add the queue that will enforce the ordering of RPC task transmission. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Distinguish between the slot allocation list and receive queueTrond Myklebust2018-09-302-8/+13
| | | | | | | | | | | | When storing a struct rpc_rqst on the slot allocation list, we currently use the same field 'rq_list' as we use to store the request on the receive queue. Since the structure is never on both lists at the same time, this is OK. However, for clarity, let's make that a union with different names for the different lists so that we can more easily distinguish between the two states. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Minor cleanup for call_transmit()Trond Myklebust2018-09-301-17/+15
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Refactor xprt_transmit() to remove wait for reply codeTrond Myklebust2018-09-303-31/+54
| | | | | | | | Allow the caller in clnt.c to call into the code to wait for a reply after calling xprt_transmit(). Again, the reason is that the backchannel code does not need this functionality. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Refactor xprt_transmit() to remove the reply queue codeTrond Myklebust2018-09-305-46/+89
| | | | | | | Separate out the action of adding a request to the reply queue so that the backchannel code can simply skip calling it altogether. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Rename xprt->recv_lock to xprt->queue_lockTrond Myklebust2018-09-306-38/+38
| | | | | | We will use the same lock to protect both the transmit and receive queues. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Don't wake queued RPC calls multiple times in xprt_transmitTrond Myklebust2018-09-301-6/+3
| | | | | | | Rather than waking up the entire queue of RPC messages a second time, just wake up the task that was put to sleep. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Test whether the task is queued before grabbing the queue spinlocksTrond Myklebust2018-09-301-0/+4
| | | | | | | When asked to wake up an RPC task, it makes sense to test whether or not the task is still queued. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Add a helper to wake up a sleeping rpc_task and set its statusTrond Myklebust2018-09-302-10/+58
| | | | | | | | | Add a helper that will wake up a task that is sleeping on a specific queue, and will set the value of task->tk_status. This is mainly intended for use by the transport layer to notify the task of an error condition. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Refactor the transport request pinningTrond Myklebust2018-09-303-22/+25
| | | | | | We are going to need to pin for both send and receive. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Simplify dealing with aborted partially transmitted messagesTrond Myklebust2018-09-301-26/+25
| | | | | | | | | | | | If the previous message was only partially transmitted, we need to close the socket in order to avoid corruption of the message stream. To do so, we currently hijack the unlocking of the socket in order to schedule the close. Now that we track the message offset in the socket state, we can move that kind of checking out of the socket lock code, which is needed to allow messages to remain queued after dropping the socket lock. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Add socket transmit queue offset trackingTrond Myklebust2018-09-302-18/+29
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Move reset of TCP state variables into the reconnect codeTrond Myklebust2018-09-301-7/+6
| | | | | | | Rather than resetting state variables in socket state_change() callback, do it in the sunrpc TCP connect function itself. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Rename TCP receive-specific state variablesTrond Myklebust2018-09-303-101/+103
| | | | | | | | Since we will want to introduce similar TCP state variables for the transmission of requests, let's rename the existing ones to label that they are for the receive side. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Avoid holding locks across the XDR encoding of the RPC messageTrond Myklebust2018-09-301-3/+3
| | | | | | | | Currently, we grab the socket bit lock before we allow the message to be XDR encoded. That significantly slows down the transmission rate, since we serialise on a potentially blocking operation. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: Simplify identification of when the message send/receive is completeTrond Myklebust2018-09-303-17/+25
| | | | | | | Add states to indicate that the message send and receive are not yet complete. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* SUNRPC: The transmitted message must lie in the RPCSEC window of validityTrond Myklebust2018-09-306-0/+64
| | | | | | | | | | | | | | | If a message has been encoded using RPCSEC_GSS, the server is maintaining a window of sequence numbers that it considers valid. The client should normally be tracking that window, and needs to verify that the sequence number used by the message being transmitted still lies inside the window of validity. So far, we've been able to assume this condition would be realised automatically, since the client has been encoding the message only after taking the socket lock. Once we change that condition, we will need the explicit check. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>