diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-14 19:16:07 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-14 19:23:17 -0400 |
commit | 4704f0e274829e3af00737d2d9adace2d71a9605 (patch) | |
tree | 048404f927dc210f1d7c695cb39e28e4e7d49030 /include | |
parent | 921615f111108258820226a3258a047d9bf1d96a (diff) |
NFS: Fix the resolution problem with nfs_inode_attrs_need_update()
It appears that 'jiffies' timestamps do not have high enough resolution for
nfs_inode_attrs_need_update(). One problem is that a GETATTR can be
launched within < 1 jiffy of the last operation that updated the attribute.
Another problem is that RPC calls can take < 1 jiffy to execute.
We can fix this by switching the variables to use a simple global counter
that gets incremented every time we start another GETATTR call.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nfs_fs.h | 10 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 1 |
2 files changed, 4 insertions, 7 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ca563ee13e32..ac8d0233b05c 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -137,7 +137,7 @@ struct nfs_inode { | |||
137 | unsigned long attrtimeo_timestamp; | 137 | unsigned long attrtimeo_timestamp; |
138 | __u64 change_attr; /* v4 only */ | 138 | __u64 change_attr; /* v4 only */ |
139 | 139 | ||
140 | unsigned long last_updated; | 140 | unsigned long attr_gencount; |
141 | /* "Generation counter" for the attribute cache. This is | 141 | /* "Generation counter" for the attribute cache. This is |
142 | * bumped whenever we update the metadata on the | 142 | * bumped whenever we update the metadata on the |
143 | * server. | 143 | * server. |
@@ -344,15 +344,11 @@ extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ct | |||
344 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 344 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
345 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 345 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
346 | extern u64 nfs_compat_user_ino64(u64 fileid); | 346 | extern u64 nfs_compat_user_ino64(u64 fileid); |
347 | extern void nfs_fattr_init(struct nfs_fattr *fattr); | ||
347 | 348 | ||
348 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 349 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
349 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | 350 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ |
350 | 351 | extern unsigned long nfs_inc_attr_generation_counter(void); | |
351 | static inline void nfs_fattr_init(struct nfs_fattr *fattr) | ||
352 | { | ||
353 | fattr->valid = 0; | ||
354 | fattr->time_start = jiffies; | ||
355 | } | ||
356 | 352 | ||
357 | /* | 353 | /* |
358 | * linux/fs/nfs/file.c | 354 | * linux/fs/nfs/file.c |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 6ee6ae3f095c..c1c31acb8a2b 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -56,6 +56,7 @@ struct nfs_fattr { | |||
56 | __u64 change_attr; /* NFSv4 change attribute */ | 56 | __u64 change_attr; /* NFSv4 change attribute */ |
57 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ | 57 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ |
58 | unsigned long time_start; | 58 | unsigned long time_start; |
59 | unsigned long gencount; | ||
59 | }; | 60 | }; |
60 | 61 | ||
61 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ | 62 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ |