Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1379109pxu; Mon, 23 Nov 2020 21:02:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoonaU1jKOjExCl7Dqrj4gefsgfLzxXVZAcgBuiyESLxyQhXqb7WtbxgjHcSR2NiHEfZN9 X-Received: by 2002:a05:6402:a53:: with SMTP id bt19mr2329357edb.26.1606194128874; Mon, 23 Nov 2020 21:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606194128; cv=none; d=google.com; s=arc-20160816; b=i8d7mTDa6LUAysolHsM55Yn0CFSUgb2w9lJqmL8mGeEvYLWd89PS2yAjFd+cOSIqXS CDJ6TeDCs5NhNWxVGRuEfaz6igUd3ySylQmZaYnWrBDo8r8qg5uEYKBVBVxeQIKCCnqW cnZ1+ekzliYiq6NrkBDm5Jzw+zFY3YEFPbmQ73cA4ugaeqX6mwTHobCcdHoI+altYKhH FfvIAXVUFPiLx0azaMEptxrB/0kSRItHHm3n9JEio0vqTpDWUSLi2BORzUobtPgbHhY7 cQyvYSEEFpGkl5BuNVdNhkF+kKpbrdXle6HNcPdK337jiGOA6bftX4vQVZRnn7h7dHnn GsNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=rx4OAu0r0wOEIPTUaL/toHZDV0s39zidE2jJpUJLhhE=; b=IM3wOBRXrqR+zNha6jv824I90Q4mOBf6cN3D9izsXSpoKGcTtYg7tk0PVi6lMZW5D0 IHiR3eWT7rge/ApT1sM+cHb0gBsKCexnLpUYIE++RJH3/KoJQ02xThpUuLgMK5dP/Rx4 mpHpgMSiXaJHNy4MfF82Z+cbKbuWdKfFNCjXnm7OtzdFOHFHhDV9c/cu+MwiQdactnnQ 7386wMa6Z/Pwlkgyu+CYXy9KpbVDBwJT+1C7JRdTCSRcbELn967q/Ral6qaLJ1OSpi0y 2opkPlsxwTu53+ZApUFNa8wjHVPRHLoHj0B5Xxpbpf6DcwA95HSHH2zgZZvSfYPWMGgv +rAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si7672200ejf.662.2020.11.23.21.01.40; Mon, 23 Nov 2020 21:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729220AbgKXEhv (ORCPT + 99 others); Mon, 23 Nov 2020 23:37:51 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42594 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729212AbgKXEhv (ORCPT ); Mon, 23 Nov 2020 23:37:51 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id D57A11F4481C From: Gabriel Krisman Bertazi To: Eric Biggers Cc: Gao Xiang , Daniel Rosenberg , "Theodore Y . Ts'o" , Jaegeuk Kim , Andreas Dilger , Chao Yu , Alexander Viro , Richard Weinberger , linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v4 2/3] fscrypt: Have filesystems handle their d_ops Organization: Collabora References: <20201119060904.463807-1-drosen@google.com> <20201119060904.463807-3-drosen@google.com> <20201122051218.GA2717478@xiangao.remote.csb> Date: Mon, 23 Nov 2020 23:37:45 -0500 In-Reply-To: (Eric Biggers's message of "Mon, 23 Nov 2020 14:51:44 -0800") Message-ID: <877dqbpdye.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Eric Biggers writes: > On Sun, Nov 22, 2020 at 01:12:18PM +0800, Gao Xiang wrote: >> Hi all, >> >> On Thu, Nov 19, 2020 at 06:09:03AM +0000, Daniel Rosenberg wrote: >> > This shifts the responsibility of setting up dentry operations from >> > fscrypt to the individual filesystems, allowing them to have their own >> > operations while still setting fscrypt's d_revalidate as appropriate. >> > >> > Most filesystems can just use generic_set_encrypted_ci_d_ops, unless >> > they have their own specific dentry operations as well. That operation >> > will set the minimal d_ops required under the circumstances. >> > >> > Since the fscrypt d_ops are set later on, we must set all d_ops there, >> > since we cannot adjust those later on. This should not result in any >> > change in behavior. >> > >> > Signed-off-by: Daniel Rosenberg >> > Acked-by: Eric Biggers >> > --- >> >> ... >> >> > extern const struct file_operations ext4_dir_operations; >> > >> > -#ifdef CONFIG_UNICODE >> > -extern const struct dentry_operations ext4_dentry_ops; >> > -#endif >> > - >> > /* file.c */ >> > extern const struct inode_operations ext4_file_inode_operations; >> > extern const struct file_operations ext4_file_operations; >> > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c >> > index 33509266f5a0..12a417ff5648 100644 >> > --- a/fs/ext4/namei.c >> > +++ b/fs/ext4/namei.c >> > @@ -1614,6 +1614,7 @@ 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); >> >> One thing might be worth noticing is that currently overlayfs might >> not work properly when dentry->d_sb->s_encoding is set even only some >> subdirs are CI-enabled but the others not, see generic_set_encrypted_ci_d_ops(), >> ovl_mount_dir_noesc => ovl_dentry_weird() >> >> For more details, see: >> https://android-review.googlesource.com/c/device/linaro/hikey/+/1483316/2#message-2e1f6ab0010a3e35e7d8effea73f60341f84ee4d >> >> Just found it by chance (and not sure if it's vital for now), and >> a kind reminder about this. >> > > Yes, overlayfs doesn't work on ext4 or f2fs filesystems that have the casefold > feature enabled, regardless of which directories are actually using casefolding. > This is an existing limitation which was previously discussed, e.g. at > https://lkml.kernel.org/linux-ext4/CAOQ4uxgPXBazE-g2v=T_vOvnr_f0ZHyKYZ4wvn7A3ePatZrhnQ@mail.gmail.com/T/#u > and > https://lkml.kernel.org/linux-ext4/20191203051049.44573-1-drosen@google.com/T/#u. > > Gabriel and Daniel, is one of you still looking into fixing this? Eric, overlayfs+CI has been on my todo list for over a year now, as I have a customer who wants to mix them, but I haven't been able to get to it. I'm sure I won't be able to get to it until mid next year, so if anyone wants to tackle it, feel free to do it. > IIUC, the current thinking is that when the casefolding flag is set on > a directory, it's too late to assign dentry_operations at that point. yes > But what if all child dentries (which must be negative) are > invalidated first, I recall I tried this approach when I quickly looked over this last year, but my limited vfs knowledge prevented me from getting something working. But it makes sense. > and also the filesystem forbids setting the casefold flag on encrypted > directories that are accessed via a no-key name (so that > fscrypt_d_revalidate isn't needed -- i.e. the directory would only go > from "no d_ops" to "generic_ci_dentry_ops", not from > "generic_encrypted_dentry_ops" to "generic_encrypted_ci_dentry_ops")? -- Gabriel Krisman Bertazi