Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2801335rdb; Mon, 12 Feb 2024 18:14:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFXJ+BZzhbX0J2JmZ9aiOzhAmqCtjI+yjFCN+Ggb+w8c1XqE7YGVys6e4lmqE27Kp5hYsADOADUFm39CGERxd7AXEdEiPChLgBasYqSQ== X-Google-Smtp-Source: AGHT+IFx48NUU0pyPefvyeUW6x62DNCSJY46qMNKY+XoJ4T8PrVR7f2JDqMK4wLqYbk2C6MRkP4C X-Received: by 2002:ac8:590b:0:b0:42c:524:ef2b with SMTP id 11-20020ac8590b000000b0042c0524ef2bmr11898472qty.8.1707790455107; Mon, 12 Feb 2024 18:14:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707790455; cv=pass; d=google.com; s=arc-20160816; b=qOT6ZRFd/kiFpQG9P7fLDLfg2z1QP2QHKDch8W4kNuX6yTMg2IPshxNKQsykhoP3rz VOsX0TwmWzTZRDre/t4X8k0IdgQVbcyjDzR73bc/hs0MqTpXRy/807twLNPDorH0QWTV MiZ/9dNewbRE7qfZNGyVZCsE2n5OqVbJGZgNiyBaaLSxEVU4y71a4GAD7rZo+ijkPuGS bMcmNhpqj5TPJwse/jWcREhwFcG/zhzevulyod30274Kvqtz5HZH1g02cbfo8wNR+T5g QVltxfcSlyq7SFXTIN/vUUx1MKdM/7hEbUXfUsaK9OUkwSmNoYTHnCe7QnK87idCyglZ kY/A== ARC-Message-Signature: i=2; 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=4ndF6V3SsLiNbHHQyhRWSN0rON3hSgfDFtfJaeKlRqQ=; fh=sQwmwU6VZ+qM+OGpmumeEDK84JxZ/fO6LMAyZ7TCHqk=; b=zsvUdO5nbZcfJcOU0QRDXhTaOWRuXE3OQAcJ7CGAWSAYSjA4UeN3qNp4fT557L9fMf 3iZgSgskEE5ZfRL0hkoPxqi9Oitjs0ZLshSxmCKTZ5vNwcamhqh6Xzr9zrh6lSKiTPsN gh0JU1KQWztnWNwzNhrTI6MM37nnnTmR3fbwmszByx7crFdlQXU5Vj/Ta+1rE53YOHa7 gdOre2IUo4j8ujzIt88/kAnX2mVJfj99xh4sc+3Zk8XrAhqHW1HTCFiUsuyFFksHxflT I4ikaiWUrr1vN/EM0s8XC7pEP2HfBsTlu9txTHFRUHCI49rWmiE27tLWK/ceNBnbnodL X71w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=iVeAmGbl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=iVeAmGbl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-ext4+bounces-1209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=2; AJvYcCV432rVfHHqZzrhRyPVqAygFM7neQizgeqGcfd+jvWUNwnzFOwacMIy4nj/NvU3t32dj6FGlLXyLHpr0C2uEXYyr+gQWd4JIi3nexUrOA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i17-20020ac860d1000000b0042c7ec90d47si1719971qtm.478.2024.02.12.18.14.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 18:14:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=iVeAmGbl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=iVeAmGbl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-ext4+bounces-1209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1209-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CAC7D1C23235 for ; Tue, 13 Feb 2024 02:14:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25DFD4C64; Tue, 13 Feb 2024 02:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="iVeAmGbl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ZVXURhnK"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="iVeAmGbl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ZVXURhnK" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 16BD079DF; Tue, 13 Feb 2024 02:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707790434; cv=none; b=j7z+jdjZIIOt11/ptF9RiKkfAFbIKpiiLAcYBs40Yk+LrsevfXKvosOE6Hkv1O5ZVgz9pO43PWvPbCqYsf7UnNabflWBYnpD84PFp6yGWRPGbwE4yggaABne5scRnO/oe5/oQrswpqkV3DTajDhF90gAn3M8XWOvSFjpONryiXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707790434; c=relaxed/simple; bh=PXtiL6C2nV59CWvIs6rcclrlqY5sfi2s/kdOktmFk58=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OcMHp0f+PWfKkGR7GKDyQ/dmVDDm3KSxKghgR+vtdC6nocRaUA5EMMSqcJcz4IVnR6Y/K22Nji1Pfyq0dsjc3rWSl2rpnUip9MZEp0kS4wH4QPV2vsO+q4MRO0EUThJsjE5Chph/I3GvU/DuzqunqxkoqlvKbAsVkZSnuXMfWvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=iVeAmGbl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ZVXURhnK; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=iVeAmGbl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ZVXURhnK; arc=none smtp.client-ip=195.135.223.130 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-out1.suse.de (Postfix) with ESMTPS id 4DDFD21CE5; Tue, 13 Feb 2024 02:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707790431; 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=4ndF6V3SsLiNbHHQyhRWSN0rON3hSgfDFtfJaeKlRqQ=; b=iVeAmGblsUi6Pn4CPeFHO+NRrnryZV+IyMg0dvVG2UMHNjkXXYQIM5S4nvvT33WjLaokgD zIFOHiyjuhpOYsjEAew6mxdjMN1N4w1PuxcvsnTBO29HUBhFw59VTEizNuVXzYF9kabota Vd4jWu7UP0Y95XUyLnDylXRW4xkLBP0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707790431; 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=4ndF6V3SsLiNbHHQyhRWSN0rON3hSgfDFtfJaeKlRqQ=; b=ZVXURhnKIb/mib6jx+7ni5EeOv/+9YBXIMDQmF6kgYN+FFPyFCtqQU0sskqrvZ8kXllCLu eQ+s9bnWZe/OWBAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707790431; 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=4ndF6V3SsLiNbHHQyhRWSN0rON3hSgfDFtfJaeKlRqQ=; b=iVeAmGblsUi6Pn4CPeFHO+NRrnryZV+IyMg0dvVG2UMHNjkXXYQIM5S4nvvT33WjLaokgD zIFOHiyjuhpOYsjEAew6mxdjMN1N4w1PuxcvsnTBO29HUBhFw59VTEizNuVXzYF9kabota Vd4jWu7UP0Y95XUyLnDylXRW4xkLBP0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707790431; 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=4ndF6V3SsLiNbHHQyhRWSN0rON3hSgfDFtfJaeKlRqQ=; b=ZVXURhnKIb/mib6jx+7ni5EeOv/+9YBXIMDQmF6kgYN+FFPyFCtqQU0sskqrvZ8kXllCLu eQ+s9bnWZe/OWBAQ== 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 0992213A4B; Tue, 13 Feb 2024 02:13:50 +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 G6OaN17QymUgeAAAD6G6ig (envelope-from ); Tue, 13 Feb 2024 02:13:50 +0000 From: Gabriel Krisman Bertazi To: ebiggers@kernel.org, viro@zeniv.linux.org.uk Cc: jaegeuk@kernel.org, tytso@mit.edu, amir73il@gmail.com, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, brauner@kernel.org, Gabriel Krisman Bertazi Subject: [PATCH v6 05/10] libfs: Merge encrypted_ci_dentry_ops and ci_dentry_ops Date: Mon, 12 Feb 2024 21:13:16 -0500 Message-ID: <20240213021321.1804-6-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213021321.1804-1-krisman@suse.de> References: <20240213021321.1804-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 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: *** X-Spam-Score: 3.70 X-Spamd-Result: default: False [3.70 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[13.38%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_CC(0.00)[kernel.org,mit.edu,gmail.com,vger.kernel.org,lists.sourceforge.net,suse.de]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO In preparation to get case-insensitive dentry operations from sb->s_d_op again, use the same structure with and without fscrypt. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v1: - fix header guard (eric) --- fs/libfs.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index c2aa6fd4795c..c4be0961faf0 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1776,19 +1776,14 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str) static const struct dentry_operations generic_ci_dentry_ops = { .d_hash = generic_ci_d_hash, .d_compare = generic_ci_d_compare, -}; -#endif - #ifdef CONFIG_FS_ENCRYPTION -static const struct dentry_operations generic_encrypted_dentry_ops = { .d_revalidate = fscrypt_d_revalidate, +#endif }; #endif -#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE) -static const struct dentry_operations generic_encrypted_ci_dentry_ops = { - .d_hash = generic_ci_d_hash, - .d_compare = generic_ci_d_compare, +#ifdef CONFIG_FS_ENCRYPTION +static const struct dentry_operations generic_encrypted_dentry_ops = { .d_revalidate = fscrypt_d_revalidate, }; #endif @@ -1809,38 +1804,21 @@ static const struct dentry_operations generic_encrypted_ci_dentry_ops = { * Encryption works differently in that the only dentry operation it needs is * d_revalidate, which it only needs on dentries that have the no-key name flag. * The no-key flag can't be set "later", so we don't have to worry about that. - * - * Finally, to maximize compatibility with overlayfs (which isn't compatible - * with certain dentry operations) and to avoid taking an unnecessary - * performance hit, we use custom dentry_operations for each possible - * combination rather than always installing all operations. */ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) { -#ifdef CONFIG_FS_ENCRYPTION - bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME; -#endif #if IS_ENABLED(CONFIG_UNICODE) - bool needs_ci_ops = dentry->d_sb->s_encoding; -#endif -#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE) - if (needs_encrypt_ops && needs_ci_ops) { - d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops); + if (dentry->d_sb->s_encoding) { + d_set_d_op(dentry, &generic_ci_dentry_ops); return; } #endif #ifdef CONFIG_FS_ENCRYPTION - if (needs_encrypt_ops) { + if (dentry->d_flags & DCACHE_NOKEY_NAME) { d_set_d_op(dentry, &generic_encrypted_dentry_ops); return; } #endif -#if IS_ENABLED(CONFIG_UNICODE) - if (needs_ci_ops) { - d_set_d_op(dentry, &generic_ci_dentry_ops); - return; - } -#endif } EXPORT_SYMBOL(generic_set_encrypted_ci_d_ops); -- 2.43.0