nfsd: Convert nfs4_check_open_reclaim() to work with lookup_clientid()

lookup_clientid is preferable to find_confirmed_client since it's able
to use the cached client in the compound state.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Trond Myklebust 2014-06-30 11:48:47 -04:00 committed by J. Bruce Fields
parent 2d91e8953c
commit 0fe492db60
3 changed files with 13 additions and 8 deletions

View file

@ -431,8 +431,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
break; break;
case NFS4_OPEN_CLAIM_PREVIOUS: case NFS4_OPEN_CLAIM_PREVIOUS:
status = nfs4_check_open_reclaim(&open->op_clientid, status = nfs4_check_open_reclaim(&open->op_clientid,
cstate->minorversion, cstate, nn);
nn);
if (status) if (status)
goto out; goto out;
open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;

View file

@ -4969,16 +4969,21 @@ nfsd4_find_reclaim_client(const char *recdir, struct nfsd_net *nn)
* Called from OPEN. Look for clientid in reclaim list. * Called from OPEN. Look for clientid in reclaim list.
*/ */
__be32 __be32
nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn) nfs4_check_open_reclaim(clientid_t *clid,
struct nfsd4_compound_state *cstate,
struct nfsd_net *nn)
{ {
struct nfs4_client *clp; __be32 status;
/* find clientid in conf_id_hashtbl */ /* find clientid in conf_id_hashtbl */
clp = find_confirmed_client(clid, sessions, nn); status = lookup_clientid(clid, cstate, nn);
if (clp == NULL) if (status)
return nfserr_reclaim_bad; return nfserr_reclaim_bad;
return nfsd4_client_record_check(clp) ? nfserr_reclaim_bad : nfs_ok; if (nfsd4_client_record_check(cstate->clp))
return nfserr_reclaim_bad;
return nfs_ok;
} }
#ifdef CONFIG_NFSD_FAULT_INJECTION #ifdef CONFIG_NFSD_FAULT_INJECTION

View file

@ -457,7 +457,8 @@ void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *)
extern void nfs4_release_reclaim(struct nfsd_net *); extern void nfs4_release_reclaim(struct nfsd_net *);
extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir, extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
struct nfsd_net *nn); struct nfsd_net *nn);
extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn); extern __be32 nfs4_check_open_reclaim(clientid_t *clid,
struct nfsd4_compound_state *cstate, struct nfsd_net *nn);
extern int set_callback_cred(void); extern int set_callback_cred(void);
extern void nfsd4_init_callback(struct nfsd4_callback *); extern void nfsd4_init_callback(struct nfsd4_callback *);
extern void nfsd4_probe_callback(struct nfs4_client *clp); extern void nfsd4_probe_callback(struct nfs4_client *clp);