Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / nfsd / state.h
index b6b2fe1..8bf23cf 100644 (file)
@@ -61,11 +61,6 @@ typedef struct {
 #define si_stateownerid   si_opaque.so_stateownerid
 #define si_fileid         si_opaque.so_fileid
 
-extern stateid_t zerostateid;
-extern stateid_t onestateid;
-
-#define ZERO_STATEID(stateid)       (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
-#define ONE_STATEID(stateid)        (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
 
 struct nfs4_cb_recall {
        u32                     cbr_ident;
@@ -77,8 +72,8 @@ struct nfs4_cb_recall {
 };
 
 struct nfs4_delegation {
-       struct list_head        dl_del_perfile; /* nfs4_file->fi_del_perfile */
-       struct list_head        dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/
+       struct list_head        dl_perfile;
+       struct list_head        dl_perclnt;
        struct list_head        dl_recall_lru;  /* delegation recalled */
        atomic_t                dl_count;       /* ref count */
        struct nfs4_client      *dl_client;
@@ -97,7 +92,6 @@ struct nfs4_delegation {
 /* client delegation callback info */
 struct nfs4_callback {
        /* SETCLIENTID info */
-       u32                     cb_parsed;  /* addr parsed */
        u32                     cb_addr;
        unsigned short          cb_port;
        u32                     cb_prog;
@@ -109,6 +103,8 @@ struct nfs4_callback {
        struct rpc_clnt *       cb_client;
 };
 
+#define HEXDIR_LEN     33 /* hex version of 16 byte md5 of cl_name plus '\0' */
+
 /*
  * struct nfs4_client - one per client.  Clientids live here.
  *     o Each nfs4_client is hashed by clientid.
@@ -122,10 +118,11 @@ struct nfs4_callback {
 struct nfs4_client {
        struct list_head        cl_idhash;      /* hash by cl_clientid.id */
        struct list_head        cl_strhash;     /* hash by cl_name */
-       struct list_head        cl_perclient;   /* list: stateowners */
-       struct list_head        cl_del_perclnt; /* list: delegations */
+       struct list_head        cl_openowners;
+       struct list_head        cl_delegations;
        struct list_head        cl_lru;         /* tail queue */
        struct xdr_netobj       cl_name;        /* id generated by client */
+       char                    cl_recdir[HEXDIR_LEN]; /* recovery dir */
        nfs4_verifier           cl_verifier;    /* generated by client */
        time_t                  cl_time;        /* time of last lease renewal */
        u32                     cl_addr;        /* client ipaddress */
@@ -134,6 +131,7 @@ struct nfs4_client {
        nfs4_verifier           cl_confirm;     /* generated by server */
        struct nfs4_callback    cl_callback;    /* callback info */
        atomic_t                cl_count;       /* ref count */
+       u32                     cl_firststate;  /* recovery dir creation */
 };
 
 /* struct nfs4_client_reset
@@ -143,7 +141,7 @@ struct nfs4_client {
  */
 struct nfs4_client_reclaim {
        struct list_head        cr_strhash;     /* hash by cr_name */
-       struct xdr_netobj       cr_name;        /* id generated by client */
+       char                    cr_recdir[HEXDIR_LEN]; /* recover dir */
 };
 
 static inline void
@@ -197,15 +195,17 @@ struct nfs4_stateowner {
        struct kref             so_ref;
        struct list_head        so_idhash;   /* hash by so_id */
        struct list_head        so_strhash;   /* hash by op_name */
-       struct list_head        so_perclient; /* nfs4_client->cl_perclient */
-       struct list_head        so_perfilestate; /* list: nfs4_stateid */
-       struct list_head        so_perlockowner; /* nfs4_stateid->st_perlockowner */
+       struct list_head        so_perclient;
+       struct list_head        so_stateids;
+       struct list_head        so_perstateid; /* for lockowners only */
        struct list_head        so_close_lru; /* tail queue */
        time_t                  so_time; /* time of placement on so_close_lru */
        int                     so_is_open_owner; /* 1=openowner,0=lockowner */
        u32                     so_id;
        struct nfs4_client *    so_client;
-       u32                     so_seqid;    
+       /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
+        * sequence id expected from the client: */
+       u32                     so_seqid;
        struct xdr_netobj       so_owner;     /* open owner name */
        int                     so_confirmed; /* successful OPEN_CONFIRM? */
        struct nfs4_replay      so_replay;
@@ -217,9 +217,10 @@ struct nfs4_stateowner {
 *      share_acces, share_deny on the file.
 */
 struct nfs4_file {
+       struct kref             fi_ref;
        struct list_head        fi_hash;    /* hash by "struct inode *" */
-       struct list_head        fi_perfile; /* list: nfs4_stateid */
-       struct list_head        fi_del_perfile; /* list: nfs4_delegation */
+       struct list_head        fi_stateids;
+       struct list_head        fi_delegations;
        struct inode            *fi_inode;
        u32                     fi_id;      /* used with stateowner->so_id 
                                             * for stateid_hashtbl hash */
@@ -236,19 +237,24 @@ struct nfs4_file {
 *       st_perlockowner: (open stateid) list of lock nfs4_stateowners
 *      st_access_bmap: used only for open stateid
 *      st_deny_bmap: used only for open stateid
+*      st_openstp: open stateid lock stateid was derived from
+*
+* XXX: open stateids and lock stateids have diverged sufficiently that
+* we should consider defining separate structs for the two cases.
 */
 
 struct nfs4_stateid {
        struct list_head              st_hash; 
        struct list_head              st_perfile;
-       struct list_head              st_perfilestate; 
-       struct list_head              st_perlockowner;
+       struct list_head              st_perstateowner;
+       struct list_head              st_lockowners;
        struct nfs4_stateowner      * st_stateowner;
        struct nfs4_file            * st_file;
        stateid_t                     st_stateid;
        struct file                 * st_vfs_file;
        unsigned long                 st_access_bmap;
        unsigned long                 st_deny_bmap;
+       struct nfs4_stateid         * st_openstp;
 };
 
 /* flags for preprocess_seqid_op() */
@@ -267,12 +273,9 @@ struct nfs4_stateid {
        ((err) != nfserr_stale_stateid) &&      \
        ((err) != nfserr_bad_stateid))
 
-extern time_t nfs4_laundromat(void);
 extern int nfsd4_renew(clientid_t *clid);
 extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 
                stateid_t *stateid, int flags, struct file **filp);
-extern int nfs4_share_conflict(struct svc_fh *current_fh, 
-               unsigned int deny_type);
 extern void nfs4_lock_state(void);
 extern void nfs4_unlock_state(void);
 extern int nfs4_in_grace(void);
@@ -282,6 +285,15 @@ extern void nfs4_free_stateowner(struct kref *kref);
 extern void nfsd4_probe_callback(struct nfs4_client *clp);
 extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
 extern void nfs4_put_delegation(struct nfs4_delegation *dp);
+extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
+extern void nfsd4_init_recdir(char *recdir_name);
+extern int nfsd4_recdir_load(void);
+extern void nfsd4_shutdown_recdir(void);
+extern int nfs4_client_to_reclaim(const char *name);
+extern int nfs4_has_reclaimed_state(const char *name);
+extern void nfsd4_recdir_purge_old(void);
+extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
+extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
 
 static inline void
 nfs4_put_stateowner(struct nfs4_stateowner *so)