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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C4BC1C63697 for ; Tue, 17 Nov 2020 18:31:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CE5322240 for ; Tue, 17 Nov 2020 18:31:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="fAff5vQT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729514AbgKQSbU (ORCPT ); Tue, 17 Nov 2020 13:31:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:36706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgKQSbU (ORCPT ); Tue, 17 Nov 2020 13:31:20 -0500 Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 92D812222E; Tue, 17 Nov 2020 18:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605637879; bh=ao2XoyFvOst/o/NixL3wR1q1+HrjIW+xRos2auX+cis=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fAff5vQTLS6o1LdCvxQyE8canT3iWN4lhOjqOGcJvd1BEB21bCVXFSHoF5miY2Gel 79iEFHbzmxHaiCXtfzsJPMSKIhcmI/q+eODrQqe3gNsV6Hx+n0ZoUYbyeZyH63OkED kRJNByTFXR1CQLcQyIyq+lVu8j/Kdfzeo2frG81U= Date: Tue, 17 Nov 2020 10:31:17 -0800 From: Eric Biggers To: Daniel Rosenberg Cc: "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, Gabriel Krisman Bertazi , kernel-team@android.com Subject: Re: [PATCH v2 2/3] fscrypt: Have filesystems handle their d_ops Message-ID: References: <20201117040315.28548-1-drosen@google.com> <20201117040315.28548-3-drosen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201117040315.28548-3-drosen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Nov 17, 2020 at 04:03:14AM +0000, Daniel Rosenberg wrote: > diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h > index a8f7a43f031b..df2c66ca370e 100644 > --- a/include/linux/fscrypt.h > +++ b/include/linux/fscrypt.h > @@ -741,8 +741,9 @@ static inline int fscrypt_prepare_rename(struct inode *old_dir, > * directory's encryption key is available, then the lookup is assumed to be by > * plaintext name; otherwise, it is assumed to be by no-key name. > * > - * This also installs a custom ->d_revalidate() method which will invalidate the > - * dentry if it was created without the key and the key is later added. > + * After calling this function, a filesystem should ensure that its dentry > + * operations contain fscrypt_d_revalidate if DCACHE_ENCRYPTED_NAME was set, > + * so that the dentry can be invalidated if the key is later added. > * > * Return: 0 on success; -ENOENT if the directory's key is unavailable but the > * filename isn't a valid no-key name, so a negative dentry should be created; This should say DCACHE_NOKEY_NAME, not DCACHE_ENCRYPTED_NAME. But more importantly, the explanation here isn't very clear. How about the following instead: * This will set DCACHE_NOKEY_NAME on the dentry if the lookup is by no-key * name. In this case the filesystem must assign the dentry a dentry_operations * which contains fscrypt_d_revalidate (or contains a d_revalidate method that * calls fscrypt_d_revalidate), so that the dentry will be invalidated if the * directory's encryption key is later added.