aboutsummaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* nfsd4: use common rpc_cred for all callbacksJ. Bruce Fields2009-09-152-28/+11
| | | | | | | | Callbacks are always made using the machine's identity, so we can use a single auth_generic credential shared among callbacks to all clients and let the rpc code take care of the rest. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd4: allow nfs4 state startup to failJ. Bruce Fields2009-09-152-6/+15
| | | | | | The failure here is pretty unlikely, but we should handle it anyway. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd4: fix null dereference creating nfsv4 callback clientJ. Bruce Fields2009-09-151-2/+2
| | | | | | | | | | | | | | | On setting up the callback to the client, we attempt to use the same authentication flavor the client did. We find an rpc cred to use by calling rpcauth_lookup_credcache(), which assumes that the given authentication flavor has a credentials cache. However, this is not required to be true--in particular, auth_null does not use one. Instead, we should call the auth's lookup_cred() method. Without this, a client attempting to mount using nfsv4 and auth_null triggers a null dereference. Cc: stable@kernel.org Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definitionBenny Halevy2009-09-131-1/+1
| | | | | Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: fix leak on error in nfsv3 readdirJ. Bruce Fields2009-09-041-2/+3
| | | | | | Note the !dchild->d_inode case can leak the filehandle. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: clean up readdirplus encodingJ. Bruce Fields2009-09-041-38/+34
| | | | | | | | | | Make the return from compose_entry_fh() zero or an error, even though the returned error isn't used, just to make the meaning of the return immediately obvious. Move some repeated code out of main function into helper. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd4: filehandle leak or error exit from fh_compose()J. Bruce Fields2009-09-041-1/+3
| | | | | | | | | A number of callers (nfsd4_encode_fattr(), at least) don't bother to release the filehandle returned to fh_compose() if fh_compose() returns an error. So, modify fh_compose() to release the filehandle before returning an error. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* NFSd: Fix filehandle leak in exp_pseudoroot() and nfsd4_path()Trond Myklebust2009-09-032-5/+12
| | | | | | | | | | | | | | nfsd4_path() allocates a temporary filehandle and then fails to free it before the function exits, leaking reference counts to the dentry and export that it refers to. Also, nfsd4_lookupp() puts the result of exp_pseudoroot() in a temporary filehandle which it releases on success of exp_pseudoroot() but not on failure; fix exp_pseudoroot to ensure that on failure it releases the filehandle before returning. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: move fsid_type choice out of fh_composeJ. Bruce Fields2009-09-021-36/+41
| | | | | | More trivial cleanup. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: move some of fh_compose into helper functionsJ. Bruce Fields2009-09-021-38/+45
| | | | Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: replace page based DRC with buffer based DRCAndy Adamson2009-09-013-165/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use NFSD_SLOT_CACHE_SIZE size buffers for sessions DRC instead of holding nfsd pages in cache. Connectathon testing has shown that 1024 bytes for encoded compound operation responses past the sequence operation is sufficient, 512 bytes is a little too small. Set NFSD_SLOT_CACHE_SIZE to 1024. Allocate memory for the session DRC in the CREATE_SESSION operation to guarantee that the memory resource is available for caching responses. Allocate each slot individually in preparation for slot table size negotiation. Remove struct nfsd4_cache_entry and helper functions for the old page-based DRC. The iov_len calculation in nfs4svc_encode_compoundres is now always correct. Replay is now done in nfsd4_sequence under the state lock, so the session ref count is only bumped on non-replay. Clean up the nfs4svc_encode_compoundres session logic. The nfsd4_compound_state statp pointer is also not used. Remove nfsd4_set_statp(). Move useful nfsd4_cache_entry fields into nfsd4_slot. Signed-off-by: Andy Adamson <andros@netapp.com Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: replace nfserr_resource in pure nfs41 responsesAndy Adamson2009-09-011-3/+3
| | | | | | | | | | | nfserr_resource is not a legal error for NFSv4.1. Replace it with nfserr_serverfault for EXCHANGE_ID and CREATE_SESSION processing. We will also need to map nfserr_resource to other errors in routines shared by NFSv4.0 and NFSv4.1 Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: use session maxreqs for sequence target and highest slotidAndy Adamson2009-09-011-1/+5
| | | | | | | | | | | | This fixes a bug in the sequence operation reply. The sequence operation returns the highest slotid it will accept in the future in sr_highest_slotid, and the highest slotid it prefers the client to use. Since we do not re-negotiate the session slot table yet, these should both always be set to the session ca_maxrequests. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: bound forechannel drc size by memory usageAndy Adamson2009-09-011-18/+48
| | | | | | | | | | | | By using the requested ca_maxresponsesize_cached * ca_maxresponses to bound a forechannel drc request size, clients can tailor a session to usage. For example, an I/O session (READ/WRITE only) can have a much smaller ca_maxresponsesize_cached (for only WRITE compound responses) and a lot larger ca_maxresponses to service a large in-flight data window. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* NFSD: Fix a bug in the NFSv4 'supported attrs' mandatory attributeTrond Myklebust2009-09-012-13/+1
| | | | | | | | | The fact that the filesystem doesn't currently list any alternate locations does _not_ imply that the fs_locations attribute should be marked as "unsupported". Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: expand solo sequence checkAndy Adamson2009-08-281-9/+0
| | | | | | | | | | | | | | | Compounds consisting of only a sequence operation don't need any additional caching beyond the sequence information we store in the slot entry. Fix nfsd4_is_solo_sequence to identify this case correctly. The additional check for a failed sequence in nfsd4_store_cache_entry() is redundant, since the nfsd4_is_solo_sequence call lower down catches this case. The final ce_cachethis set in nfsd4_sequence is also redundant. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd4: remove ACE4_IDENTIFIER_GROUP flag from GROUP@ entryFrank Filz2009-08-271-1/+1
| | | | | | | | | | | | RFC 3530 says "ACE4_IDENTIFIER_GROUP flag MUST be ignored on entries with these special identifiers. When encoding entries with these special identifiers, the ACE4_IDENTIFIER_GROUP flag SHOULD be set to zero." It really shouldn't matter either way, but the point is that this flag is used to distinguish named users from named groups (since unix allows a group to have the same name as a user), so it doesn't really make sense to use it on a special identifier such as this.) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd41: renew_client must be called under the state lockBenny Halevy2009-08-271-5/+8
| | | | | | | | | | | | Until we work out the state locking so we can use a spin lock to protect the cl_lru, we need to take the state_lock to renew the client. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: Do not renew state on error] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: Simplify exit code] Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* knfsd: Replace lock_kernel with a mutex in nfsd pool stats.Ryusei Yamaguchi2009-08-252-3/+23
| | | | | | | | | | | | | | | | | | lock_kernel() in knfsd was replaced with a mutex. The later commit 03cf6c9f49a8fea953d38648d016e3f46e814991 ("knfsd: add file to export stats about nfsd pools") did not follow that change. This patch fixes the issue. Also move the get and put of nfsd_serv to the open and close methods (instead of start and stop methods) to allow atomic check and increment of reference count in the open method (where we can still return an error). Signed-off-by: Ryusei Yamaguchi <mandel59@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Cc: Greg Banks <gnb@fmeh.org> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: Fix unnecessary deny bits in NFSv4 ACLFrank Filz2009-08-241-1/+1
| | | | | | | | | | | | | | The group deny entries end up denying tcy even though tcy was just allowed by the allow entry. This appears to be due to: ace->access_mask = mask_from_posix(deny, flags); instead of: ace->access_mask = deny_mask_from_posix(deny, flags); Denying a previously allowed bit has no effect, so this shouldn't affect behavior, but it's ugly. Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: populate sin6_scope_id on callback address with scopeid from rq_addr ↵Jeff Layton2009-08-211-2/+5
| | | | | | | | | | | | | | | | | on SETCLIENTID call When a SETCLIENTID call comes in, one of the args given is the svc_rqst. This struct contains an rq_addr field which holds the address that sent the call. If this is an IPv6 address, then we can use the sin6_scope_id field in this address to populate the sin6_scope_id field in the callback address. AFAICT, the rq_addr.sin6_scope_id is non-zero if and only if the client mounted the server's link-local address. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: add support for NFSv4 callbacks over IPv6Jeff Layton2009-08-211-4/+11
| | | | | | | | | The framework to add this is all in place. Now, add the code to allow support for establishing a callback channel on an IPv6 socket. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: convert nfs4_cb_conn struct to hold address in sockaddr_storageJeff Layton2009-08-212-81/+11
| | | | | | | | | | | ...rather than as a separate address and port fields. This will be necessary for implementing callbacks over IPv6. Also, convert gen_callback to use the standard rpcuaddr2sockaddr routine rather than its own private one. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* nfsd: make nfs4_client->cl_addr a struct sockaddr_storageJeff Layton2009-08-211-13/+19
| | | | | | | | It's currently a __be32, which isn't big enough to hold an IPv6 address. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* sunrpc: add routine for comparing addressesJeff Layton2009-08-214-5/+5
| | | | | | | | | | | lockd needs these sort of routines, as does the NFSv4 callback code. Move lockd's routines into common code and rename them so that they can be used by others. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* Merge branch 'nfs-for-2.6.32' of ↵J. Bruce Fields2009-08-21232-3895/+6761
|\ | | | | | | | | | | | | git://git.linux-nfs.org/projects/trondmy/nfs-2.6 into for-2.6.32-incoming Conflicts: net/sunrpc/cache.c
| * nfs: Remove reference to generic_osync_inode from a commentJan Kara2009-08-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | generic_file_direct_write() no longer calls generic_osync_inode() so remove the comment. CC: linux-nfs@vger.kernel.org CC: Neil Brown <neilb@suse.de> CC: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| * NFS: Use the DNS resolver in the mount code.Trond Myklebust2009-08-191-1/+17
| | | | | | | | | | | | | | In the referral code, use it to look up the new server's ip address if the fs_locations attribute contains a hostname. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| * NFS: Add a dns resolver for use with NFSv4 referrals and migrationTrond Myklebust2009-08-196-1/+526
| | | | | | | | | | | | | | | | | | | | | | | | | | The NFSv4 and NFSv4.1 protocols both allow for the redirection of a client from one server to another in order to support filesystem migration and replication. For full protocol support, we need to add the ability to convert a DNS host name into an IP address that we can feed to the RPC client. We'll reuse the sunrpc cache, now that it has been converted to work with rpc_pipefs. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| * Merge branch 'nfsv4_xdr_cleanups-for-2.6.32' into nfs-for-2.6.32Trond Myklebust2009-08-1933-751/+1236
| |\ | | | | | | | | | | | | Conflicts: fs/nfs/nfs4xdr.c
| | * nfs: nfs4xdr: optimize low level decodingBenny Halevy2009-08-141-59/+59
| | | | | | | | | | | | | | | | | | | | | do not increment decoding ptr if not needed. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of READ_BUFBenny Halevy2009-08-141-96/+379
| | | | | | | | | | | | | | | | | | | | | | | | Use xdr_inline_decode instead. Open code debug printout and error return. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: simplify decode_exchange_id by reusing decode_opaque_inlineBenny Halevy2009-08-141-9/+10
| | | | | | | | | | | | | | | Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of COPYMEMBenny Halevy2009-08-141-8/+3
| | | | | | | | | | | | | | | | | | | | | Just directly call memcpy. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: introduce decode_sessionid helperBenny Halevy2009-08-141-10/+15
| | | | | | | | | | | | | | | Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: introduce decode_verifier helperBenny Halevy2009-08-141-10/+12
| | | | | | | | | | | | | | | | | | Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Trond: Fixed up an 'uninitialised variable' issue in decode_readdir] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: introduce decode_opaque_fixed and decode_stateid helpersBenny Halevy2009-08-141-31/+40
| | | | | | | | | | | | | | | Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: introduce print_overflow_msgBenny Halevy2009-08-141-4/+8
| | | | | | | | | | | | | | | | | | | | | Part fo the nfs4xdr cleanup. READ_BUF will go away. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of READTIMEBenny Halevy2009-08-141-5/+0
| | | | | | | | | | | | | | | | | | | | | It has no users. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of READ64Benny Halevy2009-08-141-29/+25
| | | | | | | | | | | | | | | | | | | | | | | | s/READ64\(\*(.*)\)/p = xdr_decode_hyper(p, \1)/ s/READ64\((.*)\)/p = xdr_decode_hyper(p, &\1)/ Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of READ32Benny Halevy2009-08-141-73/+72
| | | | | | | | | | | | | | | | | | | | | s/READ32\((.*)\)/\1 = be32_to_cpup(p++)/ Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: merge xdr_encode_int+xdr_encode_opaque_fixed into ↵Benny Halevy2009-08-141-28/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | xdr_encode_opaque use encode_string where appropriate. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: optimize low level encodingBenny Halevy2009-08-141-64/+64
| | | | | | | | | | | | | | | | | | | | | do not increment encoding ptr if not needed. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: change RESERVE_SPACE macro into a static helperBenny Halevy2009-08-141-73/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to open code and expose the result pointer assignment. Alternatively, we can open code the call to xdr_reserve_space and do the BUG_ON an the error case at the call site. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: encode_compound_hdr does not have to round up reserved bytesBenny Halevy2009-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is already done by xdr_reserve_space and since encode_compound_hdr is adding a byte count to "12" which is already word aligned, the xdr level rounding will work just as well. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: optimize RESERVE_SPACE in encode_create_session and ↵Benny Halevy2009-08-141-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | encode_sequence Coalesce multilpe constant RESERVE_SPACEs into one Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of WRITEMEMBenny Halevy2009-08-141-36/+32
| | | | | | | | | | | | | | | | | | | | | s/WRITEMEM(/p = xdr_encode_opaque_fixed(p, / Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of WRITE64Benny Halevy2009-08-141-24/+20
| | | | | | | | | | | | | | | | | | | | | s/WRITE64/p = xdr_encode_hyper(p, / Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * nfs: nfs4xdr: get rid of WRITE32Benny Halevy2009-08-141-146/+145
| | | | | | | | | | | | | | | | | | | | | s/WRITE32/*p++ = cpu_to_be32/ Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| | * Merge branch 'upstream-linus' of ↵Linus Torvalds2009-08-1316-135/+357
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2 * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (22 commits) ocfs2: Fix possible deadlock when extending quota file ocfs2: keep index within status_map[] ocfs2: Initialize the cluster we're writing to in a non-sparse extend ocfs2: Remove redundant BUG_ON in __dlm_queue_ast() ocfs2/quota: Release lock for error in ocfs2_quota_write. ocfs2: Define credit counts for quota operations ocfs2: Remove syncjiff field from quota info ocfs2: Fix initialization of blockcheck stats ocfs2: Zero out padding of on disk dquot structure ocfs2: Initialize blocks allocated to local quota file ocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq() ocfs2: Make global quota files blocksize aligned ocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records. ocfs2: Fix deadlock on umount ocfs2: Add extra credits and access the modified bh in update_edge_lengths. ocfs2: Fail ocfs2_get_block() immediately when a block needs allocation ocfs2: Fix error return in ocfs2_write_cluster() ocfs2: Fix compilation warning for fs/ocfs2/xattr.c ocfs2: Initialize count in aio_write before generic_write_checks ocfs2: log the actual return value of ocfs2_file_aio_write() ...