Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6962415rdb; Fri, 15 Dec 2023 13:17:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3l+3MKc7vc3sO25/m7j0bgoK99CEwv/jtebniq9eWMKejo4hTDhwrtuXRLFWFIfJvHern X-Received: by 2002:a17:902:784a:b0:1d3:49ba:501a with SMTP id e10-20020a170902784a00b001d349ba501amr5395759pln.12.1702675028713; Fri, 15 Dec 2023 13:17:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702675028; cv=none; d=google.com; s=arc-20160816; b=oam+jAPT2fjhjwEmH1DLngD4DLf6u+Jy0xffl2M3PEmEVoLa6qo0pQWQSKvMw42VnE ENLfZ54Y1HUGrc84mm5QCdGJta9ujFGOQpMYnJVcEPAKGtl6CQUv4GvT8s2AiIR3LOcM xcYIuwMHiXrnZLJMkkDfGezHZM4i0lGzbYiL2cQrsYEqoB0wb9ssfwK0+vQgzExCf2tO lMmzujm83T1rpb7ABlqPpz8cZrEcD5kBuf2PMp49bWvjduA4P6H7+v4YgWYoFaQo7a5z 3B5cbWkcXVSVxFfDEvHOrKrGRoptOLBE+v3wXtBS2dGdN5NybX7dbkMiC8Z2+sDoz/fY T9mw== 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=4zHvzCVpUzO/WVW65Ji92QCoBmB2JO4/PTv0toH5FDE=; fh=UEin7YZ4eM5mX713C41+LGZX7Kx6awDGobYQnpIpl5Y=; b=LP+1Nwy+qY8mfThOG3/7rXMcumrQRvh0asZP9kSh+C0Ro6AW2P47le99GATXlGJmwO /TubrIga0xz0pWa88/0iBW3wojpIv/Uofvr/c6fArmK2isLayyPEbt/Jvgy3Zc0Y0+oY pOWkXIiJwn8qmSf+tWKyyF+BI7qmNL83oyOq+P9ANwE2sdgcrP98Zk43ZnhXeLdWLKDj luCO9XRiIYuftuCLWK9kRWKaFCAbo1j6fKe2u5szARCnWTseht9HdRyvvcrHybgSkq2/ YkTqV0CKLL5WZ1x8Y2q7nTDe4h5JHo6vOA5U11GQeEj4oWyjK682sCLXZcBSrgSkpvmJ u/KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Os5wdbIC; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Os5wdbIC; dkim=neutral (no key) header.i=@suse.de header.b=MhiXQQVZ; spf=pass (google.com: domain of linux-ext4+bounces-468-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-468-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u13-20020a170902e5cd00b001d38ca8cbbasi1204210plf.266.2023.12.15.13.17.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:17:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-468-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Os5wdbIC; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Os5wdbIC; dkim=neutral (no key) header.i=@suse.de header.b=MhiXQQVZ; spf=pass (google.com: domain of linux-ext4+bounces-468-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-468-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A7BFE286E95 for ; Fri, 15 Dec 2023 21:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09FFD49F7D; Fri, 15 Dec 2023 21:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Os5wdbIC"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="MhiXQQVZ"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Os5wdbIC"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="MhiXQQVZ" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 33C9B49F70; Fri, 15 Dec 2023 21:16:32 +0000 (UTC) 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 [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-out2.suse.de (Postfix) with ESMTPS id 2A6B41F855; Fri, 15 Dec 2023 21:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674990; 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=4zHvzCVpUzO/WVW65Ji92QCoBmB2JO4/PTv0toH5FDE=; b=Os5wdbIC5gYaOirMLKX+gCH+nu5THrpihNWYVA8KvupCnmrEuuiSQM3PtN+cAfqFuVcn8e x2gNDKFH5XCwSWbRY25C7bEGLp9fAW4bug64Wtg1DTfcXOsXQyZ39RSMYFwJEfTp7vPqn8 jcH5gxdAIMtrgDNvS/zP6OO7iVWL4zM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674990; 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=4zHvzCVpUzO/WVW65Ji92QCoBmB2JO4/PTv0toH5FDE=; b=MhiXQQVZnxYArrFmeb+U6p/dOGV4IYWP8+6eAh/6xi0jKWwZbTLKgoyg+DcOlJolkPrl4N 4J0CGNm19jaiQeDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674990; 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=4zHvzCVpUzO/WVW65Ji92QCoBmB2JO4/PTv0toH5FDE=; b=Os5wdbIC5gYaOirMLKX+gCH+nu5THrpihNWYVA8KvupCnmrEuuiSQM3PtN+cAfqFuVcn8e x2gNDKFH5XCwSWbRY25C7bEGLp9fAW4bug64Wtg1DTfcXOsXQyZ39RSMYFwJEfTp7vPqn8 jcH5gxdAIMtrgDNvS/zP6OO7iVWL4zM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674990; 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=4zHvzCVpUzO/WVW65Ji92QCoBmB2JO4/PTv0toH5FDE=; b=MhiXQQVZnxYArrFmeb+U6p/dOGV4IYWP8+6eAh/6xi0jKWwZbTLKgoyg+DcOlJolkPrl4N 4J0CGNm19jaiQeDw== 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 DA379137D4; Fri, 15 Dec 2023 21:16:29 +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 2hsBLi3CfGWaOQAAD6G6ig (envelope-from ); Fri, 15 Dec 2023 21:16:29 +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 v2 6/8] f2fs: Set the case-insensitive dentry operations through ->s_d_op Date: Fri, 15 Dec 2023 16:16:06 -0500 Message-ID: <20231215211608.6449-7-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231215211608.6449-1-krisman@suse.de> References: <20231215211608.6449-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-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 4.69 X-Spamd-Bar: ++++ X-Spam-Flag: NO X-Spamd-Result: default: False [4.69 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; 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]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[8]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,linux.org.uk:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[13.47%]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from] Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Os5wdbIC; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=MhiXQQVZ X-Spam-Level: **** X-Rspamd-Queue-Id: 2A6B41F855 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 --- changes since v1: - Fix CONFIG_UNICODE=n build (lkp) --- fs/f2fs/namei.c | 6 +++++- fs/f2fs/super.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index d0053b0284d8..6aec21f0b5d6 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_d_op) + 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..8d1abd7f3a6f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4663,6 +4663,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_node_inode; } +#if IS_ENABLED(CONFIG_UNICODE) + if (sb->s_encoding) + sb->s_d_op = &generic_ci_dentry_ops; +#endif + sb->s_root = d_make_root(root); /* allocate root dentry */ if (!sb->s_root) { err = -ENOMEM; -- 2.43.0