From patchwork Thu Dec 21 15:30:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 182302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp489521dyi; Thu, 21 Dec 2023 07:31:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4Iw6cy4MGZMSgqB98ukgfRCCIce2mEaEgpFOtzeXdflWP9EokBS26/LFE93ZfXPkTRc8n X-Received: by 2002:a17:903:40ce:b0:1d4:9d:2a7 with SMTP id t14-20020a17090340ce00b001d4009d02a7mr1206074pld.32.1703172682525; Thu, 21 Dec 2023 07:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703172682; cv=none; d=google.com; s=arc-20160816; b=NnrS3rDergkskiuOcryyePhjvh1YRsWRA5PCn3A/thsMC768wlMISIPs2ipniA6/zR C+Cxnm/3Zi2KjC7CNNrnnwx0Lba3qYzZOEVJ5cstcjsL7v+cTw/sjtkHDPlpAhSS6r/g 4z9sbIYL//wrzF+ydNZdOVoq3Dum/s3ckcYkBatWZcTpcCbhhKPWOGONdwyZPTemTrdl +3zfEnCcFJAhb1Kl76RUHHcv8t3icesUgfsTWhbYeOPT3hw8I1HlurDooDLp9shcIqdW pNn9bYaUgEgEm1L+mkbkr/vGQIdFmVOR1WlgcFWSK6YuebuYPa60jEAHEu7eWWzHj2KH pBvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:from:content-transfer-encoding:content-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:cc:to:organization:dkim-signature; bh=cZkCmal2eYhdvEB2cLXCA/u0IOjOUAwA1vCuz38GOXU=; fh=pBVCnzzcPaji1UTQLad5yssgzug0wL9kNUTwDbVINZ4=; b=mIbamWvU2wJyzm/vh4C3J0h5mQUI7P6/3th1cavwddfMVir7wJuXPd3OlOuu54sZHN IE3Iv0d1XUgHlciFemYCKhi1w44ngUGzghcF9nwp7DTOWlK/jECB+NtoQQZydrtBACty WKF4mPUwBqd2uCZJl4xtdrT8AY7rOV1ajc9p716WOUl98Uq/QI25vvh2P4ksMnQhvN4i xiydwVBUzV4El8X8NzvBqYicmTm/vhCB/P7clUK9qtbut5W5VC0tfkhbJUwcsSQzhdRY UI9zGXcz/OJtAnz6uF/47GRWoeHxOcDjWD/W/5dANzJQdecv5BNSHHzKalHzrhnKVZ35 PSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LTii675s; spf=pass (google.com: domain of linux-kernel+bounces-8664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l4-20020a170902ec0400b001d080c0e21fsi1603078pld.632.2023.12.21.07.31.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:31:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LTii675s; spf=pass (google.com: domain of linux-kernel+bounces-8664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A9E9B288DCE for ; Thu, 21 Dec 2023 15:30:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E2E655E44; Thu, 21 Dec 2023 15:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LTii675s" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A96550254 for ; Thu, 21 Dec 2023 15:30:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703172625; 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; bh=cZkCmal2eYhdvEB2cLXCA/u0IOjOUAwA1vCuz38GOXU=; b=LTii675sJT4kudqws48Hrz8Fx+ZDN+235FUhP7H8FKTaM4k4mQgKwKHYzjN4JT2QCjs+FJ qa8JZVVQaNIdvHYW3rfwmbWwzsYqW1NwhZHoujvh2wIixbNLhptPFMglBFrY6EYwrkNXE/ DlruN2MGEUpmFz4iVDrqvIf6q90jn18= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-qYteG4chOteRcviwmUQYXg-1; Thu, 21 Dec 2023 10:30:19 -0500 X-MC-Unique: qYteG4chOteRcviwmUQYXg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA317380606E; Thu, 21 Dec 2023 15:30:17 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.195.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D5D62166B35; Thu, 21 Dec 2023 15:30:15 +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 To: torvalds@linux-foundation.org cc: dhowells@redhat.com, Markus Suvanto , Marc Dionne , Wang Lei , Jeff Layton , Steve French , Jarkko Sakkinen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, keyrings@vger.kernel.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [GIT PULL] afs, dns: Fix dynamic root interaction with negative DNS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-ID: <1843327.1703172564.1@warthog.procyon.org.uk> From: David Howells Date: Thu, 21 Dec 2023 15:30:14 +0000 Message-ID: <1843374.1703172614@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785905998778313872 X-GMAIL-MSGID: 1785905998778313872 Hi Linus, Could you apply this, please? It's intended to improve the interaction of arbitrary lookups in the AFS dynamic root that hit DNS lookup failures[1] where kafs behaves differently from openafs and causes some applications to fail that aren't expecting that. Further, negative DNS results aren't getting removed and are causing failures to persist. (1) Always delete unused (particularly negative) dentries as soon as possible so that they don't prevent future lookups from retrying. (2) Fix the handling of new-style negative DNS lookups in ->lookup() to make them return ENOENT so that userspace doesn't get confused when stat succeeds but the following open on the looked up file then fails. (3) Fix key handling so that DNS lookup results are reclaimed almost as soon as they expire rather than sitting round either forever or for an additional 5 mins beyond a set expiry time returning EKEYEXPIRED. They persist for 1s as /bin/ls will do a second stat call if the first fails. Reviewed-by: Jeffrey Altman Thanks, David Link: https://bugzilla.kernel.org/show_bug.cgi?id=216637 [1] Link: https://lore.kernel.org/r/20231211163412.2766147-1-dhowells@redhat.com/ # v1 Link: https://lore.kernel.org/r/20231211213233.2793525-1-dhowells@redhat.com/ # v2 Link: https://lore.kernel.org/r/20231212144611.3100234-1-dhowells@redhat.com/ # v3 Link: https://lore.kernel.org/r/20231221134558.1659214-1-dhowells@redhat.com/ # v4 Signed-off-by: Edward Adam Davis Reviewed-by: Jarkko Sakkinen Signed-off-by: Simon Horman --- The following changes since commit ceb6a6f023fd3e8b07761ed900352ef574010bcb: Linux 6.7-rc6 (2023-12-17 15:19:28 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/afs-fixes-20231221 for you to fetch changes up to 39299bdd2546688d92ed9db4948f6219ca1b9542: keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry (2023-12-21 13:47:38 +0000) ---------------------------------------------------------------- AFS fixes ---------------------------------------------------------------- David Howells (3): afs: Fix the dynamic root's d_delete to always delete unused dentries afs: Fix dynamic root lookup DNS check keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry fs/afs/dynroot.c | 31 +++++++++++++++++-------------- include/linux/key-type.h | 1 + net/dns_resolver/dns_key.c | 10 +++++++++- security/keys/gc.c | 31 +++++++++++++++++++++---------- security/keys/internal.h | 11 ++++++++++- security/keys/key.c | 15 +++++---------- security/keys/proc.c | 2 +- 7 files changed, 64 insertions(+), 37 deletions(-)