diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 9a6047ff1b25..325fe7ae49bb 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -41,6 +41,10 @@ | |||
41 | #define NFS_MAX_FILE_IO_BUFFER_SIZE 32768 | 41 | #define NFS_MAX_FILE_IO_BUFFER_SIZE 32768 |
42 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 | 42 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 |
43 | 43 | ||
44 | /* Default timeout values */ | ||
45 | #define NFS_MAX_UDP_TIMEOUT (60*HZ) | ||
46 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) | ||
47 | |||
44 | /* | 48 | /* |
45 | * superblock magic number for NFS | 49 | * superblock magic number for NFS |
46 | */ | 50 | */ |
@@ -137,6 +141,7 @@ struct nfs_inode { | |||
137 | unsigned long attrtimeo_timestamp; | 141 | unsigned long attrtimeo_timestamp; |
138 | __u64 change_attr; /* v4 only */ | 142 | __u64 change_attr; /* v4 only */ |
139 | 143 | ||
144 | unsigned long last_updated; | ||
140 | /* "Generation counter" for the attribute cache. This is | 145 | /* "Generation counter" for the attribute cache. This is |
141 | * bumped whenever we update the metadata on the | 146 | * bumped whenever we update the metadata on the |
142 | * server. | 147 | * server. |
@@ -236,13 +241,17 @@ static inline int nfs_caches_unstable(struct inode *inode) | |||
236 | return atomic_read(&NFS_I(inode)->data_updates) != 0; | 241 | return atomic_read(&NFS_I(inode)->data_updates) != 0; |
237 | } | 242 | } |
238 | 243 | ||
244 | static inline void nfs_mark_for_revalidate(struct inode *inode) | ||
245 | { | ||
246 | spin_lock(&inode->i_lock); | ||
247 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | ||
248 | spin_unlock(&inode->i_lock); | ||
249 | } | ||
250 | |||
239 | static inline void NFS_CACHEINV(struct inode *inode) | 251 | static inline void NFS_CACHEINV(struct inode *inode) |
240 | { | 252 | { |
241 | if (!nfs_caches_unstable(inode)) { | 253 | if (!nfs_caches_unstable(inode)) |
242 | spin_lock(&inode->i_lock); | 254 | nfs_mark_for_revalidate(inode); |
243 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | ||
244 | spin_unlock(&inode->i_lock); | ||
245 | } | ||
246 | } | 255 | } |
247 | 256 | ||
248 | static inline int nfs_server_capable(struct inode *inode, int cap) | 257 | static inline int nfs_server_capable(struct inode *inode, int cap) |
@@ -276,7 +285,7 @@ static inline long nfs_save_change_attribute(struct inode *inode) | |||
276 | static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) | 285 | static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) |
277 | { | 286 | { |
278 | return !nfs_caches_unstable(inode) | 287 | return !nfs_caches_unstable(inode) |
279 | && chattr == NFS_I(inode)->cache_change_attribute; | 288 | && time_after_eq(chattr, NFS_I(inode)->cache_change_attribute); |
280 | } | 289 | } |
281 | 290 | ||
282 | /* | 291 | /* |
@@ -286,6 +295,7 @@ extern void nfs_zap_caches(struct inode *); | |||
286 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, | 295 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
287 | struct nfs_fattr *); | 296 | struct nfs_fattr *); |
288 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); | 297 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); |
298 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); | ||
289 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 299 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
290 | extern int nfs_permission(struct inode *, int, struct nameidata *); | 300 | extern int nfs_permission(struct inode *, int, struct nameidata *); |
291 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); | 301 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); |
@@ -312,6 +322,12 @@ extern void nfs_file_clear_open_context(struct file *filp); | |||
312 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 322 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
313 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ | 323 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ |
314 | 324 | ||
325 | static inline void nfs_fattr_init(struct nfs_fattr *fattr) | ||
326 | { | ||
327 | fattr->valid = 0; | ||
328 | fattr->time_start = jiffies; | ||
329 | } | ||
330 | |||
315 | /* | 331 | /* |
316 | * linux/fs/nfs/file.c | 332 | * linux/fs/nfs/file.c |
317 | */ | 333 | */ |