summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
Commit message (Collapse)AuthorAgeFilesLines
* nfsd: fix error value on allocation failure in nfsd4_decode_test_stateid()Al Viro2012-04-131-1/+1
| | | | | | PTR_ERR(NULL) is going to be 0... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* nfsd: fix endianness breakage in TEST_STATEID handlingAl Viro2012-04-131-1/+1
| | | | | | | | ->ts_id_status gets nfs errno, i.e. it's already big-endian; no need to apply htonl() to it. Broken by commit 174568 (NFSD: Added TEST_STATEID operation) last year... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* NFSD: Fix nfs4_verifier memory alignmentChuck Lever2012-03-201-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | Clean up due to code review. The nfs4_verifier's data field is not guaranteed to be u32-aligned. Casting an array of chars to a u32 * is considered generally hazardous. We can fix most of this by using a __be32 array to generate the verifier's contents and then byte-copying it into the verifier field. However, there is one spot where there is a backwards compatibility constraint: the do_nfsd_create() call expects a verifier which is 32-bit aligned. Fix this spot by forcing the alignment of the create verifier in the nfsd4_open args structure. Also, sizeof(nfs4_verifer) is the size of the in-core verifier data structure, but NFS4_VERIFIER_SIZE is the number of octets in an XDR'd verifier. The two are not interchangeable, even if they happen to have the same value. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd41: implement NFS4_SHARE_WANT_NO_DELEG, NFS4_OPEN_DELEGATE_NONE_EXT, ↵Benny Halevy2012-02-171-0/+14
| | | | | | | | | | | | why_no_deleg Respect client request for not getting a delegation in NFSv4.1 Appropriately return delegation "type" NFS4_OPEN_DELEGATE_NONE_EXT and WND4_NOT_WANTED reason. [nfsd41: add missing break when encoding op_why_no_deleg] Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Clean up the test_stateid functionBryan Schumaker2012-02-171-46/+20
| | | | | | | | | | | When I initially wrote it, I didn't understand how lists worked so I wrote something that didn't use them. I think making a list of stateids to test is a more straightforward implementation, especially compared to especially compared to decoding stateids while simultaneously encoding a reply to the client. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd41: split out share_access want and signal flags while decodingBenny Halevy2012-02-171-4/+15
| | | | | Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: rearrange struct nfsd4_slotJ. Bruce Fields2012-02-141-3/+2
| | | | | | | | | | | | | Combine two booleans into a single flag field, move the smaller fields to the end. (In practice this doesn't make the struct any smaller. But we'll be adding another flag here soon.) Remove some debugging code that doesn't look useful, while we're in the neighborhood. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: Use kmemdup rather than duplicating its implementationThomas Meyer2011-11-251-2/+1
| | | | | | | | The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: typo logical vs bitwise negate in nfsd4_decode_share_accessBenny Halevy2011-11-011-1/+1
| | | | | Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfs41: implement DESTROY_CLIENTID operationMi Jinlong2011-10-241-1/+11
| | | | | | | According to rfc5661 18.50, implement DESTROY_CLIENTID operation. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: typo logical vs bitwise negate for want_maskBenny Halevy2011-10-241-1/+1
| | | | | Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | ↵Benny Halevy2011-10-241-0/+2
| | | | | | | | | | | | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED RFC5661 says: The client may set one or both of OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL and OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED. Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: implement new 4.1 open reclaim typesJ. Bruce Fields2011-10-191-0/+13
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: typo logical vs bitwise negateDan Carpenter2011-10-171-1/+1
| | | | | | | | This should be a bitwise negate here. It silences a Sparse warning: fs/nfsd/nfs4xdr.c:693:16: warning: dubious: x & !y Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move name-length checks to xdrJ. Bruce Fields2011-10-111-15/+30
| | | | | | Again, these checks are better in the xdr code. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move access/deny validity checks to xdr codeJ. Bruce Fields2011-10-111-7/+73
| | | | | | | | I'd rather put more of these sorts of checks into standardized xdr decoders for the various types rather than have them cluttering up the core logic in nfs4proc.c and nfs4state.c. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: look up stateid's per clientidJ. Bruce Fields2011-09-261-1/+2
| | | | | | | | | | | | | | | | Use a separate stateid idr per client, and lookup a stateid by first finding the client, then looking up the stateid relative to that client. Also some minor refactoring. This allows us to improve error returns: we can return expired when the clientid is not found and bad_stateid when the clientid is found but not the stateid, as opposed to returning expired for both cases. I hope this will also help to replace the state lock mostly by a per-client lock, but that hasn't been done yet. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: assume test_stateid always has sessionJ. Bruce Fields2011-09-261-1/+1
| | | | | | | | Test_stateid is 4.1-only and only allowed after a sequence operation, so this check is unnecessary. Cc: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: match close replays on stateid, not open owner idJ. Bruce Fields2011-09-171-0/+1
| | | | | | | | | 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>
* nfsd41: try to check reply size before operationMi Jinlong2011-09-161-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* NFSD: Cleanup for nfsd4_path()Trond Myklebust2011-09-131-28/+78
| | | | | | | | | | | | | | 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: split stateowners into open and lockownersJ. Bruce Fields2011-09-071-1/+1
| | | | | | | | 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: drop most stateowner refcountingJ. Bruce Fields2011-09-011-5/+6
| | | | | | | 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: cleanup seqid op stateowner usageJ. Bruce Fields2011-08-311-5/+0
| | | | | | | | 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-15/+19
| | | | | | | | | | | 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: 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>
* nfsd4: cleanup and consolidate seqid_mutating_errJ. Bruce Fields2011-08-271-13/+1
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: it's OK to return nfserr_symlinkJ. Bruce Fields2011-08-261-4/+0
| | | | | | | | | | | | | | | | | | | | | 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>
* nfsd4: clean up S_IS -> NF4 file type mappingJ. Bruce Fields2011-08-261-7/+14
| | | | | | | A slightly unconventional approach to make the code more compact I could live with, but let's give the poor reader *some* chance. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix seqid_mutating_errorJ. Bruce Fields2011-08-191-0/+12
| | | | | | | | | | | The set of errors here does *not* agree with the set of errors specified in the rfc! While we're there, turn this macros into a function, for the usual reasons, and move it to the one place where it's actually used. Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: turn on reply cache for NFSv4J. Bruce Fields2011-07-181-0/+11
| | | | | | | | | | | | | It's sort of ridiculous that we've never had a working reply cache for NFSv4. On the other hand, we may still not: our current reply cache is likely not very good, especially in the TCP case (which is the only case that matters for v4). What we really need here is some serious testing. Anyway, here's a start. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: call nfsd4_release_compoundargs from pc_releaseJ. Bruce Fields2011-07-181-8/+6
| | | | | | This simplifies cleanup a bit. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: Added TEST_STATEID operationBryan Schumaker2011-07-151-3/+84
| | | | | | | | 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-2/+30
| | | | | | | | 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>
* nfsd: make local functions staticDaniel Mack2011-05-181-1/+1
| | | | | | | | | | 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: Remove unused variable from nfsd4_decode_bind_conn_to_session()Bryan Schumaker2011-04-291-5/+2
| | | | | | | | | | | | | | | Compiling gave me this warning: fs/nfsd/nfs4xdr.c: In function ‘nfsd4_decode_bind_conn_to_session’: fs/nfsd/nfs4xdr.c:427:6: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable] The local variable "dummy" wasn't being used past the READ32() macro that set it. READ_BUF() should ensure that the xdr buffer is pushed past the data read into dummy already, so nothing needs to be read in. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> [bfields@redhat.com: minor comment fixup.] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd v4.1 lOCKT clientid field must be ignoredAndy Adamson2011-04-291-2/+0
| | | | | | | | | | | | RFC 5661 Section 18.11.3 The clientid field of the owner MAY be set to any value by the client and MUST be ignored by the server. The reason the server MUST ignore the clientid field is that the server MUST derive the client ID from the session ID from the SEQUENCE operation of the COMPOUND request. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: wrong index used in inner loopMi Jinlong2011-03-171-4/+1
| | | | | | | | | | We must not use dummy for index. After the first index, READ32(dummy) will change dummy!!!! Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> [bfields@redhat.com: Trond points out READ_BUF alone is sufficient.] Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: wrong index used in inner looproel2011-03-081-2/+2
| | | | | | | | Index i was already used in the outer loop Cc: stable@kernel.org Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: correctly handle return value from nfsd_map_name_to_*NeilBrown2011-02-161-4/+4
| | | | | | | | | | | | | | These functions return an nfs status, not a host_err. So don't try to convert before returning. This is a regression introduced by 3c726023402a2f3b28f49b9d90ebf9e71151157d; I fixed up two of the callers, but missed these two. Cc: stable@kernel.org Reported-by: Herbert Poetzl <herbert@13thfloor.at> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: set sequence flag when backchannel is downJ. Bruce Fields2011-01-111-6/+2
| | | | | | Implement the SEQ4_STATUS_CB_PATH_DOWN flag. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: support BIND_CONN_TO_SESSIONJ. Bruce Fields2011-01-111-2/+32
| | | | | | | 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: return nfs errno from name_to_id functionsJ. Bruce Fields2011-01-041-5/+5
| | | | | | This avoids the need for the confusing ESRCH mapping. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move idmap and acl header files into fs/nfsdJ. Bruce Fields2011-01-041-2/+3
| | | | | | These are internal nfsd interfaces. 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 oops on secinfo_no_name result encodingMi Jinlong2010-12-291-4/+17
| | | | | | | | | | | | | The secinfo_no_name code oopses on encoding with BUG: unable to handle kernel NULL pointer dereference at 00000044 IP: [<e2bd239a>] nfsd4_encode_secinfo+0x1c/0x1c1 [nfsd] We should implement a nfsd4_encode_secinfo_no_name() instead using nfsd4_encode_secinfo(). Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: implement secinfo_no_nameJ. Bruce Fields2010-12-171-2/+13
| | | | | | Implementation of this operation is mandatory for NFSv4.1. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_idMi Jinlong2010-11-191-7/+15
| | | | | | | | | | | | | | | | | | | | | According to RFC, the argument of ssv_sp_parms4 is: struct ssv_sp_parms4 { state_protect_ops4 ssp_ops; sec_oid4 ssp_hash_algs<>; sec_oid4 ssp_encr_algs<>; uint32_t ssp_window; uint32_t ssp_num_gss_handles; }; If client send a exchange_id with SP4_SSV, server cann't decode the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly. Because the kernel treat the two arguments as a signal sec_oid4 struct, but should be a set of sec_oid4 struct. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: adjust buflen for encoded attrs bitmap based on actual bitmap lengthBenny Halevy2010-10-011-6/+12
| | | | | | | | | The existing code adjusted it based on the worst case scenario for the returned bitmap and the best case scenario for the supported attrs attribute. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [bfields@redhat.com: removed likely/unlikely's] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'for-linus' of ↵Linus Torvalds2010-08-101-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (96 commits) no need for list_for_each_entry_safe()/resetting with superblock list Fix sget() race with failing mount vfs: don't hold s_umount over close_bdev_exclusive() call sysv: do not mark superblock dirty on remount sysv: do not mark superblock dirty on mount btrfs: remove junk sb_dirt change BFS: clean up the superblock usage AFFS: wait for sb synchronization when needed AFFS: clean up dirty flag usage cifs: truncate fallout mbcache: fix shrinker function return value mbcache: Remove unused features add f_flags to struct statfs(64) pass a struct path to vfs_statfs update VFS documentation for method changes. All filesystems that need invalidate_inode_buffers() are doing that explicitly convert remaining ->clear_inode() to ->evict_inode() Make ->drop_inode() just return whether inode needs to be dropped fs/inode.c:clear_inode() is gone fs/inode.c:evict() doesn't care about delete vs. non-delete paths now ... Fix up trivial conflicts in fs/nilfs2/super.c
OpenPOWER on IntegriCloud