Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7898641rdb; Thu, 4 Jan 2024 11:03:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9Dw4+VOSgY9O9+VOhUs5yXXzPUHrvh753Ly6m61YK2GAw1P4PQc2q/xfZVgs/yvppn+Oj X-Received: by 2002:a05:6808:41:b0:3bb:bd4d:5110 with SMTP id v1-20020a056808004100b003bbbd4d5110mr791397oic.40.1704395025200; Thu, 04 Jan 2024 11:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704395025; cv=none; d=google.com; s=arc-20160816; b=PIcz3qMCGdntRaxLprKiK9yYgsCKgLMjgxvAod0BVR4cVCfZUKVUXusWOM1ClLkhen x3wF4Lq4BQXacFGMce00DKEUK0b8ugBDVDa/o7gAoxSINeLdR/5JFujp0tsDLV3jAOr/ ajaelRVU+KgFvie7XPPVHL+X+c/QzKNbwOyS87J0DGEGRuAPze6vC0BXZLh7Rft4G2rJ 5JRrOtUS/hzEDAOIijf/uR7pvclmttHFbhA6pVNkYi2G6AYdvzPAgWavFKkn2v9e+Lbq 4gkBYH6deOqDsqjE+hy7xwMJ38m182C0p13HSNjZTPazvhVu0IInXtvGbceuEVTwHbiF ygUg== 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=Axy8b7yTVmlWQ3J02cuBqfZM28j68uaGpo9P0Q0lef8=; fh=gzrpMMTEDk1mfqC9jPx3qZyUSNsvBavCUw5QYiXCf9M=; b=0aX7eFJT4GAe3pDk93kvqTH/19aD5vlrKdsNTFj/va4ui3m/DQjy3GvjHmDzdLkqL0 R9I80sk2hoAaby9fAyM3QUU4eUFVm18TkkOCICXig5zqdnGJE5MD8HQxTexFCbwBlntt QdvfUKc73xQc1l1Nj0ie+ncthaQSAkpga4zi6oK9UUyuuyaQMI5tdqoFA4JiyQNP4w5N /5suww316ZouWLTSvp/6imxmjg24rZaRcfQlI4yhw23Y+ss+qSrScLIRXtv61eQoK4qN MJptx0Ws6H6IzKZizvkULLDPoC4IqFRSDTIHG7T7HWeJ1uFB32wTHNMxUTtJPP8tIsvw 0KQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FtpCyBrs; spf=pass (google.com: domain of linux-kernel+bounces-17121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17121-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b1-20020a67cb01000000b00466ef5cd24dsi7643vsl.338.2024.01.04.11.03.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 11:03:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FtpCyBrs; spf=pass (google.com: domain of linux-kernel+bounces-17121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17121-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E547C1C2237C for ; Thu, 4 Jan 2024 19:03:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C23852C188; Thu, 4 Jan 2024 19:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FtpCyBrs" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 CE0C32C681; Thu, 4 Jan 2024 19:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Axy8b7yTVmlWQ3J02cuBqfZM28j68uaGpo9P0Q0lef8=; b=FtpCyBrszIbomqrZcJVs3ACgAW jDaVkMzCrpfEduq46FlNmEmn4hXnLMFsBg/yqd/I5v90EiMxxbIRvhAsAGO8hx7whKKpzMCuKRodz jxPOoxGNXqudhGsrX2cazJQgtZvGc/TciQavrsTx1Lzu/lyrMeerdNTAVuCN92kx3/su0GhP7ZQ75 C2Bef3Q+0tphpjBh6MYfAkMKaAhxeo75tiwrJWrBx34n8WNX0Nsx81jvtHYYslD7MC0bVvBGcKEGC tC5ZaFwAoIj6g9b3ucxQrmVQlOssd64/r+DVgjxHN4M0Tze+MYcEQMZumo2yqVV8fsiFkHPQeOMUl U/6jHccQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rLSzw-00Fnxu-9n; Thu, 04 Jan 2024 19:03:20 +0000 Date: Thu, 4 Jan 2024 19:03:20 +0000 From: Matthew Wilcox To: Steven Rostedt Cc: Al Viro , LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Linus Torvalds , Christian Brauner , linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman , Jonathan Corbet , linux-doc@vger.kernel.org Subject: Re: [PATCH] tracefs/eventfs: Use root and instance inodes as default ownership Message-ID: References: <20240103203246.115732ec@gandalf.local.home> <20240104014837.GO1674809@ZenIV> <20240103212506.41432d12@gandalf.local.home> <20240104043945.GQ1674809@ZenIV> <20240104100544.593030e0@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240104100544.593030e0@gandalf.local.home> On Thu, Jan 04, 2024 at 10:05:44AM -0500, Steven Rostedt wrote: > > file_system_type: what filesystem instances belong to. Not quite the same > > thing as fs driver (one driver can provide several of those). Usually > > it's 1-to-1, but that's not required (e.g. NFS vs NFSv4, or ext[234], or...). > > I don't know the difference between NFS and NFSv4 as I just used whatever > was the latest. But I understand the ext[234] part. What Al's sying is that nfs.ko provides both nfs_fs_type and nfs4_fs_type. ext4.ko provides ext2_fs_type, ext3_fs_type and ext4_fs_type. This is allowed but anomalous. Most filesystems provide only one, eg ocfs2_fs_type. > > > > super_block: individual filesystem instance. Hosts dentry tree (connected or > > several disconnected parts - think NFSv4 or the state while trying to get > > a dentry by fhandle, etc.). > > I don't know how NFSv4 works, I'm only a user of it, I never actually > looked at the code. So that's not the best example, at least for me. Right, so NFS (v4 or otherwise) is Special. In the protocol, files are identified by a thing called an fhandle. This is (iirc) a 32-byte identifier which must persist across server reboot. Originally it was probably supposed to encode dev_t plus ino_t plus generation number. But you can do all kinds of things in the NFS protocol with an fhandle that you need a dentry for in Linux (like path walks). Unfortunately, clients can't be told "Hey, we've lost context, please rewalk" (which would have other problems anyway), so we need a way to find the dentry for an fhandle. I understand this very badly, but essentially we end up looking for canonical ones, and then creating isolated trees of dentries if we can't find them. Sometimes we then graft these isolated trees into the canonical spots if we end up connecting them through various filesystem activity. At least that's my understanding which probably contains several misunderstandings. > > Filesystem object contents belongs here; multiple hardlinks > > have different dentries and the same inode. > > So, can I assume that an inode could only have as many dentries as hard > links? I know directories are only allowed to have a single hard link. Is > that why they can only have a single dentry? There could be more. For example, I could open("A"); ln("A", "B"); open("B"); rm("A"); ln("B", "C"); open("C"); rm("B"). Now there are three dentries for this inode, its link count is currently one and never exceeded two. > Thanks for this overview. It was very useful, and something I think we > should add to kernel doc. I did read Documentation/filesystems/vfs.rst but > honestly, I think your writeup here is a better overview. Documentation/filesystems/locking.rst is often a better source, although the two should really be merged. Not for the faint-hearted.