Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2919259rwr; Fri, 21 Apr 2023 17:04:58 -0700 (PDT) X-Google-Smtp-Source: AKy350ZVvDWHRiORroBpd2f8N3xJNRtPTZDOqeXtAa9i0Ei2EqFdPmFPo0SHF+7Wjx8WqYJlSmE9 X-Received: by 2002:a17:902:ecd1:b0:1a5:2e19:bc40 with SMTP id a17-20020a170902ecd100b001a52e19bc40mr8575655plh.26.1682121897800; Fri, 21 Apr 2023 17:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682121897; cv=none; d=google.com; s=arc-20160816; b=BXozJ+a3J8nPtQ8Gjrda96bcFtZOah8r9JkmqqkKHliXGpuXjane25rbG2KDvUux4r V1RNv2J6nqQdJ7fvMjd8ZSRbcZGnf2zku6UrRylA9PTzA3wgOWE5gJLT2NJSnawO58U0 hp36tgtasDQoDtxSKDKMIOnu5XYJIjw4nUyRjqjDZXY2EnQfB6eIF0Ti1PNmMtrm+6Ub oLcYEnq/j+aJl9TqY4ZSlX4lPyUMrSZjQ9BcELuZk+vBcGG47n9jG+oAGo/yCFVtgzUx GtV3XEgD1RUy0EpzgyqjrHYZ3iGEAYeHWQMby2RkZJz2W9q/He/HHPnHMX7v/Hq2FUeI usug== 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=NeMPxDtSjbDzYSqUIHTtcCiAYoBRXMWjUbd9t3zHHGs=; b=0LPQF2sW1Y0KbZGx4YYk88XmJPxPbrXubvWigTZqZ2lTAclqj00GL4EllPXQHhJAhp NkYpfhzpzTuBKmEu6Vws9ySx2KgwKqLj9wef74fzdJCK1RCsNkGAj1GrvIoJcUOf23tO ufQ14Fdmr0uBdKUALFkvcbb93+sGam2BPiaAb1FEnPk7zb35/Kjuup4Lsls+5J6CRcC7 T0xPjiN/ags68BEF/i0wEMttK4itukzWErFKqBpbopL2J1gUN3YTlUl/pCCDnhmQJfU3 RBpotNHEk+SXZzK9Rwe/AInXiWU+XPTWl2Twe1+NBrSfnHDz8CCz3AMrdlcpkxGcm8OO liSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pJfoCVYJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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 jc9-20020a17090325c900b001a65134e198si5155766plb.182.2023.04.21.17.04.44; Fri, 21 Apr 2023 17:04:57 -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=pJfoCVYJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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 S233940AbjDVADg (ORCPT + 99 others); Fri, 21 Apr 2023 20:03:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbjDVADW (ORCPT ); Fri, 21 Apr 2023 20:03:22 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 479242706; Fri, 21 Apr 2023 17:03:19 -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 DFEC121A5C; Sat, 22 Apr 2023 00:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682121797; 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=NeMPxDtSjbDzYSqUIHTtcCiAYoBRXMWjUbd9t3zHHGs=; b=pJfoCVYJCN4hGVd1uiRFEIwpiXZCBcsruUVCBZCRwGxgM5UXoUvJUC88o7+VXA8hu/bf0G /d1KkVNwnL26dYO9LIDUJaswhL7tq8G/5INLewDkpA1c1Gjq+iwEmPc9V8tHfiPZ6dB3S/ R4ERY035eP5BG2Mc1RWhDZ1n7uC4QdE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682121797; 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=NeMPxDtSjbDzYSqUIHTtcCiAYoBRXMWjUbd9t3zHHGs=; b=FzV+KNkXeYccWagfjgK0tN8p8k5epzhcY3E17iDBRnDXoiYeT/N/9dZB76B1gcY/zanVPy aSDby8TiSRrEkVCA== 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 A9DE71358E; Sat, 22 Apr 2023 00:03:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +dLjI0UkQ2TndwAAMHmgww (envelope-from ); Sat, 22 Apr 2023 00:03:17 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org Cc: tytso@mit.edu, jaegeuk@kernel.org, ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, krisman@suse.de Subject: [PATCH v2 4/7] libfs: Support revalidation of encrypted case-insensitive dentries Date: Fri, 21 Apr 2023 20:03:07 -0400 Message-Id: <20230422000310.1802-5-krisman@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230422000310.1802-1-krisman@suse.de> References: <20230422000310.1802-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,URIBL_BLOCKED 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 Preserve the existing behavior for encrypted directories, by rejecting negative dentries of encrypted+casefolded directories. This allows generic_ci_d_revalidate to be used by filesystems with both features enabled, as long as the directory is either casefolded or encrypted, but not both at the same time. Signed-off-by: Gabriel Krisman Bertazi --- fs/libfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index f8881e29c5d5..0886044db593 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1478,6 +1478,9 @@ static inline int generic_ci_d_revalidate(struct dentry *dentry, const struct inode *dir = READ_ONCE(parent->d_inode); if (dir && needs_casefold(dir)) { + if (IS_ENCRYPTED(dir)) + return 0; + if (!d_is_casefold_lookup(dentry)) return 0; @@ -1497,7 +1500,8 @@ 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 = { @@ -1517,7 +1521,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.40.0