@@ -92,7 +92,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
int len;
char *unc, *ipaddr = NULL;
time64_t expiry, now;
- unsigned long ttl = SMB_DNS_RESOLVE_INTERVAL_DEFAULT;
+ unsigned long ttl = dns_interval;
if (!server->hostname ||
server->hostname[0] == '\0')
@@ -130,7 +130,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
* To make sure we don't use the cached entry, retry 1s
* after expiry.
*/
- ttl = max_t(unsigned long, expiry - now, SMB_DNS_RESOLVE_INTERVAL_MIN) + 1;
+ ttl = max_t(unsigned long, expiry - now, dns_interval) + 1;
}
rc = !rc ? -1 : 0;
@@ -67,6 +67,14 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr, time64_t *expiry)
/* Perform the upcall */
rc = dns_query(current->nsproxy->net_ns, NULL, hostname, len,
NULL, ip_addr, expiry, false);
+
+ /*
+ * If the upcall didn't get a TTL, we use the value from dns_interval
+ * procfs setting
+ */
+ if (expiry && *expiry == 0)
+ *expiry = dns_interval;
+
if (rc < 0)
cifs_dbg(FYI, "%s: unable to resolve: %*.*s\n",
__func__, len, len, hostname);
This patch makes use of the dns_interval introduced in the previous commit when re/scheduling the resolve worker. Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> --- fs/cifs/connect.c | 4 ++-- fs/cifs/dns_resolve.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)