diff options
Diffstat (limited to 'fs/nfs/nfs4_fs.h')
-rw-r--r-- | fs/nfs/nfs4_fs.h | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index ec1a22d7b876..78a53f5a9f18 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -93,25 +93,50 @@ 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 nfs_seqid_counter *sequence; | ||
114 | struct list_head list; | ||
115 | }; | ||
116 | |||
117 | static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status) | ||
118 | { | ||
119 | if (seqid_mutating_err(-status)) | ||
120 | seqid->flags |= NFS_SEQID_CONFIRMED; | ||
121 | } | ||
122 | |||
123 | /* | ||
96 | * NFS4 state_owners and lock_owners are simply labels for ordered | 124 | * NFS4 state_owners and lock_owners are simply labels for ordered |
97 | * sequences of RPC calls. Their sole purpose is to provide once-only | 125 | * sequences of RPC calls. Their sole purpose is to provide once-only |
98 | * semantics by allowing the server to identify replayed requests. | 126 | * semantics by allowing the server to identify replayed requests. |
99 | * | ||
100 | * The ->so_sema is held during all state_owner seqid-mutating operations: | ||
101 | * OPEN, OPEN_DOWNGRADE, and CLOSE. Its purpose is to properly serialize | ||
102 | * so_seqid. | ||
103 | */ | 127 | */ |
104 | struct nfs4_state_owner { | 128 | struct nfs4_state_owner { |
129 | spinlock_t so_lock; | ||
105 | struct list_head so_list; /* per-clientid list of state_owners */ | 130 | struct list_head so_list; /* per-clientid list of state_owners */ |
106 | struct nfs4_client *so_client; | 131 | struct nfs4_client *so_client; |
107 | u32 so_id; /* 32-bit identifier, unique */ | 132 | u32 so_id; /* 32-bit identifier, unique */ |
108 | struct semaphore so_sema; | ||
109 | u32 so_seqid; /* protected by so_sema */ | ||
110 | atomic_t so_count; | 133 | atomic_t so_count; |
111 | 134 | ||
112 | struct rpc_cred *so_cred; /* Associated cred */ | 135 | struct rpc_cred *so_cred; /* Associated cred */ |
113 | struct list_head so_states; | 136 | struct list_head so_states; |
114 | struct list_head so_delegations; | 137 | struct list_head so_delegations; |
138 | struct nfs_seqid_counter so_seqid; | ||
139 | struct rpc_sequence so_sequence; | ||
115 | }; | 140 | }; |
116 | 141 | ||
117 | /* | 142 | /* |
@@ -132,7 +157,7 @@ struct nfs4_lock_state { | |||
132 | fl_owner_t ls_owner; /* POSIX lock owner */ | 157 | fl_owner_t ls_owner; /* POSIX lock owner */ |
133 | #define NFS_LOCK_INITIALIZED 1 | 158 | #define NFS_LOCK_INITIALIZED 1 |
134 | int ls_flags; | 159 | int ls_flags; |
135 | u32 ls_seqid; | 160 | struct nfs_seqid_counter ls_seqid; |
136 | u32 ls_id; | 161 | u32 ls_id; |
137 | nfs4_stateid ls_stateid; | 162 | nfs4_stateid ls_stateid; |
138 | atomic_t ls_count; | 163 | atomic_t ls_count; |
@@ -153,7 +178,6 @@ struct nfs4_state { | |||
153 | struct inode *inode; /* Pointer to the inode */ | 178 | struct inode *inode; /* Pointer to the inode */ |
154 | 179 | ||
155 | unsigned long flags; /* Do we hold any locks? */ | 180 | unsigned long flags; /* Do we hold any locks? */ |
156 | struct semaphore lock_sema; /* Serializes file locking operations */ | ||
157 | spinlock_t state_lock; /* Protects the lock_states list */ | 181 | spinlock_t state_lock; /* Protects the lock_states list */ |
158 | 182 | ||
159 | nfs4_stateid stateid; | 183 | nfs4_stateid stateid; |
@@ -191,8 +215,8 @@ extern int nfs4_proc_setclientid_confirm(struct nfs4_client *); | |||
191 | extern int nfs4_proc_async_renew(struct nfs4_client *); | 215 | extern int nfs4_proc_async_renew(struct nfs4_client *); |
192 | extern int nfs4_proc_renew(struct nfs4_client *); | 216 | extern int nfs4_proc_renew(struct nfs4_client *); |
193 | extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); | 217 | extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); |
194 | extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); | 218 | extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); |
195 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int); | 219 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); |
196 | 220 | ||
197 | extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops; | 221 | extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops; |
198 | extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops; | 222 | extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops; |
@@ -224,12 +248,17 @@ extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state | |||
224 | extern void nfs4_put_open_state(struct nfs4_state *); | 248 | extern void nfs4_put_open_state(struct nfs4_state *); |
225 | extern void nfs4_close_state(struct nfs4_state *, mode_t); | 249 | 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); | 250 | 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 *); | 251 | extern void nfs4_schedule_state_recovery(struct nfs4_client *); |
252 | extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); | ||
229 | extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); | 253 | 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); | 254 | extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); |
232 | 255 | ||
256 | extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter); | ||
257 | extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task); | ||
258 | extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); | ||
259 | extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); | ||
260 | extern void nfs_free_seqid(struct nfs_seqid *seqid); | ||
261 | |||
233 | extern const nfs4_stateid zero_stateid; | 262 | extern const nfs4_stateid zero_stateid; |
234 | 263 | ||
235 | /* nfs4xdr.c */ | 264 | /* nfs4xdr.c */ |