Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6962204rdb; Fri, 15 Dec 2023 13:16:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKSSQmkgN1sIQ440hhiGlJpeIlKaks01g7iNhQ619poq/OLyPWVTt4JTE6Qx/5FyNmYpdU X-Received: by 2002:a17:906:738c:b0:a1d:ffaa:cf62 with SMTP id f12-20020a170906738c00b00a1dffaacf62mr11280341ejl.0.1702675004479; Fri, 15 Dec 2023 13:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702675004; cv=none; d=google.com; s=arc-20160816; b=peH7qg28ieP9GpkT0A30YUkrFEQ6vwNLve5cbC+tlV8OGQkrKJ0IDOZkQyc7uKGGNZ 8zsKu7WJu5kzry9j0DjHvnErFhGvRDqLGzAh6JvLK3FMDo5fUXSLdsENs+5oIVKui1j6 BexZll5xvCjLJpV5KxIANktElYKJXjtwXDZ4bUrVLgzTgjNU773ceQnRAtt3Nk2MMuW5 lhLNR8gszetyvCcVROpZuBifblNrP3/745z53okHyodClXdzaPg4AiwfYS6ia8z2JQsI sID8pyARWtE8RwCmrg6p6DtjqXrX+8hEKo+vTAMCEElHlU7JwU4AR+IrRlK0Ee6MCdwI KVAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; fh=UEin7YZ4eM5mX713C41+LGZX7Kx6awDGobYQnpIpl5Y=; b=rPwnl55/Yw/bdE9chWfqr9vAR8YRhWde1tLnZVrnEqoAQk+0sAsTOPo8Bjt8lHoTI0 pHRVxXsuCIZZKLQSD9C/0lH9PuFuOBrZ1dSqp2kJUUlMxLoQKHy5ViuKTH2ffaQLhYhF O3vhQXZT3nk0E4ENEq1HTm/QiioT8Qov0/mReog+l2yRUw+xdowNYc6yGOuJZkssipxB ChCzMcsMeqK/jUC9ZE1G69IZTXG8syQ3bsQ3itXMx8YduFK42mbFwMmcmn7IGr+bQIr0 UuyFFZLcDdqzt5xwkEarokkVOpsLE3w24w4fclZILVLJnsm0fD0CRxF7bv4UXsF21gUG 7HQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0PbC4ieI; dkim=neutral (no key) header.i=@suse.de header.b=5x41is8J; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0PbC4ieI; dkim=neutral (no key) header.i=@suse.de header.b=5x41is8J; spf=pass (google.com: domain of linux-ext4+bounces-464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hz21-20020a1709072cf500b00a1b7769f829si7419166ejc.388.2023.12.15.13.16.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0PbC4ieI; dkim=neutral (no key) header.i=@suse.de header.b=5x41is8J; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0PbC4ieI; dkim=neutral (no key) header.i=@suse.de header.b=5x41is8J; spf=pass (google.com: domain of linux-ext4+bounces-464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 41B4A1F2673C for ; Fri, 15 Dec 2023 21:16:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 858B448CC5; Fri, 15 Dec 2023 21:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="0PbC4ieI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5x41is8J"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="0PbC4ieI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5x41is8J" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2B2B47F7A; Fri, 15 Dec 2023 21:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1E9371F863; Fri, 15 Dec 2023 21:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674979; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=0PbC4ieIDnc8k96lBUCBSBJdgMCggwUaTxtfGkWiKpTA+onRQVeH/wvJNqbTBJhULfz31x AHAeyRPrSmhlndlcGEMsxGayZpOQ21lXWdl8YIlQYM82j+c3gJXtcbpmpoGkgBQVSAmfup MoPFCWyBEcBkWTxMNPMy5OxwIGDGXaE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674979; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=5x41is8J3UjiUO+NUlXQDmmbb0nMC4xGU9RXf5QraFMqwbtqsyesZG9vAMu4ulJHXexC9q Yb8Zd3TXBw8bVzAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674979; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=0PbC4ieIDnc8k96lBUCBSBJdgMCggwUaTxtfGkWiKpTA+onRQVeH/wvJNqbTBJhULfz31x AHAeyRPrSmhlndlcGEMsxGayZpOQ21lXWdl8YIlQYM82j+c3gJXtcbpmpoGkgBQVSAmfup MoPFCWyBEcBkWTxMNPMy5OxwIGDGXaE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674979; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=5x41is8J3UjiUO+NUlXQDmmbb0nMC4xGU9RXf5QraFMqwbtqsyesZG9vAMu4ulJHXexC9q Yb8Zd3TXBw8bVzAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D02A4137D4; Fri, 15 Dec 2023 21:16:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 9nfHKyLCfGWMOQAAD6G6ig (envelope-from ); Fri, 15 Dec 2023 21:16:18 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, ebiggers@kernel.org, jaegeuk@kernel.org, tytso@mit.edu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH v2 2/8] fscrypt: Drop d_revalidate if key is available Date: Fri, 15 Dec 2023 16:16:02 -0500 Message-ID: <20231215211608.6449-3-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231215211608.6449-1-krisman@suse.de> References: <20231215211608.6449-1-krisman@suse.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 4.63 X-Spamd-Result: default: False [4.63 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[8]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.27)[73.94%] Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: **** X-Spam-Flag: NO fscrypt dentries are always valid once the key is available. Since the key cannot be removed without evicting the dentry, we don't need to keep retrying to revalidate it. Signed-off-by: Gabriel Krisman Bertazi --- fs/crypto/fname.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index 7b3fc189593a..0457ba2d7d76 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -591,8 +591,15 @@ int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) * reverting to no-key names without evicting the directory's inode * -- which implies eviction of the dentries in the directory. */ - if (!(dentry->d_flags & DCACHE_NOKEY_NAME)) + if (!(dentry->d_flags & DCACHE_NOKEY_NAME)) { + /* + * If fscrypt is the only feature requiring + * revalidation for this dentry, we can just disable it. + */ + if (dentry->d_op->d_revalidate == &fscrypt_d_revalidate) + d_set_always_valid(dentry); return 1; + } /* * No-key name; valid if the directory's key is still unavailable. -- 2.43.0