upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / include / linux / nfsd / state.h
index a56399b..b6b2fe1 100644 (file)
@@ -67,6 +67,33 @@ 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;
+       int                     cbr_trunc;
+       stateid_t               cbr_stateid;
+       u32                     cbr_fhlen;
+       u32                     cbr_fhval[NFS4_FHSIZE];
+       struct nfs4_delegation  *cbr_dp;
+};
+
+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_recall_lru;  /* delegation recalled */
+       atomic_t                dl_count;       /* ref count */
+       struct nfs4_client      *dl_client;
+       struct nfs4_file        *dl_file;
+       struct file_lock        *dl_flock;
+       struct file             *dl_vfs_file;
+       u32                     dl_type;
+       time_t                  dl_time;
+       struct nfs4_cb_recall   dl_recall;
+};
+
+#define dl_stateid      dl_recall.cbr_stateid
+#define dl_fhlen        dl_recall.cbr_fhlen
+#define dl_fhval        dl_recall.cbr_fhval
+
 /* client delegation callback info */
 struct nfs4_callback {
        /* SETCLIENTID info */
@@ -75,9 +102,8 @@ struct nfs4_callback {
        unsigned short          cb_port;
        u32                     cb_prog;
        u32                     cb_ident;
-       struct xdr_netobj       cb_netid;
        /* RPC client info */
-       u32                     cb_set;     /* successful CB_NULL call */
+       atomic_t                cb_set;     /* successful CB_NULL call */
        struct rpc_program      cb_program;
        struct rpc_stat         cb_stat;
        struct rpc_clnt *       cb_client;
@@ -97,6 +123,7 @@ 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_lru;         /* tail queue */
        struct xdr_netobj       cl_name;        /* id generated by client */
        nfs4_verifier           cl_verifier;    /* generated by client */
@@ -106,7 +133,7 @@ struct nfs4_client {
        clientid_t              cl_clientid;    /* generated by server */
        nfs4_verifier           cl_confirm;     /* generated by server */
        struct nfs4_callback    cl_callback;    /* callback info */
-       time_t                  cl_first_state; /* first state aquisition*/
+       atomic_t                cl_count;       /* ref count */
 };
 
 /* struct nfs4_client_reset
@@ -117,8 +144,6 @@ 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 */
-       time_t                  cr_first_state; /* first state aquisition */
-       u32                     cr_expired;     /* boolean: lease expired? */
 };
 
 static inline void
@@ -194,6 +219,7 @@ struct nfs4_stateowner {
 struct nfs4_file {
        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 inode            *fi_inode;
        u32                     fi_id;      /* used with stateowner->so_id 
                                             * for stateid_hashtbl hash */
@@ -221,7 +247,6 @@ struct nfs4_stateid {
        struct nfs4_file            * st_file;
        stateid_t                     st_stateid;
        struct file                 * st_vfs_file;
-       int                           st_vfs_set;
        unsigned long                 st_access_bmap;
        unsigned long                 st_deny_bmap;
 };
@@ -231,8 +256,10 @@ struct nfs4_stateid {
 #define CONFIRM                 0x00000002
 #define OPEN_STATE              0x00000004
 #define LOCK_STATE              0x00000008
-#define RDWR_STATE              0x00000010
-#define CLOSE_STATE             0x00000020
+#define RD_STATE               0x00000010
+#define WR_STATE               0x00000020
+#define CLOSE_STATE             0x00000040
+#define DELEG_RET               0x00000080
 
 #define seqid_mutating_err(err)                       \
        (((err) != nfserr_stale_clientid) &&    \
@@ -243,14 +270,18 @@ struct nfs4_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 nfs4_stateid **stpp);
+               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);
 extern int nfs4_check_open_reclaim(clientid_t *clid);
+extern void put_nfs4_client(struct nfs4_client *clp);
 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);
 
 static inline void
 nfs4_put_stateowner(struct nfs4_stateowner *so)