Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp64199rdb; Sun, 28 Jan 2024 14:01:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3Fc0W7agTSy93eSMpTsB6/IBLmrVLNgaLNfuMNbEdYqx5DgjCiTpK4EDOU6NsICluTiAf X-Received: by 2002:a17:90a:f3c5:b0:295:2e07:58f3 with SMTP id ha5-20020a17090af3c500b002952e0758f3mr631634pjb.47.1706479301517; Sun, 28 Jan 2024 14:01:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706479301; cv=pass; d=google.com; s=arc-20160816; b=yaiFcr+xY91Z1ESAmQ0byxdo215kHcnD6RA6laZ0e8nwBRvIa2Fx6T4uvwFCwD6JdF pKdBlZHjUK95N0ArEtz+xiK6Mr7GGWVy9/MX3eY0W/VBx7ZoFBW+VkhW80FOKxMNGrLe jeJSiJ/MCRKcaOjrqMOF2kLN7oe4D3orNArzymQdBfL2FUX9d4EQvCIq9/g8uRdb0Gf9 Yj3mZIyqr7SUvkTeqyVEPvpzHKD9t8ohuj4Z5mHWK9sweXoxBHKjFfrNgdYRdV70hzUh TK1vqgJ77ud1uS+ICnGKhRUqTsQBrZhTnyiKX6SWDifZ6bxYD8l9nBtGsKexCKJ3JLdm 4K4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=zKWQcn5Ora+5/NgLUj4Jlu0SOU/Exw22rXDRzmbnC0I=; fh=+NHEOwOI8sgHa/emZ3nIKC4IhKoRFLn6O7wLrfs7tlM=; b=cwgjrcqicW/HArEEsxNXwmn9vr0Z9eh/0AIFiXf1wuXwHNVbBRrb9Cr6EpDStPK2l0 LtQ5+0kskyk6kvTyZx5P5hsJapM/XG2/fL8sc9LRJ4EHWbqhSkxGPedGb1rUF8aLdf0w Q+bhlfJKnagHSUd/Ml+DQSXPVKgeF9i1xxWVkFt4hA3wTiX5uzm5wDevmtBQOelxc1qY 1ZZ09E5sDqJcMg4s4f/kZHtR1cFCDcz4y/yP25/b3Cp57+Lsm2Wo/YPIqeyDgYkUpPxN nW5XzNEBJfp+E8bxeHL2MI/XTtQ3s0lG0s/SArewxHtr5u/fOIJwcKiOY1AmYnlZVt0k u4pw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-41977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41977-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t14-20020a17090aae0e00b002903baea439si4590040pjq.109.2024.01.28.14.01.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:01:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-41977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41977-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 309B5282CCB for ; Sun, 28 Jan 2024 22:01:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86A9C3C490; Sun, 28 Jan 2024 22:01:30 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 00BEF3C461; Sun, 28 Jan 2024 22:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706479290; cv=none; b=D+Hu7hKEsSvEyBmtS01VN5C2kksNyhUsU2IzEGxAhr/NSHCgdtA2cLXo/onFkmtDmt1tCkKm84F6+xR4KBlxuVAH5opD5HUNhyMSIis2o5jtrG+SQuiMx79W93qn2MIH5ISiXMOpGe2h1cHsWWS5f8EuyaGEW5nDIrmAFlICAFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706479290; c=relaxed/simple; bh=ssQbheLqlmCPZsjWzxOefn+0xp44vjzjY+8m+zuL42w=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FYAgmmthmfzIuiEzbTyQvtoBnCp+RcwpjvWZzSgsiXv9D9/XcOoonKKkTI2dpXyl36+QOkl3jcJ04Mjq61+Adjb4nVy2/ySf7ZGBR3tsio8gi521zSR9hV2pC5FLjSDwRom611l6dtMHvTJ8KAtaMzajEsK+Uwr5fhwFgyvDn54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03E89C433F1; Sun, 28 Jan 2024 22:01:27 +0000 (UTC) Date: Sun, 28 Jan 2024 17:01:25 -0500 From: Steven Rostedt To: Linus Torvalds Cc: Masami Hiramatsu , Mathieu Desnoyers , LKML , Linux Trace Devel , Christian Brauner , Ajay Kaher , Geert Uytterhoeven , linux-fsdevel Subject: Re: [PATCH] eventfs: Have inodes have unique inode numbers Message-ID: <20240128170125.7d51aa8f@rorschach.local.home> In-Reply-To: References: <20240126150209.367ff402@gandalf.local.home> <20240126162626.31d90da9@gandalf.local.home> <20240128151542.6efa2118@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Sun, 28 Jan 2024 13:08:55 -0800 Linus Torvalds wrote: > On Sun, 28 Jan 2024 at 12:53, Linus Torvalds > wrote: > > > > Now, the RCU delay may be needed if the lookup of said structure > > happens under RCU, but no, saying "I use SRCU to make sure the > > lifetime is at least X" is just broken. > > Put another way, the only reason for any RCU should be that you don't > use locking at lookup, and the normal lookup routine should follow a > pattern something like this: > > rcu_read_lock(); > entry = find_entry(...); > if (entry && !atomic_inc_not_zero(&entry->refcount)) > entry = NULL; > rcu_read_unlock(); > > and the freeing should basically follow a pattern like > > if (atomic_dec_and_test(&entry->refcount)) > rcu_free(entry); Basically you are saying that when the ei is created, it should have a ref count of 1. If the lookup happens and does the atomic_inc_not_zero() it will only increment if the ref count is not 0 (which is basically equivalent to is_freed). And then we can have deletion of the object happen in both where the caller (kprobes) deletes the directory and in the final iput() reference (can I use iput and not the d_release()?), that it does the same as well. Where whatever sees the refcount of zero calls rcu_free? -- Steve