aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/state.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r--fs/nfsd/state.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 9d3be371240a..4f3bfeb11766 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -92,6 +92,7 @@ struct nfs4_stid {
92/* For a deleg stateid kept around only to process free_stateid's: */ 92/* For a deleg stateid kept around only to process free_stateid's: */
93#define NFS4_REVOKED_DELEG_STID 16 93#define NFS4_REVOKED_DELEG_STID 16
94#define NFS4_CLOSED_DELEG_STID 32 94#define NFS4_CLOSED_DELEG_STID 32
95#define NFS4_LAYOUT_STID 64
95 unsigned char sc_type; 96 unsigned char sc_type;
96 stateid_t sc_stateid; 97 stateid_t sc_stateid;
97 struct nfs4_client *sc_client; 98 struct nfs4_client *sc_client;
@@ -297,6 +298,9 @@ struct nfs4_client {
297 struct list_head cl_delegations; 298 struct list_head cl_delegations;
298 struct list_head cl_revoked; /* unacknowledged, revoked 4.1 state */ 299 struct list_head cl_revoked; /* unacknowledged, revoked 4.1 state */
299 struct list_head cl_lru; /* tail queue */ 300 struct list_head cl_lru; /* tail queue */
301#ifdef CONFIG_NFSD_PNFS
302 struct list_head cl_lo_states; /* outstanding layout states */
303#endif
300 struct xdr_netobj cl_name; /* id generated by client */ 304 struct xdr_netobj cl_name; /* id generated by client */
301 nfs4_verifier cl_verifier; /* generated by client */ 305 nfs4_verifier cl_verifier; /* generated by client */
302 time_t cl_time; /* time of last lease renewal */ 306 time_t cl_time; /* time of last lease renewal */
@@ -493,9 +497,13 @@ struct nfs4_file {
493 atomic_t fi_access[2]; 497 atomic_t fi_access[2];
494 u32 fi_share_deny; 498 u32 fi_share_deny;
495 struct file *fi_deleg_file; 499 struct file *fi_deleg_file;
496 atomic_t fi_delegees; 500 int fi_delegees;
497 struct knfsd_fh fi_fhandle; 501 struct knfsd_fh fi_fhandle;
498 bool fi_had_conflict; 502 bool fi_had_conflict;
503#ifdef CONFIG_NFSD_PNFS
504 struct list_head fi_lo_states;
505 atomic_t fi_lo_recalls;
506#endif
499}; 507};
500 508
501/* 509/*
@@ -528,6 +536,24 @@ static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s)
528 return container_of(s, struct nfs4_ol_stateid, st_stid); 536 return container_of(s, struct nfs4_ol_stateid, st_stid);
529} 537}
530 538
539struct nfs4_layout_stateid {
540 struct nfs4_stid ls_stid;
541 struct list_head ls_perclnt;
542 struct list_head ls_perfile;
543 spinlock_t ls_lock;
544 struct list_head ls_layouts;
545 u32 ls_layout_type;
546 struct file *ls_file;
547 struct nfsd4_callback ls_recall;
548 stateid_t ls_recall_sid;
549 bool ls_recalled;
550};
551
552static inline struct nfs4_layout_stateid *layoutstateid(struct nfs4_stid *s)
553{
554 return container_of(s, struct nfs4_layout_stateid, ls_stid);
555}
556
531/* flags for preprocess_seqid_op() */ 557/* flags for preprocess_seqid_op() */
532#define RD_STATE 0x00000010 558#define RD_STATE 0x00000010
533#define WR_STATE 0x00000020 559#define WR_STATE 0x00000020
@@ -535,6 +561,7 @@ static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s)
535enum nfsd4_cb_op { 561enum nfsd4_cb_op {
536 NFSPROC4_CLNT_CB_NULL = 0, 562 NFSPROC4_CLNT_CB_NULL = 0,
537 NFSPROC4_CLNT_CB_RECALL, 563 NFSPROC4_CLNT_CB_RECALL,
564 NFSPROC4_CLNT_CB_LAYOUT,
538 NFSPROC4_CLNT_CB_SEQUENCE, 565 NFSPROC4_CLNT_CB_SEQUENCE,
539}; 566};
540 567
@@ -545,6 +572,12 @@ struct nfsd_net;
545extern __be32 nfs4_preprocess_stateid_op(struct net *net, 572extern __be32 nfs4_preprocess_stateid_op(struct net *net,
546 struct nfsd4_compound_state *cstate, 573 struct nfsd4_compound_state *cstate,
547 stateid_t *stateid, int flags, struct file **filp); 574 stateid_t *stateid, int flags, struct file **filp);
575__be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
576 stateid_t *stateid, unsigned char typemask,
577 struct nfs4_stid **s, struct nfsd_net *nn);
578struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl,
579 struct kmem_cache *slab);
580void nfs4_unhash_stid(struct nfs4_stid *s);
548void nfs4_put_stid(struct nfs4_stid *s); 581void nfs4_put_stid(struct nfs4_stid *s);
549void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *); 582void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *);
550extern void nfs4_release_reclaim(struct nfsd_net *); 583extern void nfs4_release_reclaim(struct nfsd_net *);
@@ -567,6 +600,14 @@ extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name,
567 struct nfsd_net *nn); 600 struct nfsd_net *nn);
568extern bool nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn); 601extern bool nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn);
569 602
603struct nfs4_file *find_file(struct knfsd_fh *fh);
604void put_nfs4_file(struct nfs4_file *fi);
605static inline void get_nfs4_file(struct nfs4_file *fi)
606{
607 atomic_inc(&fi->fi_ref);
608}
609struct file *find_any_file(struct nfs4_file *f);
610
570/* grace period management */ 611/* grace period management */
571void nfsd4_end_grace(struct nfsd_net *nn); 612void nfsd4_end_grace(struct nfsd_net *nn);
572 613