aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/state.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-12 15:00:55 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-12 18:55:11 -0500
commit0ce0c2b5d23080eec39ccc52354be1eea326ed5f (patch)
tree560db260bfd579a0b78f75eca46fbf67a90ed6ed /fs/nfsd/state.h
parent772a9bbbb5769c646c74452ef21df538bbe2ebf0 (diff)
nfsd: don't search for client by hash on legacy reboot recovery gracedone
When nfsd starts, the legacy reboot recovery code creates a tracking struct for each directory in the v4recoverydir. When the grace period ends, it basically does a "readdir" on the directory again, and matches each dentry in there to an existing client id to see if it should be removed or not. If the matching client doesn't exist, or hasn't reclaimed its state then it will remove that dentry. This is pretty inefficient since it involves doing a lot of hash-bucket searching. It also means that we have to keep relying on being able to search for a nfs4_client by md5 hashed cl_recdir name. Instead, add a pointer to the nfs4_client that indicates the association between the nfs4_client_reclaim and nfs4_client. When a reclaim operation comes in, we set the pointer to make that association. On gracedone, the legacy client tracker will keep the recdir around iff: 1/ there is a reclaim record for the directory ...and... 2/ there's an association between the reclaim record and a client record -- that is, a create or check operation was performed on the client that matches that directory. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r--fs/nfsd/state.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 3f8b26b9b47b..cf9f7ba4df8d 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -304,6 +304,7 @@ is_client_expired(struct nfs4_client *clp)
304 */ 304 */
305struct nfs4_client_reclaim { 305struct nfs4_client_reclaim {
306 struct list_head cr_strhash; /* hash by cr_name */ 306 struct list_head cr_strhash; /* hash by cr_name */
307 struct nfs4_client *cr_clp; /* pointer to associated clp */
307 char cr_recdir[HEXDIR_LEN]; /* recover dir */ 308 char cr_recdir[HEXDIR_LEN]; /* recover dir */
308}; 309};
309 310
@@ -464,7 +465,6 @@ extern __be32 nfs4_preprocess_stateid_op(struct net *net,
464 stateid_t *stateid, int flags, struct file **filp); 465 stateid_t *stateid, int flags, struct file **filp);
465extern void nfs4_lock_state(void); 466extern void nfs4_lock_state(void);
466extern void nfs4_unlock_state(void); 467extern void nfs4_unlock_state(void);
467extern int nfs4_in_grace(void);
468void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *); 468void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *);
469extern void nfs4_release_reclaim(void); 469extern void nfs4_release_reclaim(void);
470extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir); 470extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir);
@@ -483,7 +483,7 @@ extern void nfsd4_shutdown_callback(struct nfs4_client *);
483extern void nfs4_put_delegation(struct nfs4_delegation *dp); 483extern void nfs4_put_delegation(struct nfs4_delegation *dp);
484extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); 484extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
485extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name); 485extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name);
486extern int nfs4_has_reclaimed_state(const char *name); 486extern bool nfs4_has_reclaimed_state(const char *name);
487extern void release_session_client(struct nfsd4_session *); 487extern void release_session_client(struct nfsd4_session *);
488extern void nfsd4_purge_closed_stateid(struct nfs4_stateowner *); 488extern void nfsd4_purge_closed_stateid(struct nfs4_stateowner *);
489 489