Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320387
b: refs/heads/master
c: 7df302f
h: refs/heads/master
i:
  320385: 37598d0
  320383: c042d87
v: v3
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Jun 20, 2012
1 parent 3497bb6 commit 0510528
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2411967305dbfb8930b9b9c11f55f6c1ef7361e1
refs/heads/master: 7df302f75ee28a6a87436e93b625ef60d37d098e
22 changes: 16 additions & 6 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <linux/namei.h>
#include <linux/swap.h>
#include <linux/pagemap.h>
#include <linux/ratelimit.h>
#include <linux/sunrpc/svcauth_gss.h>
#include <linux/sunrpc/clnt.h>
#include "xdr4.h"
Expand Down Expand Up @@ -3338,18 +3339,26 @@ static __be32 check_stateid_generation(stateid_t *in, stateid_t *ref, bool has_s
return nfserr_old_stateid;
}

__be32 nfs4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
{
struct nfs4_stid *s;
struct nfs4_ol_stateid *ols;
__be32 status;

if (STALE_STATEID(stateid))
return nfserr_stale_stateid;

if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
return nfserr_bad_stateid;
/* Client debugging aid. */
if (!same_clid(&stateid->si_opaque.so_clid, &cl->cl_clientid)) {
char addr_str[INET6_ADDRSTRLEN];
rpc_ntop((struct sockaddr *)&cl->cl_addr, addr_str,
sizeof(addr_str));
pr_warn_ratelimited("NFSD: client %s testing state ID "
"with incorrect client ID\n", addr_str);
return nfserr_bad_stateid;
}
s = find_stateid(cl, stateid);
if (!s)
return nfserr_stale_stateid;
return nfserr_bad_stateid;
status = check_stateid_generation(stateid, &s->sc_stateid, 1);
if (status)
return status;
Expand Down Expand Up @@ -3468,7 +3477,8 @@ nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,

nfs4_lock_state();
list_for_each_entry(stateid, &test_stateid->ts_stateid_list, ts_id_list)
stateid->ts_id_status = nfs4_validate_stateid(cl, &stateid->ts_id_stateid);
stateid->ts_id_status =
nfsd4_validate_stateid(cl, &stateid->ts_id_stateid);
nfs4_unlock_state();

return nfs_ok;
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/nfsd/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
extern int nfs4_client_to_reclaim(const char *name);
extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id);
extern void release_session_client(struct nfsd4_session *);
extern __be32 nfs4_validate_stateid(struct nfs4_client *, stateid_t *);
extern void nfsd4_purge_closed_stateid(struct nfs4_stateowner *);

/* nfs4recover operations */
Expand Down

0 comments on commit 0510528

Please sign in to comment.