diff options
Diffstat (limited to 'fs/nfs/nfs4_fs.h')
-rw-r--r-- | fs/nfs/nfs4_fs.h | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index ec1a22d7b876..6ac6708484f5 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -93,6 +93,35 @@ struct nfs4_client { | |||
93 | }; | 93 | }; |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * struct rpc_sequence ensures that RPC calls are sent in the exact | ||
97 | * order that they appear on the list. | ||
98 | */ | ||
99 | struct rpc_sequence { | ||
100 | struct rpc_wait_queue wait; /* RPC call delay queue */ | ||
101 | spinlock_t lock; /* Protects the list */ | ||
102 | struct list_head list; /* Defines sequence of RPC calls */ | ||
103 | }; | ||
104 | |||
105 | #define NFS_SEQID_CONFIRMED 1 | ||
106 | struct nfs_seqid_counter { | ||
107 | struct rpc_sequence *sequence; | ||
108 | int flags; | ||
109 | u32 counter; | ||
110 | }; | ||
111 | |||
112 | struct nfs_seqid { | ||
113 | struct list_head list; | ||
114 | struct nfs_seqid_counter *sequence; | ||
115 | struct rpc_task *task; | ||
116 | }; | ||
117 | |||
118 | static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status) | ||
119 | { | ||
120 | if (seqid_mutating_err(-status)) | ||
121 | seqid->flags |= NFS_SEQID_CONFIRMED; | ||
122 | } | ||
123 | |||
124 | /* | ||
96 | * NFS4 state_owners and lock_owners are simply labels for ordered | 125 | * NFS4 state_owners and lock_owners are simply labels for ordered |
97 | * sequences of RPC calls. Their sole purpose is to provide once-only | 126 | * sequences of RPC calls. Their sole purpose is to provide once-only |
98 | * semantics by allowing the server to identify replayed requests. | 127 | * semantics by allowing the server to identify replayed requests. |
@@ -106,12 +135,13 @@ struct nfs4_state_owner { | |||
106 | struct nfs4_client *so_client; | 135 | struct nfs4_client *so_client; |
107 | u32 so_id; /* 32-bit identifier, unique */ | 136 | u32 so_id; /* 32-bit identifier, unique */ |
108 | struct semaphore so_sema; | 137 | struct semaphore so_sema; |
109 | u32 so_seqid; /* protected by so_sema */ | ||
110 | atomic_t so_count; | 138 | atomic_t so_count; |
111 | 139 | ||
112 | struct rpc_cred *so_cred; /* Associated cred */ | 140 | struct rpc_cred *so_cred; /* Associated cred */ |
113 | struct list_head so_states; | 141 | struct list_head so_states; |
114 | struct list_head so_delegations; | 142 | struct list_head so_delegations; |
143 | struct nfs_seqid_counter so_seqid; | ||
144 | struct rpc_sequence so_sequence; | ||
115 | }; | 145 | }; |
116 | 146 | ||
117 | /* | 147 | /* |
@@ -132,7 +162,7 @@ struct nfs4_lock_state { | |||
132 | fl_owner_t ls_owner; /* POSIX lock owner */ | 162 | fl_owner_t ls_owner; /* POSIX lock owner */ |
133 | #define NFS_LOCK_INITIALIZED 1 | 163 | #define NFS_LOCK_INITIALIZED 1 |
134 | int ls_flags; | 164 | int ls_flags; |
135 | u32 ls_seqid; | 165 | struct nfs_seqid_counter ls_seqid; |
136 | u32 ls_id; | 166 | u32 ls_id; |
137 | nfs4_stateid ls_stateid; | 167 | nfs4_stateid ls_stateid; |
138 | atomic_t ls_count; | 168 | atomic_t ls_count; |
@@ -224,12 +254,16 @@ extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state | |||
224 | extern void nfs4_put_open_state(struct nfs4_state *); | 254 | extern void nfs4_put_open_state(struct nfs4_state *); |
225 | extern void nfs4_close_state(struct nfs4_state *, mode_t); | 255 | extern void nfs4_close_state(struct nfs4_state *, mode_t); |
226 | extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode); | 256 | extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode); |
227 | extern void nfs4_increment_seqid(int status, struct nfs4_state_owner *sp); | ||
228 | extern void nfs4_schedule_state_recovery(struct nfs4_client *); | 257 | extern void nfs4_schedule_state_recovery(struct nfs4_client *); |
229 | extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); | 258 | extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); |
230 | extern void nfs4_increment_lock_seqid(int status, struct nfs4_lock_state *ls); | ||
231 | extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); | 259 | extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); |
232 | 260 | ||
261 | extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter); | ||
262 | extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task); | ||
263 | extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); | ||
264 | extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); | ||
265 | extern void nfs_free_seqid(struct nfs_seqid *seqid); | ||
266 | |||
233 | extern const nfs4_stateid zero_stateid; | 267 | extern const nfs4_stateid zero_stateid; |
234 | 268 | ||
235 | /* nfs4xdr.c */ | 269 | /* nfs4xdr.c */ |