summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* nfsd4: setclientid: remove pointless assignmentJ. Bruce Fields2012-05-311-2/+1
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix error return in non-matching-creds caseJ. Bruce Fields2012-05-311-36/+26
| | | | | | | | | | | | Note CLID_INUSE is for the case where two clients are trying to use the same client-provided long-form client identifiers. But what we're looking at here is the server-returned shorthand client id--if those clash there's a bug somewhere. Fix the error return, pull the check out into common code, and do the check unconditionally in all cases. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix setclientid_confirm same_cred checkJ. Bruce Fields2012-05-311-1/+1
| | | | | | | | | | | | | | | | | | | New clients are created only by nfsd4_setclientid(), which always gives any new client a unique clientid. The only exception is in the "callback update" case, in which case it may create an unconfirmed client with the same clientid as a confirmed client. In that case it also checks that the confirmed client has the same credential. Therefore, it is pointless for setclientid_confirm to check whether a confirmed and unconfirmed client with the same clientid have matching credentials--they're guaranteed to. Instead, it should be checking whether the credential on the setclientid_confirm matches either of those. Otherwise, it could be anyone sending the setclientid_confirm. Granted, I can't see why anyone would, but still it's probalby safer to check. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: merge 3 setclientid cases to 2J. Bruce Fields2012-05-311-7/+2
| | | | | | Boy, is this simpler. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: pull out common code from setclientid casesJ. Bruce Fields2012-05-311-21/+5
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: merge last two setclientid casesJ. Bruce Fields2012-05-311-9/+4
| | | | | | The code here is mostly the same. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: setclientid/confirm comment cleanupJ. Bruce Fields2012-05-311-56/+11
| | | | | | Be a little more concise. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: setclientid remove unnecessary terms from a logical expressionJ. Bruce Fields2012-05-311-3/+2
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move rq_flavor into svc_credJ. Bruce Fields2012-05-314-9/+9
| | | | | | | Move the rq_flavor into struct svc_cred, and use it in setclientid and exchange_id comparisons as well. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: stricter cred comparison for setclientid/exchange_idJ. Bruce Fields2012-05-311-1/+21
| | | | | | | | | The typical setclientid or exchange_id will probably be performed with a credential that maps to either root or nobody, so comparing just uid's is unlikely to be useful. So, use everything else we can get our hands on. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: move principal name into svc_credJ. Bruce Fields2012-05-314-21/+21
| | | | | | | | Instead of keeping the principal name associated with a request in a structure that's private to auth_gss and using an accessor function, move it to svc_cred. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: allow removing clients not holding stateJ. Bruce Fields2012-05-311-2/+19
| | | | | | | | RFC 5661 actually says we should allow an exchange_id to remove a matching client, even if the exchange_id comes from a different principal, *if* the victim client lacks any state. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: rearrange exchange_id logic to simplifyJ. Bruce Fields2012-05-311-20/+20
| | | | | | | Minor cleanup: it's simpler to have separate code paths for the update and non-update cases. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: exchange_id cleanup: commentsJ. Bruce Fields2012-05-311-26/+10
| | | | | | Make these comments a bit more concise and uniform. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: exchange_id cleanup: local shorthands for repeated testsJ. Bruce Fields2012-05-311-6/+10
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: allow an EXCHANGE_ID to kill a 4.0 clientJ. Bruce Fields2012-05-311-2/+8
| | | | | | | | | Following rfc 5661 section 2.4.1, we can permit a 4.1 client to remove an established 4.0 client's state. (But we don't allow updates.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: exchange_id: check creds before killing confirmed clientJ. Bruce Fields2012-05-311-9/+8
| | | | | | | | | | | | We mustn't allow a client to destroy another client with established state unless it has the right credential. And some minor cleanup. (Note: our comparison of credentials is actually pretty bogus currently; that will need to be fixed in another patch.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: exchange_id error cleanupJ. Bruce Fields2012-05-311-5/+1
| | | | | | | There's no point to the dprintk here as the main proc_compound loop already does this. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: exchange_id has a pointless copyJ. Bruce Fields2012-05-311-1/+0
| | | | | | We just verified above that these two verifiers are already the same. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: return 0 on reads of fault injection filesWeston Andros Adamson2012-05-311-0/+1
| | | | | | | debugfs read operations were returning the contents of an uninitialized u64. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: wrap all accesses to st_deny_bmapJeff Layton2012-05-311-8/+29
| | | | | | | | Handle the st_deny_bmap in a similar fashion to the st_access_bmap. Add accessor functions and use those instead of bare bitops. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: wrap accesses to st_access_bmapJeff Layton2012-05-311-28/+54
| | | | | | | | | | | | | | | | Currently, we do this for the most part with "bare" bitops, but eventually we'll need to expand the share mode code to handle access and deny modes on other nodes. In order to facilitate that code in the future, move to some generic accessor functions. For now, these are mostly static inlines, but eventually we'll want to move these to "real" functions that are able to handle multi-node configurations or have a way to "swap in" new operations to be done in lieu of or in conjunction with these atomic bitops. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make test_share a bool returnJeff Layton2012-05-311-3/+3
| | | | | | | All of the callers treat the return that way already. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: consolidate set_access and set_denyJeff Layton2012-05-311-17/+7
| | | | | | | | | These functions are identical. Also, rename them to bmap_to_share_mode to better reflect what they do, and have them just return the result instead of passing in a pointer to the storage location. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* NFSD: SETCLIENTID_CONFIRM returns NFS4ERR_CLID_INUSE too oftenChuck Lever2012-05-311-12/+2
| | | | | | | | | | | | | | | According to RFC 3530bis, the only items SETCLIENTID_CONFIRM processing should be concerned with is the clientid, clientid verifier, and principal. The client's IP address is not supposed to be interesting. And, NFS4ERR_CLID_INUSE is meant only for principal mismatches. I triggered this logic with a prototype UCS client -- one that uses the same nfs_client_id4 string for all servers. The client mounted our server via its IPv4, then via its IPv6 address. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: add debug message to start and stop functionsStanislav Kinsbursky2012-05-311-0/+5
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: service start function introducedStanislav Kinsbursky2012-05-311-25/+42
| | | | | | | | | | | This is just a code move, which from my POV makes the code look better. I.e. now on start we have 3 different stages: 1) Service creation. 2) Service per-net data allocation. 3) Service start. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: move global usage counter manipulation from error pathStanislav Kinsbursky2012-05-311-3/+2
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: service creation function introducedStanislav Kinsbursky2012-05-311-11/+27
| | | | | | | | | This function creates service if it doesn't exist, or increases usage counter if it does, and returns a pointer to it. The usage counter will be droppepd by svc_destroy() later in lockd_up(). Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: use existing per-net data function on service creationStanislav Kinsbursky2012-05-311-16/+7
| | | | | | | This patch also replaces svc_rpcb_setup() with svc_bind(). Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* LockD: pass service to per-net up and down functionsStanislav Kinsbursky2012-05-311-7/+5
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* SUNRPC: move per-net operations from svc_destroy()Stanislav Kinsbursky2012-05-314-15/+41
| | | | | | | | | | | | | | | | The idea is to separate service destruction and per-net operations, because these are two different things and the mix looks ugly. Notes: 1) For NFS server this patch looks ugly (sorry for that). But these place will be rewritten soon during NFSd containerization. 2) LockD per-net counter increase int lockd_up() was moved prior to make_socks() to make lockd_down_net() call safe in case of error. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* SUNRPC: new svc_bind() routine introducedStanislav Kinsbursky2012-05-313-0/+23
| | | | | | | | | | | | | | | This new routine is responsible for service registration in a specified network context. The idea is to separate service creation from per-net operations. Note also: since registering service with svc_bind() can fail, the service will be destroyed and during destruction it will try to unregister itself from rpcbind. In this case unregistration has to be skipped. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: add IPv6 addr escaping to fs_location hostsWeston Andros Adamson2012-05-311-7/+33
| | | | | | | | | | | | The fs_location->hosts list is split on colons, but this doesn't work when IPv6 addresses are used (they contain colons). This patch adds the function nfsd4_encode_components_esc() to allow the caller to specify escape characters when splitting on 'sep'. In order to fix referrals, this patch must be used with the mountd patch that similarly fixes IPv6 [] escaping. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix change attribute endiannessJ. Bruce Fields2012-05-311-2/+2
| | | | | | | Though actually this doesn't matter much, as NFSv4.0 clients are required to treat the change attribute as opaque. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix free_stateid return endiannessJ. Bruce Fields2012-05-311-2/+2
| | | | | Cc: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: int/__be32 fixesJ. Bruce Fields2012-05-313-20/+20
| | | | | | | In each of these cases there's a simple unambiguous correct choice, and no actual bug. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: preserve __user annotation on cld downcall msgJ. Bruce Fields2012-05-311-1/+1
| | | | | Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix missing "static"J. Bruce Fields2012-05-314-4/+4
| | | | Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: state.c should include current_stateid.hJ. Bruce Fields2012-05-311-0/+1
| | | | | | OK, admittedly I'm mainly just trying to shut sparse up. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: trivial: use SEEK_SET instead of 0 in vfs_llseekJeff Layton2012-04-251-1/+1
| | | | | | | | They're equivalent, but SEEK_SET is more informative... Cc: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: allocate id-to-name and name-to-id caches in per-net operations.Stanislav Kinsbursky2012-04-121-7/+7
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make name-to-id cache allocated per network namespace contextStanislav Kinsbursky2012-04-122-10/+16
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make id-to-name cache allocated per network namespace contextStanislav Kinsbursky2012-04-122-10/+26
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: pass network context to idmap init/exit functionsStanislav Kinsbursky2012-04-123-14/+14
| | | | | | | These functions will be called from per-net operations. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: allocate export and expkey caches in per-net operations.Stanislav Kinsbursky2012-04-121-6/+21
| | | | | Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make expkey cache allocated per network namespace contextStanislav Kinsbursky2012-04-123-12/+20
| | | | | | | | | This patch also changes svcauth_unix_purge() function: added network namespace as a parameter and thus loop over all networks was replaced by only one call for ip map cache purge. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make export cache allocated per network namespace contextStanislav Kinsbursky2012-04-124-17/+36
| | | | | | | | This patch also changes prototypes of nfsd_export_flush() and exp_rootfh(): network namespace parameter added. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: pass pointer to export cache down to stack wherever possible.Stanislav Kinsbursky2012-04-121-15/+22
| | | | | | | | | This cache will be per-net soon. And it's easier to get the pointer to desired per-net instance only once and then pass it down instead of discovering it in every place were required. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: pass network context to export caches init/shutdown routinesStanislav Kinsbursky2012-04-112-13/+13
| | | | | | | These functions will be called from per-net operations. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>