Skip to content

Commit 4ac0536

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: set a minimum of 120s for next dns resolution
With commit 506c1da ("cifs: use the expiry output of dns_query to schedule next resolution") and after triggering the first reconnect, the next async dns resolution of tcp server's hostname would be scheduled based on dns_resolver's key expiry default, which happens to default to 5s on most systems that use key.dns_resolver for upcall. As per key.dns_resolver.conf(5): default_ttl=<number> The number of seconds to set as the expiration on a cached record. This will be overridden if the program manages to re- trieve TTL information along with the addresses (if, for exam- ple, it accesses the DNS directly). The default is 5 seconds. The value must be in the range 1 to INT_MAX. Make the next async dns resolution no shorter than 120s as we do not want to be upcalling too often. Cc: [email protected] Fixes: 506c1da ("cifs: use the expiry output of dns_query to schedule next resolution") Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent bbcce36 commit 4ac0536

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fs/cifs/cifsglob.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
#define SMB_ECHO_INTERVAL_MAX 600
7777
#define SMB_ECHO_INTERVAL_DEFAULT 60
7878

79-
/* dns resolution interval in seconds */
79+
/* dns resolution intervals in seconds */
80+
#define SMB_DNS_RESOLVE_INTERVAL_MIN 120
8081
#define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600
8182

8283
/* maximum number of PDUs in one compound */

fs/cifs/connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
115115
* To make sure we don't use the cached entry, retry 1s
116116
* after expiry.
117117
*/
118-
ttl = (expiry - now + 1);
118+
ttl = max_t(unsigned long, expiry - now, SMB_DNS_RESOLVE_INTERVAL_MIN) + 1;
119119
}
120120
rc = !rc ? -1 : 0;
121121

0 commit comments

Comments
 (0)