summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
Commit message (Collapse)AuthorAgeFilesLines
...
* nfsd4: use deleg changes to cleanup preprocess_stateid_opJ. Bruce Fields2011-09-131-14/+10
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix test_stateid for delegation stateid'sJ. Bruce Fields2011-09-131-18/+16
| | | | | | Test_stateid should handle delegation stateid's as well. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: hash deleg stateid's like any otherJ. Bruce Fields2011-09-131-66/+46
| | | | | | | It's simpler to look up delegation stateid's in the same hash table as any other stateid. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: share common stid-hashing helper functionJ. Bruce Fields2011-09-131-4/+11
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: add common dl_stid field to delegationJ. Bruce Fields2011-09-131-10/+10
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move some of nfs4_stateid into a separate structureJ. Bruce Fields2011-09-131-87/+87
| | | | | | | We want delegations to share more with open/lock stateid's, so first we'll pull out some of the common stuff we want to share. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remove redundant stateid initializationJ. Bruce Fields2011-09-131-7/+0
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: rename init_stateidJ. Bruce Fields2011-09-131-2/+2
| | | | | | Note this is actually open-stateid specific. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: pass around typemask instead of flagsJ. Bruce Fields2011-09-131-10/+8
| | | | | | | We're only using those flags to choose lock or open stateid's at this point. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split preprocess_seqid, cleanupJ. Bruce Fields2011-09-131-42/+45
| | | | | | | Move most of this into helper functions. Also move the non-CONFIRM case into caller, providing a helper function for that purpose. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split up find_stateidJ. Bruce Fields2011-09-131-13/+21
| | | | | | Minor cleanup. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: rearrange to avoid a forward referenceJ. Bruce Fields2011-09-131-27/+26
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split out some free_generic_stateid codeJ. Bruce Fields2011-09-071-1/+8
| | | | | | We'll use this elsewhere. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: split stateowners into open and lockownersJ. Bruce Fields2011-09-071-181/+186
| | | | | | | | The stateowner has some fields that only make sense for openowners, and some that only make sense for lockowners, and I find it a lot clearer if those are separated out. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move CLOSE_STATE special case to callerJ. Bruce Fields2011-09-031-29/+27
| | | | | | | Move the CLOSE_STATE case into the unique caller that cares about it rather than putting it in preprocess_seqid_op. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move double-confirm test to open_confirmJ. Bruce Fields2011-09-031-7/+5
| | | | | | | I don't see the point of having this check in nfs4_preprocess_seqid_op() when it's only needed by the one caller. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify check_open logicJ. Bruce Fields2011-09-021-5/+2
| | | | | | | Sometimes the single-exit style is good, sometimes it's unnecessarily convoluted.... Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: share common seqid checksJ. Bruce Fields2011-09-021-20/+21
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: eliminate unused lt_stateownerJ. Bruce Fields2011-09-011-4/+4
| | | | | | This is used only as a local variable. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: drop most stateowner refcountingJ. Bruce Fields2011-09-011-11/+12
| | | | | | | Maybe we'll bring it back some day, but we don't have much real use for it now. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: eliminate impossible open replay caseJ. Bruce Fields2011-09-011-12/+2
| | | | | | | | | If open fails with any error other than nfserr_replay_me, then the main nfsd4_proc_compound() loop continues unconditionally to nfsd4_encode_operation(), which will always call encode_seqid_op_tail. Thus the condition we check for here does not occur. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: extend state lock over seqid replay logicJ. Bruce Fields2011-09-011-4/+8
| | | | | | | | | | | | | | | There are currently a couple races in the seqid replay code: a retransmission could come while we're still encoding the original reply, or a new seqid-mutating call could come as we're encoding a replay. So, extend the state lock over the encoding (both encoding of a replayed reply and caching of the original encoded reply). I really hate doing this, and previously added the stateowner reference-counting code to avoid it (which was insufficient)--but I don't see a less complicated alternative at the moment. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: cleanup seqid op stateowner usageJ. Bruce Fields2011-08-311-33/+24
| | | | | | | | Now that the replay owner is in the cstate we can remove it from a lot of other individual operations and further simplify nfs4_preprocess_seqid_op(). Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: centralize handling of replay ownersJ. Bruce Fields2011-08-311-21/+4
| | | | | | | | | | | Set the stateowner associated with a replay in one spot in nfs4_preprocess_seqid_op() and keep it in cstate. This allows removing a few lines of boilerplate from all the nfs4_preprocess_seqid_op() callers. Also turn ENCODE_SEQID_OP_TAIL into a function while we're here. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: make delegation stateid's seqid start at 1J. Bruce Fields2011-08-311-4/+4
| | | | | | | | | | | | | | | Thanks to Casey for reminding me that 5661 gives a special meaning to a value of 0 in the stateid's seqid field, so all stateid's should start out with si_generation 1. We were doing that in the open and lock cases for minorversion 1, but not for the delegation stateid, and not for openstateid's with v4.0. It doesn't *really* matter much for v4.0 or for delegation stateid's (which never get the seqid field incremented), but we may as well do the same for all of them. Reported-by: Casey Bodley <cbodley@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify stateid generation code, fix wraparoundJ. Bruce Fields2011-08-311-29/+23
| | | | | | | Follow the recommendation from rfc3530bis for stateid generation number wraparound, simplify some code, and fix or remove incorrect comments. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: consolidate lock & open stateid tablesJ. Bruce Fields2011-08-311-48/+15
| | | | | | | There's no reason to have two separate hash tables for open and lock stateid's. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify distinguishing lock & open stateid'sJ. Bruce Fields2011-08-311-6/+3
| | | | | | | The trick free_stateid is using is a little cheesy, and we'll have more uses for this field later. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remove redundant is_open_owner checkJ. Bruce Fields2011-08-271-2/+0
| | | | | | | When called with OPEN_STATE, preprocess_seqid_op only returns an open stateid, hence only an open owner. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: get lock checks out of preprocess_seqid_opJ. Bruce Fields2011-08-271-29/+20
| | | | | | | We've got some lock-specific code here in nfs4_preprocess_seqid_op which is only used by nfsd4_lock(). Move it to the caller. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify lock openmode checkJ. Bruce Fields2011-08-271-10/+5
| | | | | | | | | Note that the special handling for the lock stateid case is already done by nfs4_check_openmode() (as of 02921914170e3b7fea1cd82dac9713685d2de5e2 "nfsd4: fix openmode checking on IO using lock stateid") so we no longer need these two cases in the caller. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remove HAS_SESSIONJ. Bruce Fields2011-08-271-20/+10
| | | | | | This flag doesn't really buy us anything. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: cleanup lock/stateowner initializationJ. Bruce Fields2011-08-271-48/+52
| | | | | | | Share some common code, stop doing silly things like initializing a list head immediately before adding it to a list, etc. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: name openowner data structures more clearlyJ. Bruce Fields2011-08-271-18/+18
| | | | | | | These appear to be generic (for both open and lock owners), but they're actually just for open owners. This has confused me more than once. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: replace some macros by functionsJ. Bruce Fields2011-08-271-15/+38
| | | | | | For all the usual reasons. (Type safety, readability.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: stop using nfserr_resource for transitory errorsJ. Bruce Fields2011-08-271-7/+7
| | | | | | | | | | The server is returning nfserr_resource for both permanent errors and for errors (like allocation failures) that might be resolved by retrying later. Save nfserr_resource for the former and use delay/jukebox for the latter. Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify recovery dir settingJ. Bruce Fields2011-08-271-40/+1
| | | | | | | Move around some of this code, simplify a bit. Reviewed-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: it's OK to return nfserr_symlinkJ. Bruce Fields2011-08-261-5/+1
| | | | | | | | | | | | | | | | | | | | | The nfsd4 code has a bunch of special exceptions for error returns which map nfserr_symlink to other errors. In fact, the spec makes it clear that nfserr_symlink is to be preferred over less specific errors where possible. The patch that introduced it back in 2.6.4 is "kNFSd: correct symlink related error returns.", which claims that these special exceptions are represent an NFSv4 break from v2/v3 tradition--when in fact the symlink error was introduced with v4. I suspect what happened was pynfs tests were written that were overly faithful to the (known-incomplete) rfc3530 error return lists, and then code was fixed up mindlessly to make the tests pass. Delete these unnecessary exceptions. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: don't break lease on CLAIM_DELEGATE_CURCasey Bodley2011-07-231-6/+12
| | | | | | | | | | | | | | CLAIM_DELEGATE_CUR is used in response to a broken lease; allowing it to break the lease and return EAGAIN leaves the client unable to make progress in returning the delegation nfs4_get_vfs_file() now takes struct nfsd4_open for access to the claim type, and calls nfsd_open() with NFSD_MAY_NOT_BREAK_LEASE when claim type is CLAIM_DELEGATE_CUR Signed-off-by: Casey Bodley <cbodley@citi.umich.edu> Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* locks: rename lock-manager opsJ. Bruce Fields2011-07-201-2/+2
| | | | | | | | | | | Both the filesystem and the lock manager can associate operations with a lock. Confusingly, one of them (fl_release_private) actually has the same name in both operation structures. It would save some confusion to give the lock-manager ops different names. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd41: check the size of requestMi Jinlong2011-07-151-0/+12
| | | | | | | | Check in SEQUENCE that the request doesn't exceed maxreq_sz for the given session. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd41: error out when client sets maxreq_sz or maxresp_sz too smallMi Jinlong2011-07-151-0/+27
| | | | | | | | | | | | | | | According to RFC5661, 18.36.3, "if the client selects a value for ca_maxresponsesize such that a replier on a channel could never send a response,the server SHOULD return NFS4ERR_TOOSMALL in the CREATE_SESSION reply." So, error out when the client sets a maxreq_sz less than the minimum possible SEQUENCE request size, or sets a maxresp_sz less than the minimum possible SEQUENCE reply size. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix file leak on open_downgradeJ. Bruce Fields2011-07-151-23/+8
| | | | | | | | | | | | | | | | | | | | Stateid's hold a read reference for a read open, a write reference for a write open, and an additional one of each for each read+write open. The latter wasn't getting put on a downgrade, so something like: open RW open R downgrade to R was resulting in a file leak. Also fix an imbalance in an error path. Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix downgrade/lock logic". Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remember to put RW access on stateid destructionJ. Bruce Fields2011-07-151-11/+6
| | | | | | | | | | | | | | | | Without this, for example, open read open read+write close will result in a struct file leak. Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix downgrade/lock logic". Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Added TEST_STATEID operationBryan Schumaker2011-07-151-0/+38
| | | | | | | | This operation is used by the client to check the validity of a list of stateids. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: added FREE_STATEID operationBryan Schumaker2011-07-151-0/+118
| | | | | | | | This operation is used by the client to tell the server to free a stateid. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'for-2.6.40' of git://linux-nfs.org/~bfields/linuxLinus Torvalds2011-05-291-9/+33
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-2.6.40' of git://linux-nfs.org/~bfields/linux: (22 commits) nfsd: make local functions static NFSD: Remove unused variable from nfsd4_decode_bind_conn_to_session() NFSD: Check status from nfsd4_map_bcts_dir() NFSD: Remove setting unused variable in nfsd_vfs_read() nfsd41: error out on repeated RECLAIM_COMPLETE nfsd41: compare request's opcnt with session's maxops at nfsd4_sequence nfsd v4.1 lOCKT clientid field must be ignored nfsd41: add flag checking for create_session nfsd41: make sure nfs server process OPEN with EXCLUSIVE4_1 correctly nfsd4: fix wrongsec handling for PUTFH + op cases nfsd4: make fh_verify responsibility of nfsd_lookup_dentry caller nfsd4: introduce OPDESC helper nfsd4: allow fh_verify caller to skip pseudoflavor checks nfsd: distinguish functions of NFSD_MAY_* flags svcrpc: complete svsk processing on cb receive failure svcrpc: take advantage of tcp autotuning SUNRPC: Don't wait for full record to receive tcp data svcrpc: copy cb reply instead of pages svcrpc: close connection if client sends short packet svcrpc: note network-order types in svc_process_calldir ...
| * nfsd: make local functions staticDaniel Mack2011-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | This also fixes a number of sparse warnings. Signed-off-by: Daniel Mack <zonque@gmail.com> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: Check status from nfsd4_map_bcts_dir()Bryan Schumaker2011-04-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Compiling gave me this warning: fs/nfsd/nfs4state.c: In function ‘nfsd4_bind_conn_to_session’: fs/nfsd/nfs4state.c:1623:9: warning: variable ‘status’ set but not used [-Wunused-but-set-variable] The local variable "status" was being set by nfsd4_map_bcts_dir() and then ignored before calling nfsd4_new_conn(). Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd41: error out on repeated RECLAIM_COMPLETEMi Jinlong2011-04-291-5/+14
| | | | | | | | | | | | | | | | Servers are supposed to return nfserr_complete_already to clients that attempt to send multiple RECLAIM_COMPLETEs. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
OpenPOWER on IntegriCloud