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, 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 795ABC63798 for ; Sun, 22 Nov 2020 05:13:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 186B920885 for ; Sun, 22 Nov 2020 05:13:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LNX7N2c6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbgKVFMl (ORCPT ); Sun, 22 Nov 2020 00:12:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40439 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbgKVFMj (ORCPT ); Sun, 22 Nov 2020 00:12:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606021958; 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=kkf8a6qy5yhhSG9mvfioRD8ySsdwKXfzz3BkGnvDRY4=; b=LNX7N2c6WjQeuGNKPFqXgYx78pr1YQDkbmySPne2IYAj6zJ8omkhZ7tIMwZgy4fnw7Iszc /+z+dhbP966WtRX90uW1YqG3ucn1F6k9CEAKPWGNevtQxhctn8xA2pg1AgdaisHBXq27bt yJyhIn3JiFwKsNndIg3OUp6E7oFL20g= 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-351-fkQdgrWGNyiB5YpHNCYFrA-1; Sun, 22 Nov 2020 00:12:34 -0500 X-MC-Unique: fkQdgrWGNyiB5YpHNCYFrA-1 Received: by mail-pg1-f198.google.com with SMTP id i7so4885297pgn.22 for ; Sat, 21 Nov 2020 21:12:34 -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=kkf8a6qy5yhhSG9mvfioRD8ySsdwKXfzz3BkGnvDRY4=; b=dLxRPsYqG4lTTJaPvwtp5EVQGUj1U3w2ZFQrMU8UrvVdGF7HJTLN33L+EDvW8hOwpu Ne+r5Oi40jQNr79pAZo3mNN1oBcaqbZ0N/ot/kvmA85N+NQjDrGgCu1N+OzTOW+/7m2U ZtrE5e5ZOlVAmbBnuC9WsaEENuLqtgSR/HTYW8UB0652uLdeu4ws8X5eEekGbcMXRzVC 7et+aB9Hzs153JO78ZgcU4Fsst1zzA1pA3KZ7l6EkKTG4/Al5PlmVhb9ByHjjhHaF5fF ULs4t9kLjxhHHtopy6MmgB+38mjp351vUkYEsF/QbOlNW0zWDANnjj2Sr2fIZgmHeLJC 4hGw== X-Gm-Message-State: AOAM530TBm5zGIN5AOn74CKOJlJXpq9aSOamlpjbDTGNW5ngWLu8b718 BwUtJF8Cs8pwKV5BDY8hSCJalZXeLd2xY+82CBqy7OP7y6a40U7VJIIGA9GODeeFGB0WszNphEt LbABjqCgjqwI4a2NaUlMaybOVAQ== X-Received: by 2002:a63:4513:: with SMTP id s19mr22764173pga.254.1606021953659; Sat, 21 Nov 2020 21:12:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhkBDDpVzvwVvP6QvR7b7bk5JCtZ4ytNenw2ZosC6tbrjTUa7xakgrk4oLyDhCHqqDiw3bXw== X-Received: by 2002:a63:4513:: with SMTP id s19mr22764154pga.254.1606021953454; Sat, 21 Nov 2020 21:12:33 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id b21sm9346038pji.24.2020.11.21.21.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2020 21:12:33 -0800 (PST) Date: Sun, 22 Nov 2020 13:12:18 +0800 From: Gao Xiang To: Daniel Rosenberg Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , Eric Biggers , 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, Gabriel Krisman Bertazi , kernel-team@android.com, Eric Biggers Subject: Re: [PATCH v4 2/3] fscrypt: Have filesystems handle their d_ops Message-ID: <20201122051218.GA2717478@xiangao.remote.csb> References: <20201119060904.463807-1-drosen@google.com> <20201119060904.463807-3-drosen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201119060904.463807-3-drosen@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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. Thanks, Gao Xiang