Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3295044rdh; Mon, 27 Nov 2023 10:26:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYScO66/c2/PnloElRL+/TS5nFISMD0uQDotjBialew7rUBd+AYZydgxz51yGPTtVo+Gl2 X-Received: by 2002:a17:902:e807:b0:1cf:ee3a:23a0 with SMTP id u7-20020a170902e80700b001cfee3a23a0mr742020plg.6.1701109617006; Mon, 27 Nov 2023 10:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701109616; cv=none; d=google.com; s=arc-20160816; b=IU5wpvelLQaAhGlIPuduTVFHYV1lP8IjifxU7yIzF4/wExBHHqDaw/f3IeyO7HYkod tIp0f8lbf6/12LFBll2gqZV0exTVw91moSM8Y6i5rjLM5uxZO482kGguM8+nine1YpV/ bg/SfmQOwiRzjPTzUoXtiSJ67fLkKoGnVuUsPPj6aykesorb52LSsp6DA6xX3rRtDFh1 /4kmklLCYd44yl7q+Z7ngwumGebKvyFUBSmwXwBVCvvVYtZZ7m3AQN4R8I7/5/kiTeE/ VqSItH/+Iv+x7YK8nc5WaB1z/4Q9xWk4+ZJqwMprXNYHS0Wu4hyt/DnN1l0BEqP9TAAe P7pg== 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=CqEzkt+oM2IBi7Kij86HZ2Ewj2l3h5pTUsWNsGVn/48=; fh=gvFYJbBmf/2u7XpskHCXm1bGq0MLbIw0TqLqbBf2/nE=; b=cnob5/T224ctOwF+nCatMsPa5vAVz71BM7Iqw5g51mybSrq4nO+It+aISvCm3mc971 UrnG2B0FRdMe0l3UwverRcAJl22wZwpuQVyKx3RjQOHR1Lm4b5SNwO+FjbKswkypJKVJ 3VhfFP+1v6j1HGKRdBHAjBesfeQXGri7jrG2fEljWFeizpNUQBlbYK6ER116ennPrTT1 1EVa+29onN+gPcmBnn4wc8lVzuO+lEB7qUQG7DN0dd8Z5yNV8NSHnTuezDJNDfYtOb6Q 4cQ16tl/MWtnwc2cC3O9slr8Z/7l7IgbTD7QGY2F0mdvyDBWGyo7qSDiYvgdT09WaZ5Z JwSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=DjqTlj+s; spf=pass (google.com: domain of linux-ext4+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-207-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p18-20020a170902a41200b001bbd70bdffbsi9759889plq.440.2023.11.27.10.26.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 10:26:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=DjqTlj+s; spf=pass (google.com: domain of linux-ext4+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-207-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 9DD66B20B90 for ; Mon, 27 Nov 2023 18:26:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81B373DB90; Mon, 27 Nov 2023 18:26:36 +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="DjqTlj+s" 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 7DD3A198; Mon, 27 Nov 2023 10:26:32 -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=CqEzkt+oM2IBi7Kij86HZ2Ewj2l3h5pTUsWNsGVn/48=; b=DjqTlj+sgml0PJUhtui5FC3/wG wto1Q+ju6Bcqb5B+RH+X1NFFOpS8PWOJBjt9VUrwIIIKPkoHheM1jehn05BfUoGX8pAW5vM5KAV95 xWvKYhbdYx/B6LU/XhYT+1VHWuxzb+kQLowLtwtNrnOeZmqB1Kbk0ClkWwea1WRzPNQt9pxwv4ztl 6JYn4ZwxRZNuj6Ju2JFwkpaiRLsNaAXpvE2BhvLEGcbnU6uLAafpKDXmMsuGDKmu7jboPysvlUJTM KXgAzeRV+EX9JFvhCHR+GupMNOhECBakw2NKaZUIEHFGXW38cVx8DNMsOKuq0PUmVzrp9YlJOW3o4 T1sjZwLQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r7gJ9-0045ma-2o; Mon, 27 Nov 2023 18:26:11 +0000 Date: Mon, 27 Nov 2023 18:26:11 +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: <20231127182611.GA973514@ZenIV> References: <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> <878r6jnq1t.fsf@email.froward.int.ebiederm.org> <20231127172544.GJ38156@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: <20231127172544.GJ38156@ZenIV> Sender: Al Viro On Mon, Nov 27, 2023 at 05:25:44PM +0000, Al Viro wrote: > On Mon, Nov 27, 2023 at 10:01:34AM -0600, Eric W. Biederman wrote: > > "Eric W. Biederman" writes: > > > > > I am confused what is going on with ext4 and f2fs. I think they > > > are calling d_invalidate when all they need to call is d_drop. > > > > ext4 and f2f2 are buggy in how they call d_invalidate, if I am reading > > the code correctly. > > > > d_invalidate calls detach_mounts. > > > > detach_mounts relies on setting D_CANT_MOUNT on the top level dentry to > > prevent races with new mounts. > > > > ext4 and f2fs (in their case insensitive code) are calling d_invalidate > > before dont_mount has been called to set D_CANT_MOUNT. > > Not really - note that the place where we check cant_mount() is under > the lock on the mountpoint's inode, so anything inside ->unlink() or > ->rmdir() is indistinguishable from the places where we do dont_mount() > in vfs_{unlink,rmdir}. Said that, we could simply use d_drop() in those, since the caller will take care of mount eviction - we have ->unlink() or ->rmdir() returning success, after all. The same goes for xfs caller and for cifs_prime_dcache() (in the latter case we have just checked that they sucker is negative, so d_invalidate() and d_drop() are doing the same thing).