summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* nfsd4: construct stateid from clientid and counterJ. Bruce Fields2011-09-192-58/+18
| | | | | | | | | Including the full clientid in the on-the-wire stateid allows more reliable detection of bad vs. expired stateid's, simplifies code, and ensures we won't reuse the opaque part of the stateid (as we currently do when the same openowner closes and reopens the same file). Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: simplify free_stateidJ. Bruce Fields2011-09-171-51/+15
| | | | | | We no longer need is_deleg_stateid, for example. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: match close replays on stateid, not open owner idJ. Bruce Fields2011-09-173-7/+44
| | | | | | | | | Keep around an unhashed copy of the final stateid after the last close using an openowner, and when identifying a replay, match against that stateid instead of just against the open owner id. Free it the next time the seqid is bumped or the stateowner is destroyed. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: replace oo_confirmed by flag bitJ. Bruce Fields2011-09-163-15/+16
| | | | | | | I want at least one more bit here. So, let's haul out the caps lock key and add a flags field. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd41: try to check reply size before operationMi Jinlong2011-09-163-37/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | For checking the size of reply before calling a operation, we need try to get maxsize of the operation's reply. v3: using new method as Bruce said, "we could handle operations in two different ways: - For operations that actually change something (write, rename, open, close, ...), do it the way we're doing it now: be very careful to estimate the size of the response before even processing the operation. - For operations that don't change anything (read, getattr, ...) just go ahead and do the operation. If you realize after the fact that the response is too large, then return the error at that point. So we'd add another flag to op_flags: say, OP_MODIFIES_SOMETHING. And for operations with OP_MODIFIES_SOMETHING set, we'd do the first thing. For operations without it set, we'd do the second." Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> [bfields@redhat.com: crash, don't attempt to handle, undefined op_rsize_bop] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* SUNRPC: Replace svc_addr_u by sockaddr_storageMi Jinlong2011-09-142-38/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For IPv6 local address, lockd can not callback to client for missing scope id when binding address at inet6_bind: 324 if (addr_type & IPV6_ADDR_LINKLOCAL) { 325 if (addr_len >= sizeof(struct sockaddr_in6) && 326 addr->sin6_scope_id) { 327 /* Override any existing binding, if another one 328 * is supplied by user. 329 */ 330 sk->sk_bound_dev_if = addr->sin6_scope_id; 331 } 332 333 /* Binding to link-local address requires an interface */ 334 if (!sk->sk_bound_dev_if) { 335 err = -EINVAL; 336 goto out_unlock; 337 } Replacing svc_addr_u by sockaddr_storage, let rqstp->rq_daddr contains more info besides address. Reviewed-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Add a cache for fs_locations informationTrond Myklebust2011-09-132-0/+25
| | | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> [ cel: since this is server-side, use nfsd4_ prefix instead of nfs4_ prefix. ] [ cel: implement S_ISVTX filter in bfields-normal form ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Remove the ex_pathname field from struct svc_exportTrond Myklebust2011-09-131-11/+0
| | | | | | | | There are no more users... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Cleanup for nfsd4_path()Trond Myklebust2011-09-132-30/+80
| | | | | | | | | | | | | | The current code is sort of hackish in that it assumes a referral is always matched to an export. When we add support for junctions that may not be the case. We can replace nfsd4_path() with a function that encodes the components directly from the dentries. Since nfsd4_path is currently the only user of the 'ex_pathname' field in struct svc_export, this has the added benefit of allowing us to get rid of that. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: better stateid hashingJ. Bruce Fields2011-09-131-4/+4
| | | | | | | | First, we shouldn't care here about the structure of the opaque part of the stateid. Second, this hash is really dumb. (I'm not sure the replacement is much better, though--to look at it another patch.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* 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-132-66/+51
| | | | | | | 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-133-20/+22
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move some of nfs4_stateid into a separate structureJ. Bruce Fields2011-09-132-97/+106
| | | | | | | 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-132-12/+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-132-43/+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-075-198/+224
| | | | | | | | 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-032-30/+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-012-5/+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-015-35/+22
| | | | | | | 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-012-6/+11
| | | | | | | | | | | | | | | 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-313-45/+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-312-36/+23
| | | | | | | | | | | 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-312-29/+26
| | | | | | | 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-312-6/+6
| | | | | | | 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 typoed replay fieldJ. Bruce Fields2011-08-311-1/+0
| | | | | | Wow, I wonder how long that typo's been there. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix off-by-one-error in SEQUENCE replyJ. Bruce Fields2011-08-311-3/+3
| | | | | | | | | The values here represent highest slotid numbers. Since slotid's are numbered starting from zero, the highest should be one less than the number of slots. Reported-by: Rick Macklem <rmacklem@uoguelph.ca> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: remove include/linux/nfsd/syscall.hJ. Bruce Fields2011-08-313-3/+0
| | | | | | We don't need this any more. 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: cleanup and consolidate seqid_mutating_errJ. Bruce Fields2011-08-272-37/+1
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: remove HAS_SESSIONJ. Bruce Fields2011-08-273-23/+12
| | | | | | 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-273-9/+9
| | | | | | | | | | 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>
OpenPOWER on IntegriCloud