mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Geyslan Gregório Bem" <geyslan@gmail.com>
Cc: kernel-br <kernel-br@googlegroups.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	open list <linux-kernel@vger.kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: Re: [PATCH] tracing: fix referencing after memory freeing and refactors code
Date: Fri, 18 Oct 2013 08:34:48 -0400	[thread overview]
Message-ID: <20131018083448.4d65ef78@gandalf.local.home> (raw)
In-Reply-To: <CAGG-pUSSeuaSMiOiTxQtgy84UZXq-VqOhSYyusi0XHJDbt=wJg@mail.gmail.com>

On Fri, 18 Oct 2013 08:02:32 -0300
Geyslan Gregório Bem <geyslan@gmail.com> wrote:

> >>
> >> I'm thinking of just nuking the tracing_open_generic() here. The only
> >> thing it does here is the tracing_disabled check. The assignment of
> >> inode->i_private to filp->private_data is pointless as it just
> >> reassigns it anyway.
> >>
> >> We could add a tracing_is_disabled() function to test instead.
> >
> > Nice, I can do it.
> >
> > Questions:
> 
> I realized that here not:

Right, tracing_is_disabled() should not be called as a fops method.

> >
> > 1267 static const struct file_operations ftrace_enable_fops = {
> > 1268         .open = tracing_open_generic,
> > ...
> > 1286 static const struct file_operations ftrace_event_filter_fops = {
> > 1287         .open = tracing_open_generic,
> > ...
> > 1317 static const struct file_operations ftrace_show_header_fops = {
> > 1318         .open = tracing_open_generic,
> 
> Tell me about this other case:
> >
> > Are that structures in same case? Their 'open' can be replaced to the
> > new 'tracing_is_disabled()?
> >
> > I think that 'subsystem_open()' can be also refactored to use the
> > about to rise 'tracing_is_disabled()'. Am I right?
> > 1096         ret = tracing_open_generic(inode, filp);

Hmm, no, it needs the assignment too. But perhaps we could just open
code it. The tracing_open_generic() is more for fops then to be a
helper for functions that don't use it for their .open routine.

Thus, for subsystem_open() you could have at the start:

	if (tracing_is_disabled())
		return -ENODEV;


Then have:

-       ret = tracing_open_generic(inode, filp);
-       if (ret < 0) {
-               trace_array_put(tr);
-               put_system(dir);
-       }
+       filp->private_data = dir;


-- Steve


> 
> Regards,
> -- Geyslan


  reply	other threads:[~2013-10-18 12:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18  1:44 Geyslan G. Bem
2013-10-18  2:46 ` Steven Rostedt
2013-10-18  9:49   ` Geyslan Gregório Bem
2013-10-18 11:02     ` Geyslan Gregório Bem
2013-10-18 12:34       ` Steven Rostedt [this message]
2013-10-19 12:43   ` Oleg Nesterov
2013-10-19 13:34     ` Oleg Nesterov
2013-10-19 13:58     ` Geyslan Gregório Bem
2013-10-19 14:18       ` Oleg Nesterov
2013-10-19 14:41         ` Geyslan Gregório Bem
2013-10-19 19:10           ` Steven Rostedt
2013-10-19 19:35             ` Geyslan Gregório Bem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131018083448.4d65ef78@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=geyslan@gmail.com \
    --cc=kernel-br@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®