From patchwork Mon Jan 29 03:31:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 193229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp340884dyb; Sun, 28 Jan 2024 19:32:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/HzXIAKvzkhAN9NCOH7/CFyEg33XEu7mXtBCBYBdqYn5s51i9kgz5tiqe+fhSEyoCArEl X-Received: by 2002:a05:6a20:4f1d:b0:199:9853:4950 with SMTP id gi29-20020a056a204f1d00b0019998534950mr4040203pzb.42.1706499128373; Sun, 28 Jan 2024 19:32:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706499128; cv=pass; d=google.com; s=arc-20160816; b=Op5KUE49Yt0/9VeJuQ98eoJWHw7p5ixyMZhUE5goEfy1Co0FUce6MHpbQN7jPjqXRL THp/owMhtwoSoatISNMcTQ5+dax/WrdvGAd2/yGW3YixwL4IG5qWr/MEAxIWQTMcUWht NKXtiTAoqbwYN+8QxpXtfjctqMN5kDTdvsCwIYyjCDaHhEbdMKNe2OfKEHcTai8GSz76 E4Dbqbin7upbqwC8t+MmQTH00XMRSIkhLyD+ztGD75oltRlXi64LBIBAwup1E+xnYmq6 viyc8/fn5oTVVhKk9sFbTjVG2W2YuokW395v/k6PRLWe312UmYgc9rF86/iqG3ElIujt peIw== 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:message-id:subject:cc:to:from :date; bh=py2VaF/ntZQH/A415B2OCpKmBwhqi5NDuZftMl5vlnw=; fh=BJjscmstiuwSmMpx+EuWwz/EH9XNPUTFyivEKBLydzI=; b=Vpjfw2qUi7GMMBgMMqlGv3Y2ASBtXb2SAHWoAPJAcHJDn6XO6r7TN9Q3MF4GeAIuzO 8M5CrKnzPhidQzG8dITwLmP6Aax1uGl4swV8vb+ww+IGuTq9DWTItrUw1N58Pvz98Yow dd86T11zmOOM2yiiWrenZtmTlBNt5v7CKidKtR/gQHBeM9B2wXyk+Y+vIdYmmxRhLNSJ QdJiJFzXO58a6j0D/n/YD9uVF32thh7YAsj7Yz5U46Yi5BeVj6Y/gRVpH4SYTyTpUoxz 1VKeewcxwrRL1Tdso/Aks1rKBvoqHWTb7M2ICzibuPB9WkzKRIduDegf5jkj+ysV5+zg TS3g== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-42129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42129-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q2-20020a170902edc200b001d76c46580esi4950632plk.516.2024.01.28.19.32.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 19:32:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-42129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42129-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2665028368D for ; Mon, 29 Jan 2024 03:32:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAFC411CBA; Mon, 29 Jan 2024 03:31:55 +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 43E2510949 for ; Mon, 29 Jan 2024 03:31:53 +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=1706499114; cv=none; b=GJnu1ieCpgVOiu22BZppXuIIMhPv63O+l6/uYkBNaz2G082XOxeD39DqjO45QgogoyrztP6GJtil2Dtf90PU4Oj47TrSK0G/PgyO/ajiqTNMzpwHnwCy9KvVpR8pFEumd1Pn57g/1KUjGOPO+CRH9PcHTiNvkPH+ret/GAo4af4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706499114; c=relaxed/simple; bh=IKXig95vKmdIC1I71WRDokmA4+6M3oYG4crRkE+z1j0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=H+g8eZ5D92d4BwWoQwhy/M3xmi/bi/zX7qccHhvbXbtQJxAWDpqc2gsCgxIanGAWhF8XNuAiHHaiEFXaAhjSW1574LXCGSq/P2YRKuaEUcqCxYdPhjz1b7X+dnzUl9hpjuJzHx2Qf0PybgeBQ/G8cCgxDOcrbUJ/ySlmMnPNwRU= 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 09C7AC433C7; Mon, 29 Jan 2024 03:31:52 +0000 (UTC) Date: Sun, 28 Jan 2024 22:31:51 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Masami Hiramatsu , Mathieu Desnoyers Subject: [GIT PULL] tracing: A couple of fixes for 6.8 Message-ID: <20240128223151.2dad6599@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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789394030044874172 X-GMAIL-MSGID: 1789394030044874172 Linus, tracing: Two small fixes for tracing and eventfs: - Fix register_snapshot_trigger() on allocation error If the snapshot fails to allocate, the register_snapshot_trigger() can still return success. If the call to tracing_alloc_snapshot_instance() returned anything but 0, it returned 0, but it should have been returning the error code from that allocation function. - Remove leftover code from tracefs doing a dentry walk on remount. The update_gid() function was called by the tracefs code on remount to update the gid of eventfs, but that is no longer the case, but that code wasn't deleted. Nothing calls it. Remove it. Please pull the latest trace-v6.8-rc1-2 tree, which can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v6.8-rc1-2 Tag SHA1: 4428da6214384c6eff60b4c8e481d58bd70ece96 Head SHA1: 29142dc92c37d3259a33aef15b03e6ee25b0d188 Linus Torvalds (1): tracefs: remove stale 'update_gid' code Masami Hiramatsu (Google) (1): tracing/trigger: Fix to return error if failed to alloc snapshot ---- fs/tracefs/event_inode.c | 38 ------------------------------------- fs/tracefs/internal.h | 1 - kernel/trace/trace_events_trigger.c | 6 ++++-- 3 files changed, 4 insertions(+), 41 deletions(-) --------------------------- diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 6b211522a13e..1c3dd0ad4660 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -281,44 +281,6 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode, inode->i_gid = attr->gid; } -static void update_gid(struct eventfs_inode *ei, kgid_t gid, int level) -{ - struct eventfs_inode *ei_child; - - /* at most we have events/system/event */ - if (WARN_ON_ONCE(level > 3)) - return; - - ei->attr.gid = gid; - - if (ei->entry_attrs) { - for (int i = 0; i < ei->nr_entries; i++) { - ei->entry_attrs[i].gid = gid; - } - } - - /* - * Only eventfs_inode with dentries are updated, make sure - * all eventfs_inodes are updated. If one of the children - * do not have a dentry, this function must traverse it. - */ - list_for_each_entry_srcu(ei_child, &ei->children, list, - srcu_read_lock_held(&eventfs_srcu)) { - if (!ei_child->dentry) - update_gid(ei_child, gid, level + 1); - } -} - -void eventfs_update_gid(struct dentry *dentry, kgid_t gid) -{ - struct eventfs_inode *ei = dentry->d_fsdata; - int idx; - - idx = srcu_read_lock(&eventfs_srcu); - update_gid(ei, gid, 0); - srcu_read_unlock(&eventfs_srcu, idx); -} - /** * create_file - create a file in the tracefs filesystem * @name: the name of the file to create. diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h index 45397df9bb65..91c2bf0b91d9 100644 --- a/fs/tracefs/internal.h +++ b/fs/tracefs/internal.h @@ -82,7 +82,6 @@ struct inode *tracefs_get_inode(struct super_block *sb); struct dentry *eventfs_start_creating(const char *name, struct dentry *parent); struct dentry *eventfs_failed_creating(struct dentry *dentry); struct dentry *eventfs_end_creating(struct dentry *dentry); -void eventfs_update_gid(struct dentry *dentry, kgid_t gid); void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry); #endif /* _TRACEFS_INTERNAL_H */ diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index 46439e3bcec4..b33c3861fbbb 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -1470,8 +1470,10 @@ register_snapshot_trigger(char *glob, struct event_trigger_data *data, struct trace_event_file *file) { - if (tracing_alloc_snapshot_instance(file->tr) != 0) - return 0; + int ret = tracing_alloc_snapshot_instance(file->tr); + + if (ret < 0) + return ret; return register_trigger(glob, data, file); }