Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp572929rdh; Thu, 23 Nov 2023 11:53:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvQlpQshNlt+x+KAxwm7bz91ZyPkVaP8+STFyTD2KMOaPgXAR1G4TiTagtbSjK7LNIKgX9 X-Received: by 2002:a05:6808:23c3:b0:3a7:b4e8:563e with SMTP id bq3-20020a05680823c300b003a7b4e8563emr446785oib.38.1700769233191; Thu, 23 Nov 2023 11:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700769233; cv=none; d=google.com; s=arc-20160816; b=GxPlCVtVMzMDeM6VKgfQb/eOQYiQG7Mv+6hUwQxEiSj6+ZydIj0awE3Ut4jxdqwuR4 yxSXPHhDhwD49rh7YgUO63ENgApTUv8wJ+eFZEfPSc3OnX79094bmbEthFmNdRdIYP3a IG/omV9TSGwy8OHbCvSzsKQFwIEMNUvw86saigpC+nn2hZd0Z74fYFLdxLC3UD4GxS82 zxzkqbP2zE1ABal+lxMgGIH5F5VnoJbC4xwm0gV5/iZr4FR6xODG0t1ZB7+J9WNM//BT ty2fwWekxo1Ao8WNkd6Ks+3Pq5I925WD0z4JYBeVuV6vvmqiD4tskaDZhK5J8FvkFBqM jMyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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=dqAMuOipmlmjkedrTMrMYw6IQ27y72GpypxSjNpVMec=; fh=gxv0fCHfYwuzCqrYLAzXebLQ3ObLAcpwLwX6rCnNp28=; b=mOb5NPrhVL5WDTZ4Hx47nsrodVj2YvlS5EvCmrFH2kXQ8J5VmJg9yY7iEReMinENgF 3kLcSbX9OrtOpfdxAPYHdqZMFVLE4vI6HekmbCKaqQxP1hNQxxrp3nfnvL01hySZJSPE RgRg0fQaDG9ZTRow4tDc4hsgSorhp3u+C2dfOPJaiDIREs5IEgHv1D6DrdnN4ZpIgrdv CowWb3grh+5ZjT/3i4w6Y8CfXQFetjnb9JWe7kRw46AWkVr/Uqx5vFchWsBq3K49gxH0 S6t51fI9M2N6xEsgEVFOV6k+vdxLw64z4ljxsPM0frNXeS9uQ3xAA5rWzyeZVPiNsgDT FTHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=a2QncgnU; spf=pass (google.com: domain of linux-ext4+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p18-20020a634f52000000b005b5c68e2c92si1843228pgl.371.2023.11.23.11.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 11:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=a2QncgnU; spf=pass (google.com: domain of linux-ext4+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 180FDB212D9 for ; Thu, 23 Nov 2023 19:53:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E33F94D122; Thu, 23 Nov 2023 19:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="a2QncgnU" X-Original-To: linux-ext4@vger.kernel.org Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7820D9A; Thu, 23 Nov 2023 11:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dqAMuOipmlmjkedrTMrMYw6IQ27y72GpypxSjNpVMec=; b=a2QncgnUb6QJ1Lg5GgMVA+2T3/ fbNoKVoUugUVzcl9emA543J3GMHcNhnm+oCBdO+j36w8Ysf6RcjIRGYk8ImVYrVP6NTpC6pPk8Yfy ne4FO/7UHfFZQh3ZdS9FUageGdGYES9sh/7udHCFJmQ3qeUssJW+M1jt/WbkzSDuJZw74EONPufr0 8qecS/s8O3lCDY2qu9K8GlNYUNsehkx8PmzntcsDJvtos+abYityUdLWCHM/tjdfSSBaPldfUHiNj iG0QoeEfxs2RnQinORy9UydAqRtMS5T2sMUKNxto2pYOktOZqlUdoEBPaQgQS3JpvIF5AyZX5Xa/i WfrihlkQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r6FlP-002EPf-1m; Thu, 23 Nov 2023 19:53:27 +0000 Date: Thu, 23 Nov 2023 19:53:27 +0000 From: Al Viro To: Gabriel Krisman Bertazi Cc: Linus Torvalds , Christian Brauner , tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net, ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org, linux-ext4@vger.kernel.org Subject: Re: [f2fs-dev] [PATCH v6 0/9] Support negative dentries on case-insensitive ext4 and f2fs Message-ID: <20231123195327.GP38156@ZenIV> References: <20231025-selektiert-leibarzt-5d0070d85d93@brauner> <655a9634.630a0220.d50d7.5063SMTPIN_ADDED_BROKEN@mx.google.com> <20231120-nihilismus-verehren-f2b932b799e0@brauner> <20231121022734.GC38156@ZenIV> <20231122211901.GJ38156@ZenIV> <20231123171255.GN38156@ZenIV> <20231123182426.GO38156@ZenIV> <87bkbki91c.fsf@> 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: <87bkbki91c.fsf@> Sender: Al Viro On Thu, Nov 23, 2023 at 02:06:39PM -0500, Gabriel Krisman Bertazi wrote: > > A paragraph above you've said that it's not constant over the entire > > filesystem. > > The same ->d_op is used by every dentry in the filesystem if the superblock > has the casefold bit enabled, regardless of whether a specific inode is > casefolded or not. See generic_set_encrypted_ci_d_ops in my tree. It is > called unconditionally by ext4_lookup and only checks the superblock: > > void generic_set_encrypted_ci_d_ops(struct dentry *dentry) > { > if (dentry->d_sb->s_encoding) { > d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops); > return; > } > ... > > What I meant was that this used to be set once at sb->s_d_op, and > propagated during dentry allocation. Therefore, the propagation to the > alias would happen inside __d_alloc. Once we enabled fscrypt and > casefold to work together, sb->s_d_op is NULL Why? That's what I don't understand - if you really want it for all dentries on that filesystem, that's what ->s_d_op is for. If it is not, you have that problem, no matter which way you flip ->d_op value. > and we always set the same > handler for every dentry during lookup. Not every dentry goes through lookup - see upthread for details. > > Look, it's really simple - any setup work of that sort done in ->lookup() > > is either misplaced, or should be somehow transferred over to the alias > > if one gets picked. > > > > As for d_obtain_alias()... AFAICS, it's far more limited in what information > > it could access. It knows the inode, but it has no idea about the parent > > to be. > > Since it has the inode, d_obtain_alias has the superblock. I think that's all > we need for generic_set_encrypted_ci_d_ops. Huh? If it really depends only upon the superblock, just set it in ->s_d_op when you set the superblock up. Again, whatever setup you do for dentry in ->lookup(), you either * have a filesystem that never picks an existing directory alias (e.g. doesn't allow open-by-fhandle or has a very unusual implementation of related methods, like e.g. shmem), or * have that setup misplaced, in part that applies to all dentries out there (->s_d_op for universal ->d_op value, ->d_init() for uniform allocation of objects hanging from ->d_fsdata and other things like that), or * need to figure out how to transfer the result to alias (manually after d_splice_alias(), if races do not matter or using a new method explicitly for that), or * lose that state for aliases.