summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* nfsd4: acquire only one lease per fileJ. Bruce Fields2011-02-141-40/+55
| | | | | | | | | | | | | | | | | | | | | Instead of acquiring one lease each time another client opens a file, nfsd can acquire just one lease to represent all of them, and reference count it to determine when to release it. This fixes a regression introduced by c45821d263a8a5109d69a9e8942b8d65bcd5f31a "locks: eliminate fl_mylease callback": after that patch, only the struct file * is used to determine who owns a given lease. But since we recently converted the server to share a single struct file per open, if we acquire multiple leases on the same file from nfsd, it then becomes impossible on unlocking a lease to determine which of those leases (all of whom share the same struct file *) we meant to remove. Thanks to Takashi Iwai <tiwai@suse.de> for catching a bug in a previous version of this patch. Tested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: modify fi_delegations under recall_lockJ. Bruce Fields2011-02-141-4/+4
| | | | | | | | | Modify fi_delegations only under the recall_lock, allowing us to use that list on lease breaks. Also some trivial cleanup to simplify later changes. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remove unused deleg dprintk's.J. Bruce Fields2011-02-141-4/+0
| | | | | | These aren't all that useful, and get in the way of the next steps. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split lease setting into separate functionJ. Bruce Fields2011-02-141-13/+19
| | | | | | | Splitting some code into a separate function which we'll be adding some more to. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix leak on allocation errorJ. Bruce Fields2011-02-141-8/+10
| | | | | | Also share some common exit code. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: add helper function for lease setupJ. Bruce Fields2011-02-141-12/+21
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split up nfsd_break_deleg_cbJ. Bruce Fields2011-02-141-18/+16
| | | | | | We'll be adding some more code here soon. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'for-2.6.38' of git://linux-nfs.org/~bfields/linuxLinus Torvalds2011-01-141-98/+145
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-2.6.38' of git://linux-nfs.org/~bfields/linux: (62 commits) nfsd4: fix callback restarting nfsd: break lease on unlink, link, and rename nfsd4: break lease on nfsd setattr nfsd: don't support msnfs export option nfsd4: initialize cb_per_client nfsd4: allow restarting callbacks nfsd4: simplify nfsd4_cb_prepare nfsd4: give out delegations more quickly in 4.1 case nfsd4: add helper function to run callbacks nfsd4: make sure sequence flags are set after destroy_session nfsd4: re-probe callback on connection loss nfsd4: set sequence flag when backchannel is down nfsd4: keep finer-grained callback status rpc: allow xprt_class->setup to return a preexisting xprt rpc: keep backchannel xprt as long as server connection rpc: move sk_bc_xprt to svc_xprt nfsd4: allow backchannel recovery nfsd4: support BIND_CONN_TO_SESSION nfsd4: modify session list under cl_lock Documentation: fl_mylease no longer exists ... Fix up conflicts in fs/nfsd/vfs.c with the vfs-scale work. The vfs-scale work touched some msnfs cases, and this merge removes support for that entirely, so the conflict was trivial to resolve.
| * nfsd4: allow restarting callbacksJ. Bruce Fields2011-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | If we lose the backchannel and then the client repairs the problem, resend any callbacks. We use a new cb_done flag to track whether there is still work to be done for the callback or whether it can be destroyed with the rpc. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: give out delegations more quickly in 4.1 caseJ. Bruce Fields2011-01-111-2/+15
| | | | | | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: make sure sequence flags are set after destroy_sessionJ. Bruce Fields2011-01-111-2/+1
| | | | | | | | | | | | | | If this loses any backchannel, make sure we have a chance to notice that and set the sequence flags. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: re-probe callback on connection lossJ. Bruce Fields2011-01-111-1/+1
| | | | | | | | | | | | This makes sure we set the sequence flag when necessary. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: set sequence flag when backchannel is downJ. Bruce Fields2011-01-111-1/+5
| | | | | | | | | | | | Implement the SEQ4_STATUS_CB_PATH_DOWN flag. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: keep finer-grained callback statusJ. Bruce Fields2011-01-111-4/+4
| | | | | | | | | | | | | | | | | | Distinguish between when the callback channel is known to be down, and when it is not yet confirmed. This will be useful in the 4.1 case. Also, we don't seem to be using the fact that this field is atomic. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
| * nfsd4: allow backchannel recoveryJ. Bruce Fields2011-01-111-6/+10
| | | | | | | | | | | | | | | | | | Now that we have a list of connections to choose from, we can teach the callback code to just pick a suitable connection and use that, instead of insisting on forever using the connection that the first create_session was sent with. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
| * nfsd4: support BIND_CONN_TO_SESSIONJ. Bruce Fields2011-01-111-6/+53
| | | | | | | | | | | | | | Basic xdr and processing for BIND_CONN_TO_SESSION. This adds a connection to the list of connections associated with a session. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: modify session list under cl_lockJ. Bruce Fields2011-01-111-0/+6
| | | | | | | | | | | | We want to traverse this from the callback code. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
| * nfs4: set source address when callback is generatedTakuma Umeya2011-01-051-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | when callback is generated in NFSv4 server, it doesn't set the source address. When an alias IP is utilized on NFSv4 server and suppose the client is accessing via that alias IP (e.g. eth0:0), the client invokes the callback to the IP address that is set on the original device (e.g. eth0). This behavior results in timeout of xprt. The patch sets the IP address that the client should invoke callback to. Signed-off-by: Takuma Umeya <tumeya@redhat.com> [bfields@redhat.com: Simplify gen_callback arguments, use helper function] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * locks: eliminate fl_mylease callbackJ. Bruce Fields2011-01-041-20/+1
| | | | | | | | | | | | | | | | | | | | The nfs server only supports read delegations for now, so we don't care how conflicts are determined. All we care is that unlocks are recognized as matching the leases they are meant to remove. After the last patch, a comparison of struct files will work for that purpose. So we no longer need this callback. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: use a single struct file for delegationsJ. Bruce Fields2011-01-041-5/+5
| | | | | | | | | | | | | | | | | | When we converted to sharing struct filess between nfs4 opens I went too far and also used the same mechanism for delegations. But keeping a reference to the struct file ensures it will outlast the lease, and allows us to remove the lease with the same file as we added it. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: eliminate lease delete callbackJ. Bruce Fields2011-01-041-18/+0
| | | | | | | | | | | | | | nfsd controls the lifetime of the lease, not the lock code, so there's no need for this callback on lease destruction. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: remove some unnecessary dropit handlingJ. Bruce Fields2011-01-041-2/+0
| | | | | | | | | | | | We no longer need a few of these special cases. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: fix mixed 4.0/4.1 handling, 4.1 rebootJ. Bruce Fields2010-12-171-20/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of failing to find client entries which don't match the minorversion, we should be finding them, then either erroring out or expiring them as appropriate. This also fixes a problem which would cause the 4.1 server to fail to recognize clients after a second reboot. Reported-by: Casey Bodley <cbodley@citi.umich.edu> Reviewed-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: replace unintuitive match_clientid_establishmentJ. Bruce Fields2010-12-171-10/+4
| | | | | | | | | | Reviewed-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * Merge commit 'v2.6.37-rc6' into for-2.6.38J. Bruce Fields2010-12-171-4/+4
| |\
| * | NFS4.1: Fix bug server don't reply the right fore_channel to client at ↵Mi Jinlong2010-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_session At the latest kernel(2.6.37-rc1), server just initialize the forechannel at init_forechannel_attrs, but don't reflect it to reply. After initialize the session success, we should copy the forechannel info to nfsd4_create_session struct. Reviewed-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * | NFS4.1: server gets drc mem fail should reply error at create_sessionMi Jinlong2010-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | | When server gets drc mem fail, it should reply error to client. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * | nfsd4: return serverfault on request for ssvJ. Bruce Fields2010-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We're refusing to support a mandatory features of 4.1, so serverfault seems the better error; see e.g.: http://www.ietf.org/mail-archive/web/nfsv4/current/msg07638.html Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * | nfsd: fix NULL dereference in setattr()Dan Carpenter2010-11-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original code would oops if this were called from nfsd4_setattr() because "filpp" is NULL. (Note this case is currently impossible, as long as we only give out read delegations.) Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* | | workqueue: convert cancel_rearming_delayed_work[queue]() users to ↵Tejun Heo2010-12-151-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cancel_delayed_work_sync() cancel_rearming_delayed_work[queue]() has been superceded by cancel_delayed_work_sync() quite some time ago. Convert all the in-kernel users. The conversions are completely equivalent and trivial. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: "David S. Miller" <davem@davemloft.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: netdev@vger.kernel.org Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Cc: Alex Elder <aelder@sgi.com> Cc: xfs-masters@oss.sgi.com Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: netfilter-devel@vger.kernel.org Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: linux-nfs@vger.kernel.org
* | BKL: remove references to lock_kernel from commentsArnd Bergmann2010-11-171-4/+4
|/ | | | | | | | | | | Lock_kernel is gone from the code, so the comments should be updated, too. nfsd now uses lock_flocks instead of lock_kernel to protect against posix file locks. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: J. Bruce Fields <bfields@redhat.com> Cc: linux-nfs@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* nfsd4: fix 4.1 connection registration raceJ. Bruce Fields2010-11-021-4/+12
| | | | | | | | If a connection is closed just after a sequence or create_session is sent over it, we could end up trying to register a callback that will never get called since the xprt is already marked dead. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* locks: let the caller free file_lock on ->setlease failureChristoph Hellwig2010-10-311-0/+1
| | | | | | | | | | | | The caller allocated it, the caller should free it. The only issue so far is that we could change the flp pointer even on an error return if the fl_change callback failed. But we can simply move the flp assignment after the fl_change invocation, as the callers don't care about the flp return value if the setlease call failed. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* nfsd4: initialize delegation pointer to leaseJ. Bruce Fields2010-10-311-17/+2
| | | | | | | | | | | | | | | The NFSv4 server was initializing the dp->dl_flock pointer by the somewhat ridiculous method of a locks_copy_lock callback. Now that setlease uses the passed-in lock instead of doing a copy, dl_flock no longer gets set, resulting in the lock leaking on delegation release, and later possible hangs (among other problems). So, initialize dl_flock and get rid of the callback. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* locks/nfsd: allocate file lock outside of spinlockArnd Bergmann2010-10-271-11/+15
| | | | | | | | | | | As suggested by Christoph Hellwig, this moves allocation of new file locks out of generic_setlease into the callers, nfs4_open_delegation and fcntl_setlease in order to allow GFP_KERNEL allocations when lock_flocks has become a spinlock. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'for-2.6.37' of git://linux-nfs.org/~bfields/linuxLinus Torvalds2010-10-261-182/+311
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-2.6.37' of git://linux-nfs.org/~bfields/linux: (99 commits) svcrpc: svc_tcp_sendto XPT_DEAD check is redundant svcrpc: no need for XPT_DEAD check in svc_xprt_enqueue svcrpc: assume svc_delete_xprt() called only once svcrpc: never clear XPT_BUSY on dead xprt nfsd4: fix connection allocation in sequence() nfsd4: only require krb5 principal for NFSv4.0 callbacks nfsd4: move minorversion to client nfsd4: delay session removal till free_client nfsd4: separate callback change and callback probe nfsd4: callback program number is per-session nfsd4: track backchannel connections nfsd4: confirm only on succesful create_session nfsd4: make backchannel sequence number per-session nfsd4: use client pointer to backchannel session nfsd4: move callback setup into session init code nfsd4: don't cache seq_misordered replies SUNRPC: Properly initialize sock_xprt.srcaddr in all cases SUNRPC: Use conventional switch statement when reclassifying sockets sunrpc/xprtrdma: clean up workqueue usage sunrpc: Turn list_for_each-s into the ..._entry-s ... Fix up trivial conflicts (two different deprecation notices added in separate branches) in Documentation/feature-removal-schedule.txt
| * nfsd4: fix connection allocation in sequence()J. Bruce Fields2010-10-251-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 <bfields@redhat.com>
| * nfsd4: move minorversion to clientJ. Bruce Fields2010-10-211-2/+10
| | | | | | | | | | | | | | | | | | | | 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 <bfields@redhat.com>
| * nfsd4: delay session removal till free_clientJ. Bruce Fields2010-10-211-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 <bfields@redhat.com>
| * nfsd4: separate callback change and callback probeJ. Bruce Fields2010-10-211-3/+4
| | | | | | | | | | | | | | Only one of the nfsd4_callback_probe callers actually cares about changing the callback information. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: callback program number is per-sessionJ. Bruce Fields2010-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | 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 <bfields@redhat.com>
| * nfsd4: track backchannel connectionsJ. Bruce Fields2010-10-211-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 <bfields@citi.umich.edu>
| * nfsd4: confirm only on succesful create_sessionJ. Bruce Fields2010-10-211-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 <bfields@redhat.com>
| * nfsd4: make backchannel sequence number per-sessionJ. Bruce Fields2010-10-211-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <bfields@citi.umich.edu>
| * nfsd4: use client pointer to backchannel sessionJ. Bruce Fields2010-10-211-3/+1
| | | | | | | | | | | | | | 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 <bfields@citi.umich.edu>
| * nfsd4: move callback setup into session init codeJ. Bruce Fields2010-10-211-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <bfields@citi.umich.edu>
| * nfsd4: don't cache seq_misordered repliesJ. Bruce Fields2010-10-211-2/+1
| | | | | | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: return expired on unfound stateid'sJ. Bruce Fields2010-10-031-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 <biannm@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: add new connections to sessionJ. Bruce Fields2010-10-021-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 <bfields@redhat.com>
| * nfsd4: refactor connection allocationJ. Bruce Fields2010-10-021-6/+26
| | | | | | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>