Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5656018rdb; Wed, 13 Dec 2023 15:41:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZRqtQwbfFLWjLG3L84Ce1bFMbFmFVJsNyaZItpJ7XkuTNaidkm/4pzdtrPJ9gMVFiFm/o X-Received: by 2002:a05:6402:5bc1:b0:54f:3bcb:81f4 with SMTP id gy1-20020a0564025bc100b0054f3bcb81f4mr4848435edb.62.1702510912941; Wed, 13 Dec 2023 15:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702510912; cv=none; d=google.com; s=arc-20160816; b=PHRQh6WZ877e700ILeX+514HEl+3xUKGfLyfST7f4I0Hg8F/g5retxVMEeDgNx8vr+ Y+EUeJXa17xSoMK4BQdMk9nhk86DZLHWR7p0W/l0wR/UJFpz4gQoB5vBxoNOTnnnWtvx UZ3fiQECM/Vu1RM+Wwxq9z0iVI0MEWwaLjB88WkqtirdeHcmUgfPR38zgTrx+PhEYMLv kLUmX5Q9/r0IeYEiw7Ej1EOZrDyqdS0JL7gvmCmAOgkovLPOhfS6PDKwolL/xdbw1cZk dLkWxSfkHoxRoz/JlYqSu/x0HnQG1d8KNG4AVZPJi2F1krfwMjRUPS/vaQ9rImxW63FU VIQQ== ARC-Message-Signature: i=1; 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=rlZvRBMqCyrEtAxBxHPRZ94VEJ+Zn/S8eQ7sbujlGwE=; fh=UEin7YZ4eM5mX713C41+LGZX7Kx6awDGobYQnpIpl5Y=; b=G3dawsPwEhb5yUsVsdSMOl9Y1tsdeIArxiaDZuJp8KeR9itMhGO8Jol1D906yWgTqr U10s9Q3tTNJtNORD6739L+z/4X7wGE3g/Ka+TtaMZReWyw7fQMV4Ge5XVo5fJYKwz2ba 8sHj68OwCIgNcMl4oIa6flO3NVEcCWM1/7I/ElyazCYEYKXa/2dRowVQJMPy2XbK8DZy rsCuOE0w5KR/qudgZJBk/0trHj84pMZxkGLHrnWPJ1ujZu8mD5/9xyewikHoGLO2viXz GVtfW4PLspQGqejVH8qcIVXBXBGI+1sqprL5aTfAfhlHfSe6etaoiNw7MXLFaK2nKn8s kZ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UOsbgugB; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UCAEF+An; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4+bounces-437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-437-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w17-20020a056402269100b0054c90700948si5972762edd.321.2023.12.13.15.41.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:41:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UOsbgugB; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UCAEF+An; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4+bounces-437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-437-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A9A441F219D9 for ; Wed, 13 Dec 2023 23:41:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4FB479480; Wed, 13 Dec 2023 23:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UOsbgugB"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5fvQTkmq"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UCAEF+An"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="34wK+jkJ" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C58AE325C; Wed, 13 Dec 2023 15:41:02 -0800 (PST) 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 E25CC22312; Wed, 13 Dec 2023 23:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702510853; 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=rlZvRBMqCyrEtAxBxHPRZ94VEJ+Zn/S8eQ7sbujlGwE=; b=UOsbgugBCZtVKnclS2O/aqmo9oL6ImGHo45lHB7QVvebqa14ynLYf1AcwhrAed7G5M7WWo NQkdEFH6JWMiWnb2DvrDWwmGt+tsTZQNFGqADVgVS96zmbT86Mt7w8HO7j2LCUNo1SwXU1 Axv0/yEp/3OQaYo5K2YrJfttJbrC/h0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702510853; 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=rlZvRBMqCyrEtAxBxHPRZ94VEJ+Zn/S8eQ7sbujlGwE=; b=5fvQTkmqXGxT3r9NpTgri90gZ1JVcaEVnVdUkzuSAE2b0b/zjnJ4gDsmD7i/iPQC2lblEv Y1CSwhVk4CE+PXBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702510851; 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=rlZvRBMqCyrEtAxBxHPRZ94VEJ+Zn/S8eQ7sbujlGwE=; b=UCAEF+AnInGYwBfo6nS2UmsPaBOkAZ2aZflq32ojoWzgyWuYc/xnSpdVu7BE5x6gv4yAhq FT40+zCxpiX2t5wAJx5NsZisf5W9l/+KmwSFIj/bIPBm9QvxyUA+4yRDFoURQ3WgCP86yR ZHcYDa/ddKDQmKYvK9L4yN1nlOjstbs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702510851; 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=rlZvRBMqCyrEtAxBxHPRZ94VEJ+Zn/S8eQ7sbujlGwE=; b=34wK+jkJ0gvVnN/94Bq1LWXNsjUlD9Ucp+j+PVDSW3+7jo6fMLAp0Z6mOXS0457LcjNLL8 0rCOU0O+J/ZXhYAw== 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 96A751377F; Wed, 13 Dec 2023 23:40:51 +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 0LefHANBemVtPgAAD6G6ig (envelope-from ); Wed, 13 Dec 2023 23:40:51 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, ebiggers@kernel.org, jaegeuk@kernel.org, tytso@mit.edu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH 5/8] ext4: Set the case-insensitive dentry operations through ->s_d_op Date: Wed, 13 Dec 2023 18:40:28 -0500 Message-ID: <20231213234031.1081-6-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213234031.1081-1-krisman@suse.de> References: <20231213234031.1081-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 X-Spam-Level: X-Spam-Score: -0.30 X-Spam-Flag: NO Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -0.30 X-Spamd-Result: default: False [-0.30 / 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]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; RCPT_COUNT_SEVEN(0.00)[8]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[linux.org.uk:email,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.00)[19.49%] All dentries in a case-insensitive filesystem have the same set of dentry operations. Therefore, we should let VFS propagate them from sb->s_d_op d_alloc instead of setting at lookup time. This was already the case before commit bb9cd9106b22 ("fscrypt: Have filesystems handle their d_ops"), but it was changed to set at lookup-time to facilitate the integration with fscrypt. But it's a problem because dentries that don't get created through ->lookup() won't have any visibility of the operations. Let's revert to the previous implementation. Suggested-by: Al Viro Signed-off-by: Gabriel Krisman Bertazi --- fs/ext4/namei.c | 6 +++++- fs/ext4/super.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d252935f9c8a..3c1208d5d85b 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1762,7 +1762,11 @@ static struct buffer_head *ext4_lookup_entry(struct inode *dir, struct buffer_head *bh; err = ext4_fname_prepare_lookup(dir, dentry, &fname); - generic_set_encrypted_ci_d_ops(dentry); + + /* Case-insensitive volumes set dentry ops through sb->s_d_op. */ + if (!dir->i_sb->s_encoding) + generic_set_encrypted_ci_d_ops(dentry); + if (err == -ENOENT) return NULL; if (err) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c5fcf377ab1f..5ac1c9df9956 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5493,6 +5493,9 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) goto failed_mount4; } + if (sb->s_encoding) + sb->s_d_op = &generic_ci_dentry_ops; + sb->s_root = d_make_root(root); if (!sb->s_root) { ext4_msg(sb, KERN_ERR, "get root dentry failed"); -- 2.43.0