From patchwork Tue Feb 6 12:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1496657dyb; Tue, 6 Feb 2024 04:18:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTpb9/8cs2UDJGmtDo8W/GUkHZCwlU5/xuqh+SgrrA8HraNnLmlN+rKNahoTm0q+UXR0vO X-Received: by 2002:a05:620a:b8b:b0:785:59fa:9b38 with SMTP id k11-20020a05620a0b8b00b0078559fa9b38mr12302707qkh.3.1707221918748; Tue, 06 Feb 2024 04:18:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707221918; cv=pass; d=google.com; s=arc-20160816; b=MC3wOxnGmPoN+f026hXJyH/JOxYm+L80E+uLsd9c0rBhogFSlxWrHudu2EQNMfk6wF llkaYXX2W5JzIaEcT8PJPorxEe4PAosYpedRVQVv36i7Xhbj3//1Ph1zqyxxQUUi7TVD JptpH842Ar3JZFNNi5TVTlpj2AOaB6VN8jh7wKQVRbhOFfZY8xJMbz3dagwsucpO3cDv ir/AGvMmHfHNaPA13z2jHszyUqRiaqdtseHMEtSUGOAvMMUm5Ck99hOp2PFIbJUFfTvn A+BPR6B+wvTRNE5NLF+ThScR4/ZXOS4YR3XqivAmi7kzfcQG95MXUmY9A7/GFSn3G4XL GkNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=cuxUpn7P+XyYdAXWckL1D93jFQg/Q4qoJ+VPSLKM9A0=; fh=pGM5mbbJHVTzlcxldXfgWfeR+WrQIlFGE/IkCpXja5s=; b=hG/mXk8gvEAG2e/JQc3J3k3K6rNLmtu30KOUbw1hGrxQuFBbeuwn1ef5SrHrwplv8C jBRi0h4BNDD7KLxMc3OmUTfIhcB+QnTXU59ReFsSQkvafBJskzcNV8wuLfY0drmOE0nV wuuQlo3gB8CPGpwbiHynNLiDUat+JUBVTZM0m2i+7YpO4d3NsMIjsabgknwoGARa59Hy h5ld4vDFzGki7vLkXCEOn+cd/P7J9PfmEJpB2UQolDcef41Qjhl+sl03UuoAPoBtsCf2 9l5J/Zoje/AjEA593OTwCuIzZohlwrENJaaGb1smoDy4J9hx+n3MvZybjfKm84McCP/Y 4mkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54884-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54884-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVcQLdzQ3QQUufBBlYjmqrnA0jAjVbxyPUkD8Ae4l7tKvorwM2mBLmq2Yc1qOX4CUtr98gSy8DFlU2Rzad1CXB0EQ03TA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w19-20020ae9e513000000b0078545ce745fsi2021389qkf.326.2024.02.06.04.18.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:18:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54884-ouuuleilei=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; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54884-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54884-ouuuleilei=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 870791C24036 for ; Tue, 6 Feb 2024 12:18:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F97F13B281; Tue, 6 Feb 2024 12:09:25 +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 C691A1353F6; Tue, 6 Feb 2024 12:09:19 +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=1707221359; cv=none; b=j10sjl/smn0N9a0Dq5uXHp7TIP2NIxB5SuimRFe73cwtsQoifQzV2qw2zkIBgG1H2luZXCWxbxcVgW9IE/vJL52q9CNA30Ly5sanN3uIU1uiWgxFsU/lLEJCeBQlkRwAIFJu1pe23k13JLVg1p7rHrXSZ8WkfMPB0WU61+GyNIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221359; c=relaxed/simple; bh=rJbSuvhtLipDc17VpOUCoHRbi16A8mbSZ9ZCLhURrio=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=nC/NKnTaV3MMCJa0VmLVPtN/TU1X9gdWosO9wEtfwUOd+HYTnI+AP1DVmtt5dmpHX9dkwhA0D460Mdb9Ddw7CYUpvonUbon9RT5AwDxsJQPgph1gW5VvaEhqidC86PAfgjxHg3Ncymw7H4VjQiKvLZ7qZuKTBFbCMCDRv9tNPJw= 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 57C93C43394; Tue, 6 Feb 2024 12:09:19 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGp-00000006b5L-3Rzc; Tue, 06 Feb 2024 07:09:47 -0500 Message-ID: <20240206120947.686070579@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:13 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , kernel test robot Subject: [v6.6][PATCH 08/57] eventfs: Use eventfs_remove_events_dir() References: <20240206120905.570408983@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790151930756993753 X-GMAIL-MSGID: 1790151930756993753 From: "Steven Rostedt (Google)" The update to removing the eventfs_file changed the way the events top level directory was handled. Instead of returning a dentry, it now returns the eventfs_inode. In this changed, the removing of the events top level directory is not much different than removing any of the other directories. Because of this, the removal just called eventfs_remove_dir() instead of eventfs_remove_events_dir(). Although eventfs_remove_dir() does the clean up, it misses out on the dget() of the ei->dentry done in eventfs_create_events_dir(). It makes more sense to match eventfs_create_events_dir() with a specific function eventfs_remove_events_dir() and this specific function can then perform the dput() to the dentry that had the dget() when it was created. Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310051743.y9EobbUr-lkp@intel.com/ Signed-off-by: Steven Rostedt (Google) (cherry picked from commit 2819f23ac12ce93ff79ca7a54597df9a4a1f6331) --- fs/tracefs/event_inode.c | 19 +++++++------------ include/linux/tracefs.h | 1 + kernel/trace/trace_events.c | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index eab18b157ef5..1ccd100bc565 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -901,22 +901,17 @@ void eventfs_remove_dir(struct eventfs_inode *ei) } /** - * eventfs_remove_events_dir - remove eventfs dir or file from list - * @dentry: events's dentry to be removed. + * eventfs_remove_events_dir - remove the top level eventfs directory + * @ei: the event_inode returned by eventfs_create_events_dir(). * - * This function remove events main directory + * This function removes the events main directory */ -void eventfs_remove_events_dir(struct dentry *dentry) +void eventfs_remove_events_dir(struct eventfs_inode *ei) { - struct tracefs_inode *ti; - - if (!dentry || !dentry->d_inode) - return; + struct dentry *dentry = ei->dentry; - ti = get_tracefs(dentry->d_inode); - if (!ti || !(ti->flags & TRACEFS_EVENT_INODE)) - return; + eventfs_remove_dir(ei); - d_invalidate(dentry); + /* Matches the dget() from eventfs_create_events_dir() */ dput(dentry); } diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h index 0c39704455d9..13359b1a35d1 100644 --- a/include/linux/tracefs.h +++ b/include/linux/tracefs.h @@ -41,6 +41,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode const struct eventfs_entry *entries, int size, void *data); +void eventfs_remove_events_dir(struct eventfs_inode *ei); void eventfs_remove_dir(struct eventfs_inode *ei); struct dentry *tracefs_create_file(const char *name, umode_t mode, diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 6595317c3830..697163f8f670 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -3893,7 +3893,7 @@ int event_trace_del_tracer(struct trace_array *tr) down_write(&trace_event_sem); __trace_remove_event_dirs(tr); - eventfs_remove_dir(tr->event_dir); + eventfs_remove_events_dir(tr->event_dir); up_write(&trace_event_sem); tr->event_dir = NULL;