aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-10-25svcrpc: assume svc_delete_xprt() called only onceJ. Bruce Fields1-1/+1
As long as DEAD exports are left BUSY, and svc_delete_xprt is called only with BUSY held, then svc_delete_xprt() will never be called on an xprt that is already DEAD. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-25svcrpc: never clear XPT_BUSY on dead xprtJ. Bruce Fields1-3/+0
Once an xprt has been deleted, there's no reason to allow it to be enqueued--at worst, that might cause the xprt to be re-added to some global list, resulting in later corruption. Also, note this leaves us with no need for the reference-count manipulation here. Reviewed-by: NeilBrown <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-24nfsd4: fix connection allocation in sequence()J. Bruce Fields1-14/+17
We're doing an allocation under a spinlock, and ignoring the possibility of allocation failure. A better fix wouldn't require an unnecessary allocation in the common case, but we'll leave that for later. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: only require krb5 principal for NFSv4.0 callbacksJ. Bruce Fields1-7/+8
In the sessions backchannel case, we don't need a krb5 principal name for the client; we use the already-created forechannel credentials instead. Some cleanup, while we're there: make it clearer which code here is 4.0- or sessions- specific. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: move minorversion to clientJ. Bruce Fields3-7/+15
The minorversion seems more a property of the client than the callback channel. Some time we should probably also enforce consistent minorversion usage from the client; for now, this is just a cosmetic change. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: delay session removal till free_clientJ. Bruce Fields1-8/+13
Have unhash_client_locked() remove client and associated sessions from global hashes, but delay further dismantling till free_client(). (After unhash_client_locked(), the only remaining references outside the destroying thread are from any connections which have xpt_user callbacks registered.) This will simplify locking on session destruction. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: separate callback change and callback probeJ. Bruce Fields3-9/+16
Only one of the nfsd4_callback_probe callers actually cares about changing the callback information. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: callback program number is per-sessionJ. Bruce Fields3-2/+5
The callback program is allowed to depend on the session which the callback is going over. No change in behavior yet, while we still only do callbacks over a single session for the lifetime of the client. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: track backchannel connectionsJ. Bruce Fields1-4/+7
We need to keep track of which connections are available for use with the backchannel, which for the forechannel, and which for both. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: confirm only on succesful create_sessionJ. Bruce Fields1-3/+5
Following rfc 5661, section 18.36.4: "If the session is not successfully created, then no changes are made to any client records on the server." We shouldn't be confirming or incrementing the sequence id in this case. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: make backchannel sequence number per-sessionJ. Bruce Fields3-15/+17
Currently we don't deal well with a client that has multiple sessions associated with it (even simultaneously, or serially over the lifetime of the client). In particular, we don't attempt to keep the backchannel running after the original session diseappears. We will fix that soon. Once we do that, we need the slot sequence number to be per-session; otherwise, for example, we cannot correctly handle a case like this: - All session 1 connections are lost. - The client creates session 2. We use it for the backchannel (since it's the only working choice). - The client gives us a new connection to use with session 1. - The client destroys session 2. At this point our only choice is to go back to using session 1. When we do so we must use the sequence number that is next for session 1. We therefore need to maintain multiple sequence number streams. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: use client pointer to backchannel sessionJ. Bruce Fields3-8/+6
Instead of copying the sessionid, use the new cl_cb_session pointer, which indicates which session we're using for the backchannel. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: move callback setup into session init codeJ. Bruce Fields2-15/+15
The backchannel should be associated with a session, it isn't really global to the client. We do, however, want a pointer global to the client which tracks which session we're currently using for client-based callbacks. This is a first step in that direction; for now, just reshuffling of code with no significant change in behavior. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21nfsd4: don't cache seq_misordered repliesJ. Bruce Fields1-2/+1
Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21SUNRPC: Properly initialize sock_xprt.srcaddr in all casesChuck Lever1-1/+32
The source address field in the transport's sock_xprt is initialized ONLY IF the RPC application passed a pointer to a source address during the call to rpc_create(). However, xs_bind() subsequently uses the value of this field without regard to whether the source address was initialized during transport creation or not. So far we've been lucky: the uninitialized value of this field is zeroes. xs_bind(), until recently, used only the sin[6]_addr field in this sockaddr, and all zeroes is a valid value for this: it means ANYADDR. This is a happy coincidence. However, xs_bind() now wants to use the sa_family field as well, and expects it to be initialized to something other than zero. Therefore, the source address sockaddr field should be fully initialized at transport create time in _every_ case, not just when the RPC application wants to use a specific bind address. Bruce added a workaround for this missing initialization by adjusting commit 6bc9638a, but the "right" way to do this is to ensure that the source address sockaddr is always correctly initialized from the get-go. This patch doesn't introduce a behavior change. It's simply a clean-up of Bruce's fix, to prevent future problems of this kind. It may look like overkill, but a) it clearly documents the default initial value of this field, b) it doesn't assume that the sockaddr_storage memory is first initialized to any particular value, and c) it will fail verbosely if some unknown address family is passed in Originally introduced by commit d3bc9a1d. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21SUNRPC: Use conventional switch statement when reclassifying socketsChuck Lever1-3/+7
Clean up. Defensive coding: If "family" is ever something that is neither AF_INET nor AF_INET6, xs_reclassify_socket6() is not the appropriate default action. Choose to do nothing in that case. Introduced by commit 6bc9638a. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-21sunrpc/xprtrdma: clean up workqueue usageTejun Heo3-5/+17
* Create and use svc_rdma_wq instead of using the system workqueue and flush_scheduled_work(). This workqueue is necessary to serve as flushing domain for rdma->sc_work which is used to destroy itself and thus can't be flushed explicitly. * Replace cancel_delayed_work() + flush_scheduled_work() with cancel_delayed_work_sync(). * Implement synchronous connect in xprt_rdma_connect() using flush_delayed_work() on the rdma_connect work instead of using flush_scheduled_work(). This is to prepare for the deprecation and removal of flush_scheduled_work(). Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Turn list_for_each-s into the ..._entry-sPavel Emelyanov3-17/+7
Saves some lines of code and some branticks when reading one. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove dead "else" branch from bc xprt creationPavel Emelyanov1-9/+4
Since the xprt in question is forcibly set to be bound the else branch of this check is unneeded. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Don't return NULL from rpcb_createPavel Emelyanov1-1/+1
> The reason for this is in the future, we may want to support additional > address family types. We should, therefore, ensure that every piece of > code that is sensitive to address families fail in some orderly manner > to let developers know where a change is needed. Makes sense. I was under impression, that AF-s other than INET are not cared about at all :( Here's a fixed version of the patch. Log: Its callers check for ERR_PTR. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove useless if (task == NULL) from xprt_reserve_xprtPavel Emelyanov1-2/+0
The task in question is dereferenced above (and is actually never NULL). Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove UDP worker wrappersPavel Emelyanov1-34/+7
Same for UDP sockets creation paths. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove TCP worker wrappersPavel Emelyanov1-32/+7
The v4 and the v6 wrappers only pass the respective family to the xs_tcp_setup_socket. This family can be taken from the xprt's sockaddr. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Pass family to setup_socket callsPavel Emelyanov1-24/+8
Now we have a single socket creation routine and can call it directly from the setup_socket routines. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Merge xs_create_sock codePavel Emelyanov1-25/+24
After xs_bind is merged it's easy to merge its callers. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> [[email protected]: fix address family initialization] Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Merge the xs_bind codePavel Emelyanov1-47/+19
There's the only difference betseen the xs_bind4 and the xs_bind6 - the size of sockaddr structure they use. Fortunatelly its size can be indirectly get from the transport. Change since v1: * use sockaddr_storage instead of sockaddr * use rpc_set_port instead of manual port assigning Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> [[email protected]: fix address family initialization] Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Call xs_create_sockX directly from setup_socketPavel Emelyanov1-32/+8
Remove now unneeded wrappers that just add type and protocol to socket creation callback. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Factor out v6 sockets creationPavel Emelyanov1-37/+26
Same patch for v6 protocols. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Factor out v4 sockets creationPavel Emelyanov1-37/+26
The UDPv4 and TCPv4 socket creation callbacks now look very similar. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Factor out udp sockets creationPavel Emelyanov1-40/+56
Make it look like the TCP sockets creation. Unfortunately the git diff made the patch look messy :( Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove duplicate xprt/transport arguments from callsPavel Emelyanov1-6/+6
The xs_tcp_reuse_connection takes the xprt only to pass it down to the xs_abort_connection. The later one can get it from the given transport itself. Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Get xprt pointer once in xs_tcp_setup_socketPavel Emelyanov1-6/+4
Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove unused sock arg from xs_next_srcportPavel Emelyanov1-3/+3
Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-19sunrpc: Remove unused sock arg from xs_get_srcportPavel Emelyanov1-3/+3
Signed-off-by: Pavel Emelyanov <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-18svcrdma: Cleanup DMA unmapping in error paths.Tom Tucker3-15/+17
There are several error paths in the code that do not unmap DMA. This patch adds calls to svc_rdma_unmap_dma to free these DMA contexts. Signed-off-by: Tom Tucker <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-18svcrdma: Change DMA mapping logic to avoid the page_address kernel APITom Tucker3-38/+78
There was logic in the send path that assumed that a page containing data to send to the client has a KVA. This is not always the case and can result in data corruption when page_address returns zero and we end up DMA mapping zero. This patch changes the bus mapping logic to avoid page_address() where necessary and converts all calls from ib_dma_map_single to ib_dma_map_page in order to keep the map/unmap calls symmetric. Signed-off-by: Tom Tucker <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-11nfsd4: expire clients more promptlyJ. Bruce Fields1-1/+1
Expire clients more promptly, at the expense of possibly running the laundromat thread more frequently. Though it's not the default, I'd like it to be feasible to run with a lease time of just a few seconds, at which point a minimum 10 second wait between laundromat runs seems a little much. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-11sunrpc: Use helper to set v4 mapped addr in ip_map_parsePavel Emelyanov1-3/+2
Signed-off-by: Pavel Emelyanov <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-11sunrpc/cache: centralise handling of size limit on deferred list.NeilBrown1-24/+43
We limit the number of 'defer' requests to DFR_MAX. The imposition of this limit is spread about a bit - sometime we don't add new things to the list, sometimes we remove old things. Also it is currently applied to requests which we are 'waiting' for rather than 'deferring'. This doesn't seem ideal as 'waiting' requests are naturally limited by the number of threads. So gather the DFR_MAX handling code to one place and only apply it to requests that are actually being deferred. This means that not all 'cache_deferred_req' structures go on the 'cache_defer_list, so we need to be careful when adding and removing things. Signed-off-by: NeilBrown <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-11sunrpc: Simplify cache_defer_req and related functions.NeilBrown1-36/+22
The return value from cache_defer_req is somewhat confusing. Various different error codes are returned, but the single caller is only interested in success or failure. In fact it can measure this success or failure itself by checking CACHE_PENDING, which makes the point of the code more explicit. So change cache_defer_req to return 'void' and test CACHE_PENDING after it completes, to see if the request was actually deferred or not. Similarly setup_deferral and cache_wait_req don't need a return value, so make them void and remove some code. The call to cache_revisit_request (to guard against a race) is only needed for the second call to setup_deferral, so move it out of setup_deferral to after that second call. With the first call the race is handled differently (by explicitly calling 'wait_for_completion'). Signed-off-by: NeilBrown <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-02nfsd4: return expired on unfound stateid'sJ. Bruce Fields1-2/+9
Commit 78155ed75f470710f2aecb3e75e3d97107ba8374 "nfsd4: distinguish expired from stale stateids" attempted to distinguish expired and stale stateid's using time information that may not have been completely reliable, so I reverted it. That was throwing out the baby with the bathwater; we still do want to return expired, but let's do that using the simpler approach of just assuming any stateid is expired if it looks like it was given out by the current server instance, but we can't find it any more. This may help clients that are recovering from network partitions. Reported-by: Bian Naimeng <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: add new connections to sessionJ. Bruce Fields1-2/+47
As long as we're not implementing any session security, we should just automatically add any new connections that come along to the list of sessions associated with the session. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: refactor connection allocationJ. Bruce Fields1-6/+26
Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: use callbacks on svc_xprt_deletionJ. Bruce Fields2-9/+45
Remove connections from the list when they go down. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd: provide callbacks on svc_xprt deletionJ. Bruce Fields2-0/+40
NFSv4.1 needs warning when a client tcp connection goes down, if that connection is being used as a backchannel, so that it can warn the client that it has lost the backchannel connection. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: keep per-session list of connectionsJ. Bruce Fields3-15/+65
The spec requires us in various places to keep track of the connections associated with each session. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: clean up session allocationJ. Bruce Fields1-122/+89
Changes: - make sure session memory reservation is released on failure path. - use min_t()/min() for more compact code in several places. - break alloc_init_session into smaller pieces. - miscellaneous other cleanup. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: fix alloc_init_session return typeJ. Bruce Fields1-3/+1
This returns an nfs error, not -ERRNO. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: fix alloc_init_session BUILD_BUG_ON()J. Bruce Fields1-1/+1
Note we're allocating an array of nfsd4_slot *'s, not nfsd4_slot's. Signed-off-by: J. Bruce Fields <[email protected]>
2010-10-01nfsd4: Move callback setup to callback queueJ. Bruce Fields3-27/+63
Instead of creating the new rpc client from a regular server thread, set a flag, kick off a null call, and allow the null call to do the work of setting up the client on the callback workqueue. Use a spinlock to ensure the callback work gets a consistent view of the callback parameters. This allows, for example, changing the callback from contexts where sleeping is not allowed. I hope it will also keep the locking simple as we add more session and trunking features, by serializing most of the callback-specific work. This also closes a small race where the the new cb_ident could be used with an old connection (or vice-versa). Signed-off-by: J. Bruce Fields <[email protected]>