Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7907773rdb; Thu, 4 Jan 2024 11:21:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkLMPCOF80OL98IW58GrN5DXFZV6YAPOEdllnTCR84f+Tc662WWElefgP3cCWewfYwVq+a X-Received: by 2002:a0d:e486:0:b0:5eb:199:6251 with SMTP id n128-20020a0de486000000b005eb01996251mr901699ywe.82.1704396110303; Thu, 04 Jan 2024 11:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704396110; cv=none; d=google.com; s=arc-20160816; b=iSkOTN6+HfdRAKMNmy+CihOQxkBOqUrzNRYMbzK6TYl6XR9J+TK3g0/s64a2bQ8jMc 8G+AQqHs77+Ccssgg4DPJfPW+CNb2XbcoKny1Vg/qKp43rFZh/b0wF4Md8/EaYQN667X Bf3FKYHjiTR/A19jlB9El3qJQm3dOCggsiK0VNKpw0M78XoPIfPCZXCHaH/GAD7ICq3v Ius2QV5aR+1tgYhiJTBbLcE7El4CIsaJFGGMzdcnoPJW3OwioiYYmqXbdZiRrPC/nYcp 6B+1zFZW/FOX8NIaxVDHn42RJKut91kge1lGp2bl3Q8dg+zu1sPY6Rr+Rd4Z/zAikDAU 9sfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=v4MuqzTE/G+T5VrqGABwUELReNnh9TwctX30WQtzQOw=; fh=HF2lR5CWTP5/hM0HOa1oftVSm7g/W7TpRrdzx61ArpY=; b=M6HPkrVhcs2bpxxVEjvTsZybNhPG2Mbdbk0G6UgoFwqinbqel8X7GsK6c4k76+7FSo 2LRqbQoV5mHHN+1joP1YF3BlvC5Jx3Xo7IghCGh0HIpjXKGi71wYpjdAZPJ/ozW+GB3e 76EE8hy6oH3EJYXAlPxsEjtMHXLoRDjHOaQbv9U8Gz+cuvdTFYarxOEv+9G2qrcJC5xv IEEbQ5C6Q8V8iry+Ra0DXrFkH1/q7GqdWPOX2ru1BcX7MMuSJnZUtLoRAFZZpUtmitWH 62cAR7Fd776aVogCB/I8s2Ku53ArPqSCJHeFfeoo6Oe1srjdEi9USqEIevYY86yvaUb+ /SFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EdnZzLUC; spf=pass (google.com: domain of linux-kernel+bounces-17150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17150-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 e20-20020a0ce3d4000000b00680b1539bdcsi73270qvl.551.2024.01.04.11.21.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 11:21:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17150-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=@linux-foundation.org header.s=google header.b=EdnZzLUC; spf=pass (google.com: domain of linux-kernel+bounces-17150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17150-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 E0E4A1C22380 for ; Thu, 4 Jan 2024 19:21:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2FDB2C1AA; Thu, 4 Jan 2024 19:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="EdnZzLUC" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37F822C19A for ; Thu, 4 Jan 2024 19:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55590da560dso1039659a12.0 for ; Thu, 04 Jan 2024 11:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1704396098; x=1705000898; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v4MuqzTE/G+T5VrqGABwUELReNnh9TwctX30WQtzQOw=; b=EdnZzLUClgs4ur/8y5FP6tRq02qyWaY5N72vXNV5I9U8bZ/7bKHZvSDwGX01jA1NAz Z/8Dmh9QysgWpFAHjEiv5MnGR2GQbMzilbKtSJTGsR7mqwKBGTHr7a88sJ40n+4iPQSr xtIwlHn98rsYx9laJRh++951DYO2BbepN1hGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704396098; x=1705000898; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v4MuqzTE/G+T5VrqGABwUELReNnh9TwctX30WQtzQOw=; b=uJSTT4YXAtWo7O+eS7ryLdK5Aroa+hrfqMShKwPXMX1HCuyYJztj6aK7CQ0vzbPFTU I1jPsJlQz44B0snL2OwFNjnQOvIsg7kpK5ChLuCbouKzkZIbPpwqs/QdpDu6q4CQeW3Z Ra5W03PeqRGguZKeWXEU0mWcbapuKL6uRlXM7CJP22JoaekOk7vIIYeE+PZmvDB5dOJT 9TvcuPa7iZXImDrWzbqECHCDZ05J60/EGaFV6G+EBCJvZSXg0lxdu+vQR7om4+6lQ8SL VMz1Ajvbqm6Ar5zz/sHLK1lTYZojezPHLZf4biskCiQW7vdhKegkATXEb64mou2MQpsM UBOA== X-Gm-Message-State: AOJu0Yzssa/Er2baKmp+6vngMosxVaRNMOW2GpSVelTSNrc4VyEKkOpj 7245QHcFP+aseto1RPRiKMgA2GyBKUjmcdvQtx2lVQR9vgBkFDLw X-Received: by 2002:a17:907:765b:b0:a27:440e:50ee with SMTP id kj27-20020a170907765b00b00a27440e50eemr548971ejc.57.1704396098069; Thu, 04 Jan 2024 11:21:38 -0800 (PST) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com. [209.85.218.42]) by smtp.gmail.com with ESMTPSA id mz14-20020a1709071b8e00b00a27a17543d2sm6138674ejc.170.2024.01.04.11.21.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jan 2024 11:21:37 -0800 (PST) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a28b2e1a13fso100518566b.3 for ; Thu, 04 Jan 2024 11:21:37 -0800 (PST) X-Received: by 2002:a17:906:ee86:b0:a28:fb5:4389 with SMTP id wt6-20020a170906ee8600b00a280fb54389mr705009ejb.0.1704396097273; Thu, 04 Jan 2024 11:21:37 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240103203246.115732ec@gandalf.local.home> <20240104014837.GO1674809@ZenIV> <20240103212506.41432d12@gandalf.local.home> <20240104043945.GQ1674809@ZenIV> <20240104100544.593030e0@gandalf.local.home> <20240104182502.GR1674809@ZenIV> <20240104141017.4cd8451f@gandalf.local.home> In-Reply-To: <20240104141017.4cd8451f@gandalf.local.home> From: Linus Torvalds Date: Thu, 4 Jan 2024 11:21:20 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] tracefs/eventfs: Use root and instance inodes as default ownership To: Steven Rostedt Cc: Al Viro , LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Christian Brauner , linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman , Jonathan Corbet , linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Thu, 4 Jan 2024 at 11:09, Steven Rostedt wrote: > > My mistake was thinking that the dentry was attached more to the path than > the inode. But that doesn't seem to be the case. I wasn't sure if there was > a way to get to a dentry from the inode. Yeah, so dentry->inode and path->dentry are one-way translations, because the other way can have multiple different cases. IOW, a path will specify *one* dentry, and a dentry will specily *one* inode, but one inode can be associated with multiple dentries, and there may be other undiscovered dentries that *would* point to it but aren't even cached right now. And a single dentry can be part of multiple paths, thanks to bind mounts. The "inode->i_dentry" list is *not* a way to look up all dentries, because - as mentioned - there may be potential other paths (and thus other dentries) that lead to the same inode that just haven't been looked up yet (or that have already been aged out of the cache). Of course any *particular* filesystem may not have hard links (so one inode has only one possible dentry), and you may not have bind mounts, and it might be one of the virtual filesystems where everything is always in memory, so none of the above problems are guaranteed to be the case in any *particular* situation. But it's all part of why the dcache is actually really subtle. It's not just the RCU lookup rules and the specialized locking (both reflock and the rather complicated rules about d_lock ordering), it's also that whole "yeah, the filesystem only sees a 'dentry', but because of bind mounts the vfs layer actually does things internally in terms of 'struct path' in order to be able to then show that single fiolesystem in multiple places". Etc etc. There's a reason Al Viro ends up owning the dcache. Nobody else can wrap their tiny little minds around it all. Linus