From patchwork Wed Jul 19 22:19:15 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: 13319559 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5F26C001DF for ; Wed, 19 Jul 2023 22:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjGSWTm (ORCPT ); Wed, 19 Jul 2023 18:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjGSWTj (ORCPT ); Wed, 19 Jul 2023 18:19:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51F21FDC; Wed, 19 Jul 2023 15:19:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 93204222DD; Wed, 19 Jul 2023 22:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689805176; 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=j57Lx3+FpTaFO/zYYXnGH9kXhTYF7EBk2WE6e4N0FWw=; b=Y+kAHqKY0B+MOXA1cqgFXSoT2CrLqbPARo0bEA5bjdqhUyyd1cBaVZYr1q2YQY7ve6TmK1 inx5dr765acnZxFTuXZ1RYSHnuBHixlBv9blHoB1iaLIYkJX+G6AeISiI8wAwfc8WKoxei JX9Mw0y8yS85yQCAmOEYc+uhj5jcp0s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689805176; 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=j57Lx3+FpTaFO/zYYXnGH9kXhTYF7EBk2WE6e4N0FWw=; b=LC8gA7gzUrHj6EcWEVQg8eHdZtfWCWmk/lWpyn7jyRmFvPKeznMNhITrvomwCCent7ATW4 Wnjfrts9A2o92BCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 595FE1361C; Wed, 19 Jul 2023 22:19:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id z846EHhhuGQZJgAAMHmgww (envelope-from ); Wed, 19 Jul 2023 22:19:36 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org, tytso@mit.edu, ebiggers@kernel.org, jaegeuk@kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi , Gabriel Krisman Bertazi Subject: [PATCH v3 4/7] libfs: Chain encryption checks after case-insensitive revalidation Date: Wed, 19 Jul 2023 18:19:15 -0400 Message-ID: <20230719221918.8937-5-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719221918.8937-1-krisman@suse.de> References: <20230719221918.8937-1-krisman@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Gabriel Krisman Bertazi Support encrypted dentries in generic_ci_d_revalidate by chaining fscrypt_d_revalidate at the tail of the d_revalidate. This allows filesystem to just call generic_ci_d_revalidate and let it handle any case-insensitive dentry (encrypted or not). Signed-off-by: Gabriel Krisman Bertazi --- Changes since v2: - Enable negative dentries of encrypted filesystems (Eric) --- fs/libfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index dd213f446427..0e5d3bb1dddc 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1506,7 +1506,7 @@ static inline int generic_ci_d_revalidate(struct dentry *dentry, } } } - return 1; + return fscrypt_d_revalidate(dentry, flags); } static const struct dentry_operations generic_ci_dentry_ops = { @@ -1526,7 +1526,7 @@ static const struct dentry_operations generic_encrypted_dentry_ops = { static const struct dentry_operations generic_encrypted_ci_dentry_ops = { .d_hash = generic_ci_d_hash, .d_compare = generic_ci_d_compare, - .d_revalidate = fscrypt_d_revalidate, + .d_revalidate_name = generic_ci_d_revalidate, }; #endif