From patchwork Mon Jan 29 03:25:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 193225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp339166dyb; Sun, 28 Jan 2024 19:26:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQmXiQlUayK9ysXl2WzGVtEWh7sSebqTam8HEJ9e/R1n2WnJ2dZjCS8grC0YbHILXtmRMg X-Received: by 2002:a05:6a20:9746:b0:19c:3264:ab14 with SMTP id hs6-20020a056a20974600b0019c3264ab14mr1418261pzc.88.1706498761156; Sun, 28 Jan 2024 19:26:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706498761; cv=pass; d=google.com; s=arc-20160816; b=AsoFYVStv3uW6zqxjYIkuaJdI29u27qoOI9/fV6z8M5xphLbpgRHSXDPNtEYx8lwNM Ki7unNvvIzksAIcENEz6kcFhqYGk0minWi2gfAHCN4nnRafahXBi0fWTm79dSDEe685L GFgsbMgF/TwFyFXNmNxCVEuHuJEtZT9Kq7j3BMctaJPqAZYDhPEKDtNfGsKQaGZ0iFyx H0yjNRbV9fqYbugp1c3pecdvb6dtV4rB9bGDnOMPERtvt6GuTfs9ed69EXUXCYxyhQBF 2Z63+BShdr7yjc+D91FTwSD+QVjfI2/Q8+k1Q1FyJcJv8SQ274gk6MDe6szOGBDaVC3N ruZw== 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=C8Mkqo6c2Cnjr2L/vLU69dubljUlsOu1hx7EDWxT+N8=; fh=wn/f0npRntf/1qPHj3DhENCC5pRYeDAcLQmtsL4jAE0=; b=NknUPzlontu0I9gzctu4hzyEFA09QDezY8YlZVIkuSLb849tFe2Gg2kJHsr91+/wc3 I4+Srvo3JSv6vgFEWWw9nshUcN+JwaYoqtN8rOr7O73kC73N6gALf+ZSFUHa97XeX/MM aoYIKlX8ako5GaTx97+rx0bNtMz46YFpy12V2K/jIFrTUcEaCT2Z7BFk+zoi+qOLBroP 3c0RcZhvcZ5kBRj0DAv3l7zkNUvJosmS/Da8FFaqGS8CrogWiiWPwAdzmhWSj3ypytJy QYMnQ6SfCaWDIAAWXkUVob5wE3SSXScInOw/Mn2qm1cj+GBmkS3/rzNPESSk2ydLGwsv xeYg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-42123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42123-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y1-20020a17090322c100b001d74eb88097si5087217plg.219.2024.01.28.19.26.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 19:26:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42123-ouuuleilei=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-42123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42123-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 D6611283969 for ; Mon, 29 Jan 2024 03:26:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA05017991; Mon, 29 Jan 2024 03:25: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 5B34EFC0E; Mon, 29 Jan 2024 03:25:24 +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=1706498724; cv=none; b=XCveUON2mFMM5MdkN15eYBc0LWQLhoOypGmznd4F3g5lwBuPbOCLICh0XwV4MKo0y0vCapxFmdSYXcJMzMnMLGDHY4pFcSigHewGcv5pQOra2wwju6W8WHVGLyW9w/KHYsznsUjvs4M0TsYJt3hMf0E9wcUsafdz3kf4iV9m+yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706498724; c=relaxed/simple; bh=cQZnw0XY6CFlQ+Z4GEoHFMmClO2ao+MY79xo8Dq099I=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=GbLg7nsnyR2N9+ugBriWUXmmwIkee3IoVUH5jJ2Cl7wLzWTgWGYzpjLCG98ZlNxTS3Qwdyzx5dv5jd9BbeGUAABMnEIDUfZVkk2pXuwP34UMhuCBi02PMCqW/CZ6q8M+wFQF4it8JGg3GE+KJqhsXunXeRK/fJMZAD/lcSj5osw= 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 05DE5C41679; Mon, 29 Jan 2024 03:25:24 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rUIH6-00000004Fr1-40QR; Sun, 28 Jan 2024 22:25:32 -0500 Message-ID: <20240129032532.819040059@goodmis.org> User-Agent: quilt/0.67 Date: Sun, 28 Jan 2024 22:25:08 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, Vincent Donnefort Subject: [for-linus][PATCH 1/2] tracing/trigger: Fix to return error if failed to alloc snapshot References: <20240129032507.290291577@goodmis.org> 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: 1789393644649087024 X-GMAIL-MSGID: 1789393644649087024 From: "Masami Hiramatsu (Google)" Fix register_snapshot_trigger() to return error code if it failed to allocate a snapshot instead of 0 (success). Unless that, it will register snapshot trigger without an error. Link: https://lore.kernel.org/linux-trace-kernel/170622977792.270660.2789298642759362200.stgit@devnote2 Fixes: 0bbe7f719985 ("tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation") Cc: stable@vger.kernel.org Cc: Vincent Donnefort Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_trigger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } From patchwork Mon Jan 29 03:25:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 193226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp339199dyb; Sun, 28 Jan 2024 19:26:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmQ+2FKqinMpaHaSSJuTpG8eF9JY2W2XGt/pKr2c83ShGGwQF/4lyZsuhEgctaQ89pCAaN X-Received: by 2002:ac8:5803:0:b0:42a:525b:b76b with SMTP id g3-20020ac85803000000b0042a525bb76bmr6618353qtg.55.1706498769439; Sun, 28 Jan 2024 19:26:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706498769; cv=pass; d=google.com; s=arc-20160816; b=lexpPQSDWsdVeyQAjGghOEFwzEocj3d6CyKJgScJCold3tNlviyctGg9yBn3eQquXX Lt0w5o1YtiHgCtgxuAiUhiWzOOK0RckfHKVlhDc3tEAl9NWQL/qsNEsWoxTL5qlKj6Zn M1kWEreSw8H8q/Ika/4X9/8lbGVFD+jETiQOjZNa/LPELDujDUGioRQlSCM4smiCZPi5 jlbEh4iR43tOfoF3lxcXO3QmkIln4cfNkuy5q0roMurUB5LL2gRGfgiOBP4728cYnBdz DYIMx05IdKIX+xIVWYaAvlbaC6kg9nZTYkoHB19baYM3TXs9gDBClm/usJ2YCZBWeMdX m3HQ== 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=Y0oO9OYv4fsUuM0r75f6NybcP+SEzVd4nX4k5C6cREM=; fh=mapKFvE3Su4/54sYraTbr5edn5lsA07x7IZamsFtihs=; b=llva/s+FPDiwy+kjKLe5+72JCXsrTC6mhgoLLkBCjOO+AhfpgAzKE4i0lOASsjJu42 j7TBw207cFfn5/AjJlgi0N9zh3/wppkL3XcVW6azfAn7BhQBr2kzh9F5/0jUDTKCyWtk mDXsOd7KqRE+KwK0tb/frL0wQMEVodCsM5+4GCkUJchvrbWHVuO7xpo2sVZNJL3HdhpA aQRPk1oUsHNQGbagN9dsMe9q9y0ivpky1PkZ0xsust51DIaBMJ6kIk/+vJczhWfU+6wy za1N8nh4TlXoC+dK81aC0GwIHKBkFYOxA6DYVHhhqJFt0rRtcQtVpiHPvQcnWr3ZRKN+ HrIA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-42124-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42124-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n8-20020ac85a08000000b0042a09a98ae1si6999393qta.67.2024.01.28.19.26.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 19:26:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42124-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-42124-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42124-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 3DF8A1C21877 for ; Mon, 29 Jan 2024 03:26:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59F061EB42; Mon, 29 Jan 2024 03:25:26 +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 B77BC1078D for ; Mon, 29 Jan 2024 03:25:24 +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=1706498724; cv=none; b=rAnkV1RRUgolw6+rR2zufwHBkq3fwadOFy6Ejsy7D5aatAK96P1RrjIpI0V3mWlsMTuxgbzxrsWaXKtsxp4iiFQv5khZ2N44NRJ8yB5xSRznTXPFROae7RLWA8fggoJyX60kOlZcHsZVFsdRndzlntIJT1dCYonkvuDN3ezHCDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706498724; c=relaxed/simple; bh=RnbwjrjDZZt5dBQ8lSVav9CcZQtdfsC0kXd6oQD/gQw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=MSMmXtFxEiyh26IKTXKHaPkq+2hhS/+4VSBMVyFa6yJAP18Mp8znIWpTpNOGQCjs7vM7lztVhvWXOg9kA92gYtajuycO1fCKGiEycki5Ua7Enme4IQlYGcaXiLG37Kh1kYddaBJNTnw7ifS5RevrwYRcTKsZVw7EJHDr0TMexCM= 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 53163C43390; Mon, 29 Jan 2024 03:25:24 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rUIH7-00000004FrW-0UuX; Sun, 28 Jan 2024 22:25:33 -0500 Message-ID: <20240129032532.975198083@goodmis.org> User-Agent: quilt/0.67 Date: Sun, 28 Jan 2024 22:25:09 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Linus Torvalds Subject: [for-linus][PATCH 2/2] tracefs: remove stale update_gid code References: <20240129032507.290291577@goodmis.org> 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: 1789393653652863610 X-GMAIL-MSGID: 1789393653652863610 From: Linus Torvalds The 'eventfs_update_gid()' function is no longer called, so remove it (and the helper function it uses). Link: https://lore.kernel.org/all/CAHk-=wj+DsZZ=2iTUkJ-Nojs9fjYMvPs1NuoM3yK7aTDtJfPYQ@mail.gmail.com/ Fixes: 8186fff7ab64 ("tracefs/eventfs: Use root and instance inodes as default ownership") Signed-off-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 38 -------------------------------------- fs/tracefs/internal.h | 1 - 2 files changed, 39 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 */