From mboxrd@z Thu Jan 1 00:00:00 1970 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 D0AB62DF9F; Tue, 20 Feb 2024 21:35:41 +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=1708464941; cv=none; b=S/R8xuGnu/fZcPjK9P7Ta45HuKxt9xgJV++IT91Qt+dtVF/M+IecBblRoEW4aP3qRG9FbWd2hERcTTLsRd2gC9SsaGjn2dK34knYr4demWxtmS4E2kUT1nyfHjS0D8W2VAYMh7GaMrQw5R6uI6H6VMvXFdI9WHKjDj+8lu9tpQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708464941; c=relaxed/simple; bh=W6rmOA917gY/cZqlGrIecFA+p5fTAvI13zBDh3NX83w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gdj++0qddvI8jGkj8WpCSsOiBU110albZGP+59ZUb5O4rkTeObV6BQeX58n2hOKs3nbF8QiNZy7qaX1GLxf1V+zD5LQqC5bqNeiLz0gU5eQE7Y3rv7w5E1vWQYXz0AqbWwzmel0bxRwBLgE45GOIfdIKfdzOVPGoZ4GvL7dNj58= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yKLqWpI4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yKLqWpI4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45AF5C433F1; Tue, 20 Feb 2024 21:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708464941; bh=W6rmOA917gY/cZqlGrIecFA+p5fTAvI13zBDh3NX83w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yKLqWpI4xKArm3Zvbe5YIJdYQjY78TbVlfpUQcrKiTSuFaHpQ0EDKhepcyK096fZ0 6gKssfODnSw3ig2w9kzO4/OFVKnvirp/8Fr1oQ9PULWdH07HzxeyjznkCekmO7T3ym xSSWcg/nNDIY/tkLdHYBKA5R21hd0mQ7GLvR1bJU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Christian Brauner , Al Viro , Ajay Kaher , Linus Torvalds , "Steven Rostedt (Google)" Subject: [PATCH 6.7 185/309] eventfs: Have the inodes all for files and directories all be the same Date: Tue, 20 Feb 2024 21:55:44 +0100 Message-ID: <20240220205638.941333667@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240220205633.096363225@linuxfoundation.org> References: <20240220205633.096363225@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Steven Rostedt (Google)" commit 53c41052ba3121761e6f62a813961164532a214f upstream. The dentries and inodes are created in the readdir for the sole purpose of getting a consistent inode number. Linus stated that is unnecessary, and that all inodes can have the same inode number. For a virtual file system they are pretty meaningless. Instead use a single unique inode number for all files and one for all directories. Link: https://lore.kernel.org/all/20240116133753.2808d45e@gandalf.local.home/ Link: https://lore.kernel.org/linux-trace-kernel/20240116211353.412180363@goodmis.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Christian Brauner Cc: Al Viro Cc: Ajay Kaher Suggested-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- fs/tracefs/event_inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -32,6 +32,10 @@ */ static DEFINE_MUTEX(eventfs_mutex); +/* Choose something "unique" ;-) */ +#define EVENTFS_FILE_INODE_INO 0x12c4e37 +#define EVENTFS_DIR_INODE_INO 0x134b2f5 + /* * The eventfs_inode (ei) itself is protected by SRCU. It is released from * its parent's list and will have is_freed set (under eventfs_mutex). @@ -314,6 +318,9 @@ static struct dentry *create_file(const inode->i_fop = fop; inode->i_private = data; + /* All files will have the same inode number */ + inode->i_ino = EVENTFS_FILE_INODE_INO; + ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; d_instantiate(dentry, inode); @@ -350,6 +357,9 @@ static struct dentry *create_dir(struct inode->i_op = &eventfs_root_dir_inode_operations; inode->i_fop = &eventfs_file_operations; + /* All directories will have the same inode number */ + inode->i_ino = EVENTFS_DIR_INODE_INO; + ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE;