summaryrefslogtreecommitdiffstats
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 55c36e267b7..12244cee168 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -37,6 +37,7 @@
#include <linux/slab.h>
#include <linux/namei.h>
#include <linux/swap.h>
+#include <linux/pagemap.h>
#include <linux/sunrpc/svcauth_gss.h>
#include <linux/sunrpc/clnt.h>
#include "xdr4.h"
@@ -3145,6 +3146,32 @@ static int is_open_stateid(struct nfs4_stateid *stateid)
return stateid->st_openstp == NULL;
}
+__be32 nfs4_validate_stateid(stateid_t *stateid, int flags)
+{
+ struct nfs4_stateid *stp = NULL;
+ __be32 status = nfserr_stale_stateid;
+
+ if (STALE_STATEID(stateid))
+ goto out;
+
+ status = nfserr_expired;
+ stp = search_for_stateid(stateid);
+ if (!stp)
+ goto out;
+ status = nfserr_bad_stateid;
+
+ if (!stp->st_stateowner->so_confirmed)
+ goto out;
+
+ status = check_stateid_generation(stateid, &stp->st_stateid, flags);
+ if (status)
+ goto out;
+
+ status = nfs_ok;
+out:
+ return status;
+}
+
/*
* Checks for stateid operations
*/
@@ -3243,6 +3270,17 @@ nfsd4_free_lock_stateid(struct nfs4_stateid *stp)
}
/*
+ * Test if the stateid is valid
+ */
+__be32
+nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+ struct nfsd4_test_stateid *test_stateid)
+{
+ test_stateid->ts_has_session = nfsd4_has_session(cstate);
+ return nfs_ok;
+}
+
+/*
* Free a state id
*/
__be32