From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF355C432C0 for ; Tue, 3 Dec 2019 19:42:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBC59206DF for ; Tue, 3 Dec 2019 19:42:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbfLCTmQ (ORCPT ); Tue, 3 Dec 2019 14:42:16 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:36132 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbfLCTmQ (ORCPT ); Tue, 3 Dec 2019 14:42:16 -0500 Received: from localhost (unknown [IPv6:2610:98:8005::647]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 6C9562909E7; Tue, 3 Dec 2019 19:42:14 +0000 (GMT) From: Gabriel Krisman Bertazi To: Gao Xiang Cc: Daniel Rosenberg , Theodore Ts'o , , Jaegeuk Kim , Chao Yu , , Eric Biggers , , Alexander Viro , Andreas Dilger , Jonathan Corbet , , , , Subject: Re: [PATCH 4/8] vfs: Fold casefolding into vfs Organization: Collabora References: <20191203051049.44573-1-drosen@google.com> <20191203051049.44573-5-drosen@google.com> <20191203074154.GA216261@architecture4> Date: Tue, 03 Dec 2019 14:42:10 -0500 In-Reply-To: <20191203074154.GA216261@architecture4> (Gao Xiang's message of "Tue, 3 Dec 2019 15:41:54 +0800") Message-ID: <85wobdb3hp.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Gao Xiang writes: > On Mon, Dec 02, 2019 at 09:10:45PM -0800, Daniel Rosenberg wrote: >> Ext4 and F2fs are both using casefolding, and they, along with any other >> filesystem that adds the feature, will be using identical dentry_ops. >> Additionally, those dentry ops interfere with the dentry_ops required >> for fscrypt once we add support for casefolding and encryption. >> Moving this into the vfs removes code duplication as well as the >> complication with encryption. >> >> Currently this is pretty close to just moving the existing f2fs/ext4 >> code up a level into the vfs, although there is a lot of room for >> improvement now. >> >> Signed-off-by: Daniel Rosenberg > > I'm afraid that such vfs modification is unneeded. > > Just a quick glance it seems just can be replaced by introducing some > .d_cmp, .d_hash helpers (or with little modification) and most non-Android > emulated storage files are not casefolded (even in Android). > > "those dentry ops interfere with the dentry_ops required for fscrypt", > I don't think it's a real diffculty and it could be done with some > better approach instead. It would be good to avoid dentry_ops in general for these cases. It doesn't just interfere with fscrypt, but also overlayfs and others. The difficulty is that it is not trivial to change dentry_ops after dentries are already installed in the dcache. Which means that it is hard to use different dentry_ops for different parts of the filesystem, for instance when converting a directory to case-insensitive or back to case-sensitive. In fact, currently and for case-insensitive at least, we install generic hooks for the entire case-insensitive filesystem and use it even for !IS_CASEFOLDED() directories. This breaks overlayfs even if we don't have a single IS_CASEFOLDED() directory at all, just by having the superblock flag, we *must* set the dentry_ops, which already breaks overlayfs. I think Daniel's approach of moving this into VFS is the simplest way to actually solve the issue, instead of extending and duplicating a lot of functionality into filesystem hooks to support the possible mixes of case-insensitive, overlayfs and fscrypt. -- Gabriel Krisman Bertazi