mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH 4/5] tracing: Have mkdir and rmdir be part of tracefs
Date: Wed, 21 Jan 2015 15:47:36 -0500	[thread overview]
Message-ID: <20150121154736.4d32e2a0@gandalf.local.home> (raw)
In-Reply-To: <20150121172101.953700301@goodmis.org>

On Wed, 21 Jan 2015 12:19:57 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> The tracing "instances" directory can create sub tracing buffers
> with mkdir, and remove them with rmdir. As a mkdir will also create
> all the files and directories that control the sub buffer the locks
> needed to be released before doing so to avoid deadlock. This method
> was not very robust, and could potentially have a race somewhere due
> to the lock releasing within the removing of the directory. But this
> was needed because debugfs did not provide a mkdir or rmdir method
> from syscalls.
> 
> Now that tracing has been converted over to tracefs, the tracefs file
> system can be modified to accommodate this feature. Instead of needing
> to release the locks, keep them locked but add a way to flag that they
> are locked and do not need to be locked again.
> 
> A struct trace_dir_ops is created that holds the methods to be called
> for both mkdir and rmdir, as well as a pointer to let the tracefs subsystem
> know that the current inode's lock is already held by the calling process.
> 
> The pointer holds the current owner of the lock, and this is checked when
> creating new files or removing old ones, and if the pointer matches current,
> then the lock is not taken to avoid the deadlock.

Grumble, my tests triggered this bug with lockdep on:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#6);
                               lock(trace_types_lock);
                               lock(&sb->s_type->i_mutex_key#6);
  lock(trace_types_lock);

 *** DEADLOCK ***


I need to take that trace_types_lock here, but it's true that that lock
is held when these mutexes are taken. I'll have to spend a bit more
time figuring out how to solve this :-/

-- Steve

  parent reply	other threads:[~2015-01-21 20:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 17:19 [RFC][PATCH 0/5] tracing: Add new file system tracefs Steven Rostedt
2015-01-21 17:19 ` [RFC][PATCH 1/5] tracefs: Add new tracefs file system Steven Rostedt
2015-01-21 18:30   ` Steven Rostedt
2015-01-21 17:19 ` [RFC][PATCH 2/5] tracing: Convert the tracing facility over to use tracefs Steven Rostedt
2015-01-21 17:32   ` Steven Rostedt
2015-01-21 17:19 ` [RFC][PATCH 3/5] tracing: Automatically mount tracefs on debugfs/tracing Steven Rostedt
2015-01-21 17:19 ` [RFC][PATCH 4/5] tracing: Have mkdir and rmdir be part of tracefs Steven Rostedt
2015-01-21 18:31   ` Steven Rostedt
2015-01-21 20:47   ` Steven Rostedt [this message]
2015-01-21 17:19 ` [RFC][PATCH 5/5] tracefs: Add directory /sys/kernel/tracing Steven Rostedt
2015-01-21 17:32 ` [RFC][PATCH 0/5] tracing: Add new file system tracefs Steven Rostedt
2015-01-21 23:00 ` Greg Kroah-Hartman
2015-01-22  1:47   ` Steven Rostedt
2015-01-22  3:07     ` Steven Rostedt
2015-01-22  3:18       ` Greg Kroah-Hartman
2015-01-22  3:51         ` Steven Rostedt
2015-01-22 12:32           ` Tejun Heo
2015-01-22 12:33             ` Tejun Heo
2015-01-22 14:32             ` Steven Rostedt
2015-01-22 14:55               ` Tejun Heo
2015-01-22 15:15                 ` Steven Rostedt
2015-01-22 15:24                   ` Tejun Heo
2015-01-22  4:23   ` Al Viro
2015-01-22  4:35     ` Steven Rostedt
2015-01-22 12:49       ` Tejun Heo
2015-01-22 12:26     ` Tejun Heo

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=20150121154736.4d32e2a0@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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®