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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 7306DC56202 for ; Tue, 24 Nov 2020 02:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7C21206F9 for ; Tue, 24 Nov 2020 02:09:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SJijZ7Ez" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728007AbgKXCIp (ORCPT ); Mon, 23 Nov 2020 21:08:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20634 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbgKXCIo (ORCPT ); Mon, 23 Nov 2020 21:08:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606183722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=SJijZ7EzXcr1BWrAHhxtUQ6N0w7uorsqNwlhJd6WG9m9i9Fl0uWvBemFHwG9aZIWwzf4ea wfUmZlhmeJtZxtJuRx3oRO/rtg3OzzqAQJkmSiTCqcClZKPQ3T74oV/VAwQ8OmPlldFJLw 8bdZK1daCfE6cljhREd/OVn2TzQSKSw= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-V9eqWlW-MVqsdDXk3WnjEQ-1; Mon, 23 Nov 2020 21:08:40 -0500 X-MC-Unique: V9eqWlW-MVqsdDXk3WnjEQ-1 Received: by mail-pf1-f199.google.com with SMTP id 9so14423322pfn.5 for ; Mon, 23 Nov 2020 18:08:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=Axjt44VNMC2Ah8HOJMzaOJvOaUTVetdgad4jfObwTDZ91E+BfjiykUE7akId3bTg0Z GcrG2GLhcGBXl42HMeO49oDOCKI4nmAx4jdhzsUlEzIh00mChgr7fDHv2bY5WitTRmUk cKK9mTlAHHPa9tDXNYrzGpgoE7jVgnFCRGp8NEsdLac+Ugy+kmlfm/jAYKWHJw7rM6+F mGV3jgXgZAat8lmzj8eFL59IPo/ZMHei3SBKybocPkKBGmb/2qrad6ZxD5ObUt4RvdVz rVLX8QVK+xgoXxwS887EnzghsRurL28hlM2E9u9yoY0q88cqQL2WJk51KGp0oip2xAPY HnMg== X-Gm-Message-State: AOAM533wbVJFhENNoJ2qV8jHnaFgWgEzOz2CALFTfT7oWCo/AnSZ8DNX yr63flgmm4yW/ACfTVeqNa7CE6v/xif5p/UMUuQ+mYT1GMFQPuusU2cmYulS5is811Mdw79yLLx esJ/6OOcKgJ/HQHnIyTD6+Znc+w== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986832plk.78.1606183718984; Mon, 23 Nov 2020 18:08:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5+igtPET/Dt98T/kKfa/91YJzxneE9zETKp3qe+D1ZXJ/z5cODpK8Yh/f0wMZsyQSBVZxXw== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986811plk.78.1606183718720; Mon, 23 Nov 2020 18:08:38 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y3sm723148pjb.18.2020.11.23.18.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 18:08:38 -0800 (PST) Date: Tue, 24 Nov 2020 10:08:24 +0800 From: Gao Xiang To: Eric Biggers Cc: Gabriel Krisman Bertazi , 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 Message-ID: <20201124020824.GA3156301@xiangao.remote.csb> References: <20201119060904.463807-1-drosen@google.com> <20201119060904.463807-3-drosen@google.com> <20201122051218.GA2717478@xiangao.remote.csb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org On Mon, Nov 23, 2020 at 02:51:44PM -0800, Eric Biggers wrote: > 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? 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. But what if all child > dentries (which must be negative) are invalidated first, 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")? >From my limited knowledge about VFS, I think that is practical as well, since we don't have sub-sub-dirs since all sub-dirs are negative dentries for empty dirs. And if casefold ioctl is "dir inode locked", I think that would be fine (?) I don't check the code though. Thanks, Gao Xiang > > - Eric > 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=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 32E9CC2D0E4 for ; Tue, 24 Nov 2020 02:09:02 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A29B206E0 for ; Tue, 24 Nov 2020 02:09:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="YapD0ICp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="MPtioyDd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Omzawp4L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A29B206E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1khNlL-0003pT-S8; Tue, 24 Nov 2020 02:08:59 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khNlK-0003pF-Lk for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Nov 2020 02:08:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=YapD0ICpY8DoN5dfiwOFHdcf46 p90FfcxjE/fWtZbJDADIgq7gf+R7v7tuH3buZos3sJ/3ixlaumkN8NSeAWubB+iEKgLitp7RD8JuM fSXQrfW/FvAnxbINHO4qmF5bHx6coUS/8P6FNFquY+LqQXtbMDtaPdSNj52GO5t9ceKc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=MPtioyDdRYjF8hG4+yKtD+rGA6 XKnA24N2OwsW0FhYHxavvfQGLDPNsgunhCRBkca3sKC32LCOhBeVB+EV0f0Kltpk3kSj27GIMJeJd Hf8UzOqQMz/fGGqB4N3MCaP5RNabbwSwfkOL5u9YUv0zo/l6clIDBBLZI9gvp0LxkqBM=; Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) (Exim 4.92.2) id 1khNlC-001UhF-8l for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Nov 2020 02:08:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606183723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=Omzawp4LBQTOXb60gMvuoqPxw/4QckbL9RH0+Rq+hns94CW9t6fz89GtjFtg7Y95W7g+8L 3I8ZbTT/n9WLAIspF/GP0SJp595Uq06uk+gQDGNBbx6THYMbL4zamGj6Veq4nF/iFWviPL 2DY4fXcsVsZ1XSRG+GMX9jOQ3wc24x0= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-x53TKN2qNfayMx51y5QUqw-1; Mon, 23 Nov 2020 21:08:40 -0500 X-MC-Unique: x53TKN2qNfayMx51y5QUqw-1 Received: by mail-pf1-f199.google.com with SMTP id u3so14294263pfm.22 for ; Mon, 23 Nov 2020 18:08:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=Ex5V50iCw2q7GhLSr/0WYep1tLnr3cVCXiNsF/5lc4tyfw+Cgv2/SZDf+gkrKIDALh s2OwwUcDmhC9AXd+TWM6dypUptqf4VZ4Hi8GiY2c6c6IsYXTB0xxA5Ar0r33SSxIrF55 ncEd0wfdAxuXt7y+PItIsbZ8YTKOKfDfYdMWkwPP7tlR5QRu3Uz3mWCavmLRz2+1KPT2 vnm6gc1Tfe71tU1yFcFmo/vzGloC8xTkQnHvxmBUhRB9TjB0EE48Dv+unuQJgq8DYcKa sObesfgYrd5q9e7J+i3/nfN6Kr3gXO/z+EI4wm3qKHkoQJUFXU16aeBsGvkpDZEV/9Xu 707Q== X-Gm-Message-State: AOAM531s4nnX8RG+PVyELOUtcjNeAdsDwzVcicxIhkZ1rqhSWeGjbsY6 jn5oEYd1RuiPxaam4cBLVkngw8qEcRFNg72/0iehwwczAlrtBLqaHh6WyvEZLECTRWy9cz6HSxX VJKgFFktkjSU/yZomD67Dh/92w/QKwEK51zwg/g== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986829plk.78.1606183718983; Mon, 23 Nov 2020 18:08:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5+igtPET/Dt98T/kKfa/91YJzxneE9zETKp3qe+D1ZXJ/z5cODpK8Yh/f0wMZsyQSBVZxXw== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986811plk.78.1606183718720; Mon, 23 Nov 2020 18:08:38 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y3sm723148pjb.18.2020.11.23.18.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 18:08:38 -0800 (PST) Date: Tue, 24 Nov 2020 10:08:24 +0800 From: Gao Xiang To: Eric Biggers Message-ID: <20201124020824.GA3156301@xiangao.remote.csb> References: <20201119060904.463807-1-drosen@google.com> <20201119060904.463807-3-drosen@google.com> <20201122051218.GA2717478@xiangao.remote.csb> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hsiangkao@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Headers-End: 1khNlC-001UhF-8l Subject: Re: [f2fs-dev] [PATCH v4 2/3] fscrypt: Have filesystems handle their d_ops X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, "Theodore Y . Ts'o" , Daniel Rosenberg , Richard Weinberger , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, Andreas Dilger , Alexander Viro , linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Mon, Nov 23, 2020 at 02:51:44PM -0800, Eric Biggers wrote: > 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? 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. But what if all child > dentries (which must be negative) are invalidated first, 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")? >From my limited knowledge about VFS, I think that is practical as well, since we don't have sub-sub-dirs since all sub-dirs are negative dentries for empty dirs. And if casefold ioctl is "dir inode locked", I think that would be fine (?) I don't check the code though. Thanks, Gao Xiang > > - Eric > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 35008C63697 for ; Tue, 24 Nov 2020 02:09:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B26DD20732 for ; Tue, 24 Nov 2020 02:09:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ajAhihQU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SJijZ7Ez" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B26DD20732 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7jLh7yS0KeLV93j13EB7DDBPnT+4erBo4rL+4XexmM0=; b=ajAhihQUTURkHWkfe5fdPELxu rcdZu21CSPclnxpCqViaE0ySdlMoHQEnRXt++wTvzZZP2BO/deY2gf2pGdGtNlaYP8fde0eHE0UV1 uOiZhIQXTkhtaxaJJQzgdggKllNuUcnUwHBuoNNqz8a7/LR1R2JHHrKNfEPve5q+5g970X8ZiV542 kUvFFGOlOwB9YenlTPo9GBx98wq1WmJ40RKfbR5Au1ScWJqKs55rSi5rzrulzBkPm2oUsZ+vY1dum rIMLVxNqjjqU+IaBfUs787o5wiDxiw7M3itHj0BfbTQHHdcyBKxIrHtYicOUahVGon/5IMVt0mA5L 34IG+Cefg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khNlA-0003or-4S; Tue, 24 Nov 2020 02:08:48 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khNl6-0003l6-3R for linux-mtd@lists.infradead.org; Tue, 24 Nov 2020 02:08:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606183722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=SJijZ7EzXcr1BWrAHhxtUQ6N0w7uorsqNwlhJd6WG9m9i9Fl0uWvBemFHwG9aZIWwzf4ea wfUmZlhmeJtZxtJuRx3oRO/rtg3OzzqAQJkmSiTCqcClZKPQ3T74oV/VAwQ8OmPlldFJLw 8bdZK1daCfE6cljhREd/OVn2TzQSKSw= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-58_-JPwgMKqfmjyOSrCklQ-1; Mon, 23 Nov 2020 21:08:40 -0500 X-MC-Unique: 58_-JPwgMKqfmjyOSrCklQ-1 Received: by mail-pg1-f198.google.com with SMTP id i67so13944294pgc.3 for ; Mon, 23 Nov 2020 18:08:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WP+31OsU+5g/aMu0W36G+ShW7+TjC+8Wfm0ANAD2BDg=; b=U+7IDk1jL0eV5i3UM9iP5opTJWktCcmE5pnhNjQ9wYriXzCfv6KFlZZ/91pFEBFy/F pXeIcGKmAo0bbspENCwSVSvAMM1MwC6GQfQ/KhPd8k5upE4mPA/Hq8/3c9mWTRSADnEz KMVXuRrRbZnYAKWbympP91OnXxbjCWpoLB73bHWLJtiScZTfDa3/e1KJQW9SSaa2pPWV /DD0NKYmK7hXxnPfh8HZnv+U0ou5F6sFKVRJBQPjPxwA2il+nNw5jsk1z2J6iL2civv4 EPCBKcUT06+6C6H/4gtLCtMfBJ7iWuWgXzeXKNpdhoTLz/1FA74GyKnNYMQoUVRHTM9x CELQ== X-Gm-Message-State: AOAM533P00AmStHm0K5X7ZGwgBUxygayDKHaeC0wPH1SNRLpBoUXMIJK DXLtzmhDIJpDXE/ccuMulQxsIsOebwkHPdp6aj4pT2iiR8rE6juTPMf2e2Gx6vYjZaYmpHy2q4l Cu83jmj/S5JQFq1vsAu7CKHJyEA== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986828plk.78.1606183718983; Mon, 23 Nov 2020 18:08:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5+igtPET/Dt98T/kKfa/91YJzxneE9zETKp3qe+D1ZXJ/z5cODpK8Yh/f0wMZsyQSBVZxXw== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr1986811plk.78.1606183718720; Mon, 23 Nov 2020 18:08:38 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y3sm723148pjb.18.2020.11.23.18.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 18:08:38 -0800 (PST) Date: Tue, 24 Nov 2020 10:08:24 +0800 From: Gao Xiang To: Eric Biggers Subject: Re: [PATCH v4 2/3] fscrypt: Have filesystems handle their d_ops Message-ID: <20201124020824.GA3156301@xiangao.remote.csb> References: <20201119060904.463807-1-drosen@google.com> <20201119060904.463807-3-drosen@google.com> <20201122051218.GA2717478@xiangao.remote.csb> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hsiangkao@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_210844_578845_B3D7E97E X-CRM114-Status: GOOD ( 31.59 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, "Theodore Y . Ts'o" , Daniel Rosenberg , Richard Weinberger , Chao Yu , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, Andreas Dilger , Alexander Viro , linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, Nov 23, 2020 at 02:51:44PM -0800, Eric Biggers wrote: > 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? 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. But what if all child > dentries (which must be negative) are invalidated first, 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")? >From my limited knowledge about VFS, I think that is practical as well, since we don't have sub-sub-dirs since all sub-dirs are negative dentries for empty dirs. And if casefold ioctl is "dir inode locked", I think that would be fine (?) I don't check the code though. Thanks, Gao Xiang > > - Eric > ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/