From patchwork Fri Dec 15 21:16:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13494936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E0C9C4167B for ; Fri, 15 Dec 2023 21:16:31 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rEFXq-0000CW-PS; Fri, 15 Dec 2023 21:16:29 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rEFXp-0000CQ-KB for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Dec 2023 21:16:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=iIVkIuoeQZO5ot4LghA6hJOpIg P1l6fGJlmRPDsgbGK8UunfkVLUtGuh9nI8yp5VFvvNYsCmoK9fzpbTt/WcDRRY4A5aXJ7Sb1TcIRy 7UhONSVsvQEyIeLKVhugqAyVUf3MsFUUv7GxcE5yt+Uy8ZtotesaC5sxBvi5v7BmnsEM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wFdpRL19Qo72V5iD16rSLzA5DXdY7+DFwh/2hlpfLqI=; b=KA7DPC3Xhy9FwVoYwePhSN2CDb bAtWsi8NWBRXNgdPsULdOniHanwp/682U7e8BMqhj39q37l4pG3+u/LQ140QJr4Eei0LObYY/fI2x IvJW5IoUkKj1UXh3J1KNDMckfmvHxsDvmMkS5uTHuoa8cTAWN6qhOiDBjXBZ8GuMdwFc=; Received: from smtp-out2.suse.de ([195.135.223.131]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1rEFXl-0001QO-Sl for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Dec 2023 21:16:28 +0000 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 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> MIME-Version: 1.0 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-Headers-End: 1rEFXl-0001QO-Sl Subject: [f2fs-dev] [PATCH v2 2/8] fscrypt: Drop d_revalidate if key is available X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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.