aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-07-13 10:50:48 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-07-15 18:58:48 -0400
commit17456804546b78a1c13d2b934c8f50bbde141a38 (patch)
treed9585ae98e98101830068c9ab29556795a162942 /fs/nfsd/nfs4state.c
parente1ca12dfb1be7fe8b82ca723a9b511f7d808bf81 (diff)
NFSD: Added TEST_STATEID operation
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>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 55c36e267b7d..12244cee1680 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -37,6 +37,7 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/namei.h> 38#include <linux/namei.h>
39#include <linux/swap.h> 39#include <linux/swap.h>
40#include <linux/pagemap.h>
40#include <linux/sunrpc/svcauth_gss.h> 41#include <linux/sunrpc/svcauth_gss.h>
41#include <linux/sunrpc/clnt.h> 42#include <linux/sunrpc/clnt.h>
42#include "xdr4.h" 43#include "xdr4.h"
@@ -3145,6 +3146,32 @@ static int is_open_stateid(struct nfs4_stateid *stateid)
3145 return stateid->st_openstp == NULL; 3146 return stateid->st_openstp == NULL;
3146} 3147}
3147 3148
3149__be32 nfs4_validate_stateid(stateid_t *stateid, int flags)
3150{
3151 struct nfs4_stateid *stp = NULL;
3152 __be32 status = nfserr_stale_stateid;
3153
3154 if (STALE_STATEID(stateid))
3155 goto out;
3156
3157 status = nfserr_expired;
3158 stp = search_for_stateid(stateid);
3159 if (!stp)
3160 goto out;
3161 status = nfserr_bad_stateid;
3162
3163 if (!stp->st_stateowner->so_confirmed)
3164 goto out;
3165
3166 status = check_stateid_generation(stateid, &stp->st_stateid, flags);
3167 if (status)
3168 goto out;
3169
3170 status = nfs_ok;
3171out:
3172 return status;
3173}
3174
3148/* 3175/*
3149* Checks for stateid operations 3176* Checks for stateid operations
3150*/ 3177*/
@@ -3243,6 +3270,17 @@ nfsd4_free_lock_stateid(struct nfs4_stateid *stp)
3243} 3270}
3244 3271
3245/* 3272/*
3273 * Test if the stateid is valid
3274 */
3275__be32
3276nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3277 struct nfsd4_test_stateid *test_stateid)
3278{
3279 test_stateid->ts_has_session = nfsd4_has_session(cstate);
3280 return nfs_ok;
3281}
3282
3283/*
3246 * Free a state id 3284 * Free a state id
3247 */ 3285 */
3248__be32 3286__be32