From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 878B7C2BB55 for ; Thu, 16 Apr 2020 13:02:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61A73206B9 for ; Thu, 16 Apr 2020 13:02:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CrgntKjq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2894730AbgDPNBv (ORCPT ); Thu, 16 Apr 2020 09:01:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24030 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2894706AbgDPNBs (ORCPT ); Thu, 16 Apr 2020 09:01:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587042106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eu6b6HDAloa0ypWgaxME9iI3u+iDHWfSGslG1thqHSI=; b=CrgntKjq2ddR6K/On7+2pCuCjd5xXKsLsEzkCp2rqHytjHnWPHShT8kfr6X1XVcO1DYPRu S7SqDQ7aYAcGu0LXADo+ZBLGHVbCGfSoBiqBMYrfnAgSWGkx1gXgRjHFWl7h19syeB7E3n 0bYxBQrPYjnrtP4g3dF2SNToyYuTolA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-135-hChMLAzGMqqPJHzgmWdWww-1; Thu, 16 Apr 2020 09:01:43 -0400 X-MC-Unique: hChMLAzGMqqPJHzgmWdWww-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7B32802564; Thu, 16 Apr 2020 13:01:41 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-113-129.rdu2.redhat.com [10.10.113.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id C45B75DA89; Thu, 16 Apr 2020 13:01:39 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <87v9lzu3cx.fsf@oldenburg2.str.redhat.com> References: <87v9lzu3cx.fsf@oldenburg2.str.redhat.com> <874ktl2ide.fsf@oldenburg2.str.redhat.com> <3865908.1586874010@warthog.procyon.org.uk> <128769.1587032833@warthog.procyon.org.uk> To: Florian Weimer Cc: dhowells@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, keyrings@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: What's a good default TTL for DNS keys in the kernel MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <142354.1587042098.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 16 Apr 2020 14:01:38 +0100 Message-ID: <142355.1587042098@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Florian Weimer wrote: > > Florian Weimer wrote: > > > >> You can get the real TTL if you do a DNS resolution on the name and > >> match the addresses against what you get out of the NSS functions. I= f > >> they match, you can use the TTL from DNS. Hackish, but it does give = you > >> *some* TTL value. > > > > I guess I'd have to do that in parallel. > = > Not necessary. You can do the getaddrinfo lookup first and then perform > the query. That means that the latency of both is added together and causes the first mount to take longer - though as long as you have a local DNS cache, that'= s fine. > > AFS keeps track of the expiration on the record and will issue a new l= ookup > > when the data expires, but NFS doesn't make use of this information. > = > And it will switch servers at that point? Or only if the existing > server association fails/times out? AFS will switch servers at the next operation if the server list changes. = And if the current op tries to access an old server and gets bounced, this sho= uld trigger an immediate reevaluation. It also regularly probes the servers a= nd interfaces it knows about to find which one's accessible and which has the best response and can switch servers on that basis also. I should also note that AFS deletes the dns_resolver key after reading it = and maintains the expiry information in its internal structs. Note also that in AFS this only applies to locating the Volume Location servers (which is a layer of abstraction that hides which server(s) a volu= me resides on and what their addresses are). The VL service is queried to fi= nd out where file servers are (giving you their addresses itself so you don't need to access the DNS there). > > The keyring subsystem will itself dispose of dns_resolver keys that > > expire and request_key() will only upcall again if the key has > > expired. > = > What's are higher-level effects of that? If the record never expires (the current case), the address lookup in the kernel (dns_query()) will always return the same address until someone manually evicts it. Otherwise, once the record expires, the kernel will just upcall again. > I'm still not convinced that the kernel *needs* accurate TTL > information. The benefit from upcall avoidance likely vanishes quickly > after the in-kernel TTL increases beyond 5 or so. That's just my guess, > though. You might be right - certainly for NFS and CIFS where the address ascribed= to a superblock is hard to change as it partly defines the superblock. Chang= e the address and your superblock in now a different thing as far as the VFS= is concerned. This makes fscache indexing tricky for NFS. How do you define a superbloc= k? Is it address? Is it hostname? What happens if one or the other changes? What happens if there are two or more addresses (say ipv4 and ipv6 addrs)? AFS defined some abstractions for this: the cell name and the volume ID number. The physical location of the volume doesn't matter - and the volu= me can even be moved around whilst in use. David