Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp602157rdb; Thu, 21 Dec 2023 21:58:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYdZgy4CAiugqEytAnqXAgCJL2DTQvAZG1doTtbJs6r+niWAvzV40bmT7NIvdwWIopKE5v X-Received: by 2002:a05:600c:512a:b0:407:3b6d:b561 with SMTP id o42-20020a05600c512a00b004073b6db561mr450027wms.9.1703224722808; Thu, 21 Dec 2023 21:58:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703224722; cv=none; d=google.com; s=arc-20160816; b=Jg0CQMuYZ9Ydq0xo5JmEvsvSe3zFzor5pBpQfWmiaiCeokHS1Zl5YJhlybZYKlRDRT XWrB6HFAwUR2Lwx8WyE6oZ1wVrctNbkb29WSUY8pwdtSRsEmpNDrm5hflKBXOy4y/cLW 49smtpPj9rygyRBMZjoomJ7/6Z9o6WLOVw6f8/+Z+lCCBTwZ1TinHJ5FR5I3rxs4/8hO 09sd1pgGyZ6g8OTeEB6wt7AHOpEEqOLjikROPmHcM54peVsNIxDV74HkQCijYwfvKEGZ 0xQ+RgPfJJimWjMGPQr+2H9zF8UhmNIAHhzr8DJLUzRn9Mfvpvu3ZYU7AjNqEY0qhH+R 7/GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pnG3YrkQCHQRlNg80p6QuZ0g78Rwjn2t5vCFn6fsSiA=; fh=ZDQqDzRdnI9v6wWJvJYRUSP5XSWQqM0oDrcdAJxjoZs=; b=j06DDDqTqJmwS1up0Qsmy+TN8mixyDTV2m9Nn5/9M4tUMec8ci88soM8FIJ9HvycaR r4a8snDStiCTfpEU867Mhc31CzNO59em446GDYP4EKVK+FcPmU8N44v5fKOH7eohs3KX rfR/HV3bwL7tnKlwe0AHN1k47AiVMdlgXun9EiKSlmwyUwLECIroYsBGXUYoZ84WT6S9 Vz8vZW7+bAu0jbWSJcZoGmGbeSGQDMwCn4y5ZpO9I6f8np/t/Mj6f58ri+VpQ0OxYRNo ui1Ue14KKjs4Ktj8E11k6qcpCpSbEXwjKA4sVer5Kjm61x4AKmQmQybkuxUvraUsKNq9 fo0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GQy7cwG1; spf=pass (google.com: domain of linux-ext4+bounces-542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gl17-20020a170906e0d100b00a23b64b555fsi1431361ejb.861.2023.12.21.21.58.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 21:58:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GQy7cwG1; spf=pass (google.com: domain of linux-ext4+bounces-542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 89C781F259ED for ; Fri, 22 Dec 2023 05:58:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 401DA63A4; Fri, 22 Dec 2023 05:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GQy7cwG1" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7DDC611B; Fri, 22 Dec 2023 05:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99CFFC433C8; Fri, 22 Dec 2023 05:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703224715; bh=koP/w5X1JGxFG62V66WQtMlBBjy2n7pRoumVVE4mK80=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GQy7cwG1M88/K4d1kfWky7jNIGI7tpT0spjp/jAvD4QZp16fVYGC9b1SZ2QKclslh Ku2WJTeg+6Fsa9rWOY0g7+z84e3sazJAIZxbMKPas3Omckh3RVzp337rdShFREn+xy 2BYpycRrCGrXOnEJUFK4ddmQ7W6rlm+E8vdh5AxqnGhVJmPKTPeRUCTbclKMvatjlb ePwzcXji3riCebA0kDYWjA7mk+DO9O44vDAd+GZr480nTlD4J503jBEpA8jnkBYRVe 9SqQzm+J9gU3vQ/VPwLpwE8Rsc7Cgg19XytcVkXbSlgKb9JXT/prBp/3BiRkepZOVv ZQS3xWLM2ciKg== Date: Thu, 21 Dec 2023 23:58:30 -0600 From: Eric Biggers To: Al Viro Cc: Gabriel Krisman Bertazi , jaegeuk@kernel.org, tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 8/8] fscrypt: Move d_revalidate configuration back into fscrypt Message-ID: <20231222055830.GA97172@quark.localdomain> References: <20231215211608.6449-1-krisman@suse.de> <20231215211608.6449-9-krisman@suse.de> <20231221073940.GC1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231221073940.GC1674809@ZenIV> On Thu, Dec 21, 2023 at 07:39:40AM +0000, Al Viro wrote: > Hmm... Could we simply set ->s_d_op to &fscrypt_dentry_ops in non-ci case > *AND* have __fscrypt_prepare_lookup() clear DCACHE_OP_REVALIDATE in case > when it's not setting DCACHE_NOKEY_NAME and ->d_op->d_revalidate is > equal to fscrypt_d_revalidate? I mean, > > spin_lock(&dentry->d_lock); > if (fname->is_nokey_name) > dentry->d_flags |= DCACHE_NOKEY_NAME; > else if (dentry->d_flags & DCACHE_OP_REVALIDATE && > dentry->d_op->d_revalidate == fscrypt_d_revalidate) > dentry->d_flags &= ~DCACHE_OP_REVALIDATE; > spin_unlock(&dentry->d_lock); > > here + always set ->s_d_op for ext4 and friends (conditional upon > the CONFIG_UNICODE). > > No encryption - fine, you get ->is_nokey_name false from the very > beginning, DCACHE_OP_REVALIDATE is cleared and VFS won't ever call > ->d_revalidate(); not even the first time. > > Yes, you pay minimal price in dentry_unlink_inode() when we hit > if (dentry->d_op && dentry->d_op->d_iput) > and bugger off after the second fetch instead of the first one. > I would be quite surprised if it turns out to be measurable, > but if it is, we can always add DCACHE_OP_IPUT to flags. > Similar for ->d_op->d_release (called in the end of > __dentry_kill()). Again, that only makes sense if we get > a measurable overhead from that. fscrypt_prepare_lookup() handles unencrypted directories inline, without calling __fscrypt_prepare_lookup() which is only for encrypted directories. So the logic to clear DCACHE_OP_REVALIDATE would need to be there too. - Eric