Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3178933rdh; Mon, 27 Nov 2023 08:03:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxj5h74H+9xKApWXVF6SRHq01jddZSpcCEkvg+OcaAM2rXLvXLCuoUpRGT6VNRudBvJcSX X-Received: by 2002:a05:600c:45cf:b0:408:3ac4:dc3f with SMTP id s15-20020a05600c45cf00b004083ac4dc3fmr8340944wmo.29.1701101032478; Mon, 27 Nov 2023 08:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701101032; cv=none; d=google.com; s=arc-20160816; b=xKZ6PmVFG3MU3duSSlQiU96E4xcUyUrWT4trZIyYB4KMW2v5KpLmjFMqAqthAofYzC 1nLy7OteqGa953URxuRrno9ciizIEW0fLmkwbvFMePTbZb/ZmTHmob7Uyv1rNGEMnhER 8q1cnMeCSWQgv01EPCwqsfqOWbtLPjUSLcodf+qtXloyYV+IUNb2H6+G++Duf+pIEZ4d 296iem6jdqewfrpOp9t06l2roschJXoK1duthfvWTFUWPM4SPaF65aDp2V6NlRpbzM0x Nncfvk2ssOJwnubt2j0l0CM9nQaXJmbexHOQpv7mn4ybDO0GAz+jXTGII38EAjMuJ8s5 jVEw== 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=WADlmt0rPTmLzYraJFSvoEJCh9ofuPI7Y7W8RJprDbQ=; fh=gvFYJbBmf/2u7XpskHCXm1bGq0MLbIw0TqLqbBf2/nE=; b=R0MzTqILE2ne8/z9ltKqbBIOUe+c5NpxOcObU5baWPDpHJ+lrxH6J0UumrlSmqJuAq dOWCGf8psKK2ePvLc8vLS7WVOMoIcfzYlrUlNgal8rvCb1RmOlHX20FFKwYyRdQSbLyc pQxzvzxSkJcbm+H0h+CbvigTeQj3a73dN7ixHPqhnB2ee7c0DIABRsQfYt45YLJ9po+t nEJxQPFURExhaYCZRqSPpoq0FHo5DotHj6VLEnZsdLF0HwJ696lD6cIVPJrS+DQ0tWXD dNlEY+BbEwdVShaO+kIilTHR1uXDuKAbpfg6jiIdmQ7OedltpG2f6gZVzwAPsX5KszL3 oS0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Akrn0yg6; spf=pass (google.com: domain of linux-ext4+bounces-198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-198-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t21-20020a05600c2ad500b0040a46a61658si5945987wme.214.2023.11.27.08.03.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 08:03:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Akrn0yg6; spf=pass (google.com: domain of linux-ext4+bounces-198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-198-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C40FA1C209EC for ; Mon, 27 Nov 2023 16:03:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95A1D35883; Mon, 27 Nov 2023 16:03:45 +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="Akrn0yg6" 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 DA24ECE; Mon, 27 Nov 2023 08:03:40 -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=WADlmt0rPTmLzYraJFSvoEJCh9ofuPI7Y7W8RJprDbQ=; b=Akrn0yg6UNfIbJGcGj1gbFDffH QIiDenv6JZ2RDn2pjA3OeCYK75MjVSpT4f2X6lA/UZKayOJUfNFTOyOqNWjJzMvRwrBNZcEsgt0/J jD6Zfk0Woz1EEiCu7CFCexbj37ld5f/45w9CVV6O2VycoKwHfXou96aq/2M5/GBNMC9cCcMMkVXhe 7XSB7xEOXzp6paAz/XeQihFCiS9dOcIRw41n0mjMSS5hE5s0PwUs1zMVYSYlu4ofsbG0cxgd3XZUN aX18iCmp3A46c0raVJMvy813mkyebxJz9qOFukVDVQcXgOuMPDcooXx9aQd0ADW3mgYc1+kCLit3j UN3GesQQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r7e4s-0042ow-0w; Mon, 27 Nov 2023 16:03:18 +0000 Date: Mon, 27 Nov 2023 16:03:18 +0000 From: Al Viro To: "Eric W. Biederman" Cc: Gabriel Krisman Bertazi , 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, Miklos Szeredi Subject: Re: fun with d_invalidate() vs. d_splice_alias() was Re: [f2fs-dev] [PATCH v6 0/9] Support negative dentries on case-insensitive ext4 and f2fs Message-ID: <20231127160318.GI38156@ZenIV> References: <20231122211901.GJ38156@ZenIV> <20231123171255.GN38156@ZenIV> <20231123182426.GO38156@ZenIV> <20231123215234.GQ38156@ZenIV> <20231125220136.GB38156@ZenIV> <20231126045219.GD38156@ZenIV> <20231126184141.GF38156@ZenIV> <20231127063842.GG38156@ZenIV> <87jzq3nqos.fsf@email.froward.int.ebiederm.org> 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: <87jzq3nqos.fsf@email.froward.int.ebiederm.org> Sender: Al Viro On Mon, Nov 27, 2023 at 09:47:47AM -0600, Eric W. Biederman wrote: > There is a lot going on there. I remember one of the relevant > restrictions was marking dentries dont_mount, and inodes S_DEAD > in unlink and rmdir. > > But even without out that marking if d_invalidate is called > from d_revalidate the inode and all of it's dentries must be > dead because the inode is stale and most go. There should > be no resurrecting it at that point. > > I suspect the most fruitful way to think of the d_invalidate vs > d_splice_alias races is an unlink vs rename race. > > I don't think the mechanism matters, but deeply and fundamentally > if we detect a directory inode is dead we need to stick with > that decision and not attempt to resurrect it with d_splice_alias. Wrong. Deeply and fundamentally we detect a dentry that does not match the directory contents according to the server. For example, due to rename done on server. With object in question perfectly alive there - fhandle still works, etc. However, it's no longer where it used to be. And we would bloody better not have lookups for the old name result in access to that object. We also should never allow the access to *new* name lead to two live dentries for the same directory inode. Again, this is not about rmdir() or unlink() - invalidation can happen for object that is still open, still accessed and still very much alive. Does that all the time for any filesystem with ->d_revalidate().