Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5655959rdb; Wed, 13 Dec 2023 15:41:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrqMK6bE1hU176Bet6kV4CnwAr0G2NzJitLOkjH2fXcyctsbDc528YA/K0EQrQdgTJD70j X-Received: by 2002:a05:6359:6b0:b0:170:33c0:5de2 with SMTP id ei48-20020a05635906b000b0017033c05de2mr8314786rwb.43.1702510904969; Wed, 13 Dec 2023 15:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702510904; cv=none; d=google.com; s=arc-20160816; b=NwsGAF3al4QmPBXqejrVVNh1EvxnJy39NoNm/zua16nckPe4aCnM63ml1kC0ErTsoa iMdMa/Woqcf8f9iKaxrBBGzmYlTFbudmkbxZKhbIYATfDe8ZFm9R2l575xX0giycytCU Vz9zB+GQNyvXoCtN3OApKyg9D7omjmJQAtg3XXWlRjx7nX8S02aE5h1ta6bFDslaYuEM hhX596id88tX1DyQxIxtB44MDUznT4JSK3DS+e9q6PrKuUjXx0VhCW/4ASK1ClGCyvrT QmVCfR8lfk/HqnrNpfdpZ4ptnH46ewTAexq8zxVZNzMaxNk+c82Pi8rNRy2q6EUQz9Js uRCA== 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; bh=sa9JgwrZTnzFpAI3NIshqWMYA+7hlfFSVekI0hbr8cU=; fh=UEin7YZ4eM5mX713C41+LGZX7Kx6awDGobYQnpIpl5Y=; b=LFeGSDJn4BA3QH2t3Yrh9dWKjN0S2saOXPDdyLOMN5O3zGRxGBSrrYR6At9jsJzVB9 xX2pvIF1k2wn7LR7Mot3DtV94FFtK6X4cE3dXYZwS2aNMZmfD7F9TzzFn1d1mntkHl/A Zpui/a84LtvxnBkwFm0/uRyW/qGhwC/yDtPyX2WUDWtJj301+RkB6Orhhptu7J13XeRU Z31lqIDJoi6J4HHqyXU6LFLseLjhdFfo5QIJSx4nKyOQAtyeM109lK1MQN81l7mxWVW4 RmXXRX+Il0a8jbi2peml6KagvRFgEs+6pJK1xGtOIfiwOf6nmfsn0AXqhgpKLKFHovji oAgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p13-20020a0cfd8d000000b0067eff8c7f47si1626218qvr.224.2023.12.13.15.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:41:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-436-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; spf=pass (google.com: domain of linux-ext4+bounces-436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 B15FC1C20473 for ; Wed, 13 Dec 2023 23:41:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4949979472; Wed, 13 Dec 2023 23:41:23 +0000 (UTC) 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 CF7FA326C; Wed, 13 Dec 2023 15:41:02 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 7F4B322315; Wed, 13 Dec 2023 23:40:53 +0000 (UTC) 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 4532B1377F; Wed, 13 Dec 2023 23:40:53 +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 7iDFCgVBemVzPgAAD6G6ig (envelope-from ); Wed, 13 Dec 2023 23:40:53 +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 6/8] f2fs: Set the case-insensitive dentry operations through ->s_d_op Date: Wed, 13 Dec 2023 18:40:29 -0500 Message-ID: <20231213234031.1081-7-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: -4.00 X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 7F4B322315 X-Spam-Flag: NO 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/f2fs/namei.c | 6 +++++- fs/f2fs/super.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index d0053b0284d8..4053846e2cd3 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -532,7 +532,11 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, } err = f2fs_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) goto out_splice; if (err) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 033af907c3b1..0a199eb5b01e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4663,6 +4663,9 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_node_inode; } + if (sb->s_encoding) + sb->s_d_op = &generic_ci_dentry_ops; + sb->s_root = d_make_root(root); /* allocate root dentry */ if (!sb->s_root) { err = -ENOMEM; -- 2.43.0