Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp155326rwb; Thu, 27 Jul 2023 10:40:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7QPbhQUozfMATlzk3v6s8g7/RNWmtXdlfroXKaWVJc2fJMN/q1zMZls1TGb4uthRzcJjB X-Received: by 2002:a05:6a21:27a1:b0:137:bc72:9c08 with SMTP id rn33-20020a056a2127a100b00137bc729c08mr4729482pzb.16.1690479635681; Thu, 27 Jul 2023 10:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690479635; cv=none; d=google.com; s=arc-20160816; b=G3o23ENd3O0VAISK/0ZpFDeLru2jQPN7TVsxCVykqC54GihKSsclFFokzcdgarZUcS bIwk5b7Yk/H9LFDV2tBKGr5gWHMGdULZfoKOllUnod+cyb60zYRxxKHQalgsMa2L9jMg CNiVq+yc0MFSvFAFqNmlq0ybv2X6T8/G8QX1DdDgfKr2wOlyZa3TT1/osvyDfpUwXv0y pQCqb7c/QaXv/U22XzbD0NcKnZY1io5h0SR//zBxKmRuOChF54eouPB4h37FzAors4Za qgo/ef9MnLZhjBNst03mErLnOpLaAHEjzPbsIMbok2ehdXzrK5pe0UgPUGxw2Uj8B+n2 SOUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=u33Nxud88E1b11kdjmDBklWOJDd3t0YNcG/zXbqscio=; fh=HFDFbc5lRXwuu0vgGURCiLYm5ywsvQKdSNBX4pGxTs4=; b=Xiv5op8L/0jeAHMjM8o3R91YZTItNmVPxROmRrOrPyQWdurBam/l1xv5mXXo+cF3Uc qP7MgWgtrxWZxVdYBJGlSS2zm1R5bVoW0i+7iPME66Asij8wLiMapowFhRncROIV9rp4 Uw/u4mk9iDspZrscLqaMVksjTqlN8WcytPB214LG9oMvAOxr8Oh4J73SjOhfINqR7DyF sMeCkIValg3WFx0X3giow4UO9cCetR09GVXXLMbOoM9PyBzM0aq0VSt0sTK/LBC1+FW1 4yL1L0pRpxENc2eugKUoIIhabYzAcbo3McDZfAvlvYcaqVdmduKbH2IwYXi6CH3VSfON eLIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=rOkOCarp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j192-20020a638bc9000000b0053f3b62c207si1502069pge.767.2023.07.27.10.40.21; Thu, 27 Jul 2023 10:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=rOkOCarp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjG0R3G (ORCPT + 99 others); Thu, 27 Jul 2023 13:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjG0R27 (ORCPT ); Thu, 27 Jul 2023 13:28:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE132D76; Thu, 27 Jul 2023 10:28:55 -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-out2.suse.de (Postfix) with ESMTPS id 90E131F88F; Thu, 27 Jul 2023 17:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690478934; 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=u33Nxud88E1b11kdjmDBklWOJDd3t0YNcG/zXbqscio=; b=rOkOCarpeK0rdsiVu53BMJwMjBjURI+WWOnOImW/UMfOuCT9TxPAtGrQwHEftnWYbGqxRg 55isdToflB6gjJ4ixZCTnOSxZzMxrHrDlEfYMFWrqXZOrWoU2ecYSafFOovgslzyChnwUy zRop+mGW/dMK0Y3qrxvmVYvOFVOKi60= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690478934; 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=u33Nxud88E1b11kdjmDBklWOJDd3t0YNcG/zXbqscio=; b=3EkSCxwp49ojkp/N9SbHUMPFUbhZU0WdMrVNyd2Zz2AeudWjiHNqCePlISR0WkV7KTlm/m csvbVWmufulL6zDQ== 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 5B44F13902; Thu, 27 Jul 2023 17:28:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id k3HEEFapwmTOaAAAMHmgww (envelope-from ); Thu, 27 Jul 2023 17:28:54 +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 v4 4/7] libfs: Chain encryption checks after case-insensitive revalidation Date: Thu, 27 Jul 2023 13:28:40 -0400 Message-ID: <20230727172843.20542-5-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727172843.20542-1-krisman@suse.de> References: <20230727172843.20542-1-krisman@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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 ed04c4dcc312..44c02993adb4 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1513,7 +1513,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 = { @@ -1533,7 +1533,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 -- 2.41.0