diff options
author | NeilBrown <neilb@suse.de> | 2012-10-30 21:16:01 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-31 16:25:59 -0400 |
commit | 8d96b10639fb402357b75b055b1e82a65ff95050 (patch) | |
tree | 13e1e4d63538e1f0177b64fee0b8ab7e96786089 /fs | |
parent | 2b1bc308f492589f7d49012ed24561534ea2be8c (diff) |
NFS: fix bug in legacy DNS resolver.
The DNS resolver's use of the sunrpc cache involves a 'ttl' number
(relative) rather that a timeout (absolute). This confused me when
I wrote
commit c5b29f885afe890f953f7f23424045cdad31d3e4
"sunrpc: use seconds since boot in expiry cache"
and I managed to break it. The effect is that any TTL is interpreted
as 0, and nothing useful gets into the cache.
This patch removes the use of get_expiry() - which really expects an
expiry time - and uses get_uint() instead, treating the int correctly
as a ttl.
This fixes a regression that has been present since 2.6.37, causing
certain NFS accesses in certain environments to incorrectly fail.
Reported-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dns_resolve.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index 31c26c4dcc23..ca4b11ec87a2 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
217 | { | 217 | { |
218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; | 218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; |
219 | struct nfs_dns_ent key, *item; | 219 | struct nfs_dns_ent key, *item; |
220 | unsigned long ttl; | 220 | unsigned int ttl; |
221 | ssize_t len; | 221 | ssize_t len; |
222 | int ret = -EINVAL; | 222 | int ret = -EINVAL; |
223 | 223 | ||
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
240 | key.namelen = len; | 240 | key.namelen = len; |
241 | memset(&key.h, 0, sizeof(key.h)); | 241 | memset(&key.h, 0, sizeof(key.h)); |
242 | 242 | ||
243 | ttl = get_expiry(&buf); | 243 | if (get_uint(&buf, &ttl) < 0) |
244 | goto out; | ||
244 | if (ttl == 0) | 245 | if (ttl == 0) |
245 | goto out; | 246 | goto out; |
246 | key.h.expiry_time = ttl + seconds_since_boot(); | 247 | key.h.expiry_time = ttl + seconds_since_boot(); |