|
Takashi Iwai |
bd4d6e |
From 217ece6c45a8a1e0c5910024bb1f02da84484a16 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
bd4d6e |
From: Paulo Alcantara <pc@cjr.nz>
|
|
Takashi Iwai |
bd4d6e |
Date: Thu, 4 Nov 2021 13:13:28 -0300
|
|
Takashi Iwai |
bd4d6e |
Subject: [PATCH] cifs: set a minimum of 120s for next dns resolution
|
|
Takashi Iwai |
bd4d6e |
Git-commit: 4ac0536f8874a903a72bddc57eb88db774261e3a
|
|
Takashi Iwai |
bd4d6e |
Patch-mainline: v5.16-rc1
|
|
Takashi Iwai |
bd4d6e |
References: stable-5.14.19
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
commit 4ac0536f8874a903a72bddc57eb88db774261e3a upstream.
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
With commit 506c1da44fee ("cifs: use the expiry output of dns_query to
|
|
Takashi Iwai |
bd4d6e |
schedule next resolution") and after triggering the first reconnect,
|
|
Takashi Iwai |
bd4d6e |
the next async dns resolution of tcp server's hostname would be
|
|
Takashi Iwai |
bd4d6e |
scheduled based on dns_resolver's key expiry default, which happens to
|
|
Takashi Iwai |
bd4d6e |
default to 5s on most systems that use key.dns_resolver for upcall.
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
As per key.dns_resolver.conf(5):
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
default_ttl=<number>
|
|
Takashi Iwai |
bd4d6e |
The number of seconds to set as the expiration on a cached
|
|
Takashi Iwai |
bd4d6e |
record. This will be overridden if the program manages to re-
|
|
Takashi Iwai |
bd4d6e |
trieve TTL information along with the addresses (if, for exam-
|
|
Takashi Iwai |
bd4d6e |
ple, it accesses the DNS directly). The default is 5 seconds.
|
|
Takashi Iwai |
bd4d6e |
The value must be in the range 1 to INT_MAX.
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
Make the next async dns resolution no shorter than 120s as we do not
|
|
Takashi Iwai |
bd4d6e |
want to be upcalling too often.
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
Cc: stable@vger.kernel.org
|
|
Takashi Iwai |
bd4d6e |
Fixes: 506c1da44fee ("cifs: use the expiry output of dns_query to schedule next resolution")
|
|
Takashi Iwai |
bd4d6e |
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
|
|
Takashi Iwai |
bd4d6e |
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
|
|
Takashi Iwai |
bd4d6e |
Signed-off-by: Steve French <stfrench@microsoft.com>
|
|
Takashi Iwai |
bd4d6e |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Takashi Iwai |
bd4d6e |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
---
|
|
Takashi Iwai |
bd4d6e |
fs/cifs/cifsglob.h | 3 ++-
|
|
Takashi Iwai |
bd4d6e |
fs/cifs/connect.c | 2 +-
|
|
Takashi Iwai |
bd4d6e |
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
|
|
Takashi Iwai |
bd4d6e |
index cf2141483b37..3faf966df183 100644
|
|
Takashi Iwai |
bd4d6e |
--- a/fs/cifs/cifsglob.h
|
|
Takashi Iwai |
bd4d6e |
+++ b/fs/cifs/cifsglob.h
|
|
Takashi Iwai |
bd4d6e |
@@ -75,7 +75,8 @@
|
|
Takashi Iwai |
bd4d6e |
#define SMB_ECHO_INTERVAL_MAX 600
|
|
Takashi Iwai |
bd4d6e |
#define SMB_ECHO_INTERVAL_DEFAULT 60
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
-/* dns resolution interval in seconds */
|
|
Takashi Iwai |
bd4d6e |
+/* dns resolution intervals in seconds */
|
|
Takashi Iwai |
bd4d6e |
+#define SMB_DNS_RESOLVE_INTERVAL_MIN 120
|
|
Takashi Iwai |
bd4d6e |
#define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
/* maximum number of PDUs in one compound */
|
|
Takashi Iwai |
bd4d6e |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
|
|
Takashi Iwai |
bd4d6e |
index 4f4064db08bd..14c925565dbe 100644
|
|
Takashi Iwai |
bd4d6e |
--- a/fs/cifs/connect.c
|
|
Takashi Iwai |
bd4d6e |
+++ b/fs/cifs/connect.c
|
|
Takashi Iwai |
bd4d6e |
@@ -116,7 +116,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
|
|
Takashi Iwai |
bd4d6e |
* To make sure we don't use the cached entry, retry 1s
|
|
Takashi Iwai |
bd4d6e |
* after expiry.
|
|
Takashi Iwai |
bd4d6e |
*/
|
|
Takashi Iwai |
bd4d6e |
- ttl = (expiry - now + 1);
|
|
Takashi Iwai |
bd4d6e |
+ ttl = max_t(unsigned long, expiry - now, SMB_DNS_RESOLVE_INTERVAL_MIN) + 1;
|
|
Takashi Iwai |
bd4d6e |
}
|
|
Takashi Iwai |
bd4d6e |
rc = !rc ? -1 : 0;
|
|
Takashi Iwai |
bd4d6e |
|
|
Takashi Iwai |
bd4d6e |
--
|
|
Takashi Iwai |
bd4d6e |
2.26.2
|
|
Takashi Iwai |
bd4d6e |
|